//native
type Leonardoai = {
apiKey: string;
};
/**
* Perform Alchemy Upscale on a LCM image
* This endpoint will perform Alchemy Upscale on a LCM image
*/
export async function main(
auth: Leonardoai,
body: {
imageDataUrl: string;
prompt: string;
guidance?: number;
strength?: number;
requestTimestamp?: string;
style?:
| "ANIME"
| "CINEMATIC"
| "DIGITAL_ART"
| "DYNAMIC"
| "ENVIRONMENT"
| "FANTASY_ART"
| "ILLUSTRATION"
| "PHOTOGRAPHY"
| "RENDER_3D"
| "RAYTRACED"
| "SKETCH_BW"
| "SKETCH_COLOR"
| "VIBRANT"
| "NONE";
steps?: number;
width?: number;
height?: number;
seed?: number;
refineCreative?: false | true;
refineStrength?: number;
},
) {
const url = new URL(`https://cloud.leonardo.ai/api/rest/v1/lcm-upscale`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago