Edits history of script submission #12504 for ' Create LCM Generation (leonardoai)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Leonardoai = {
      apiKey: string;
    };
    /**
     * Create LCM Generation
     * This endpoint will generate a LCM image generation.
     */
    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;
      },
    ) {
      const url = new URL(`https://cloud.leonardo.ai/api/rest/v1/generations-lcm`);
    
      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