Edits history of script submission #244 for ' Generate Image (openai)'

  • deno
    One script reply has been approved by the moderators
    Ap­pro­ved
    import { Configuration, OpenAIApi } from "npm:[email protected]";
    
    /**
     * @param prompt The maximum length is 1000 characters.
     */
    type Openai = {
      api_key: string;
      organization_id: string;
    };
    export async function main(
      auth: Openai,
      prompt: string,
      number_of_images:
        | "1"
        | "2"
        | "3"
        | "4"
        | "5"
        | "6"
        | "7"
        | "8"
        | "9"
        | "10" = "1",
      size: "256x256" | "512x512" | "1024x1024" = "1024x1024",
      response_format: "url" | "b64_json" = "url"
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id,
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createImage({
        prompt,
        n: +number_of_images,
        size,
        response_format,
      });
      return response.data.data;
    }
    

    Submitted by hugo697 374 days ago

  • deno
    import { Configuration, OpenAIApi } from "npm:[email protected]";
    
    /**
     * @param prompt The maximum length is 1000 characters.
     */
    type Openai = {
      api_key: string;
      organization_id: string;
    };
    export async function main(
      auth: Openai,
      prompt: string,
      number_of_images:
        | "1"
        | "2"
        | "3"
        | "4"
        | "5"
        | "6"
        | "7"
        | "8"
        | "9"
        | "10" = "1",
      size: "256x256" | "512x512" | "1024x1024" = "1024x1024",
      response_format: "url" | "b64_json" = "url"
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id,
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createImage({
        prompt,
        n: +number_of_images,
        size,
        response_format,
      });
      return response.data.data;
    }
    

    Submitted by hugo697 897 days ago

  • deno
    import { Configuration, OpenAIApi } from "npm:[email protected]";
    
    /**
     * @param prompt The maximum length is 1000 characters.
     */
    type Openai = {
      api_key: string;
      organization_id: string;
    };
    export async function main(
      auth: Openai,
      prompt: string,
      number_of_images:
        | "1"
        | "2"
        | "3"
        | "4"
        | "5"
        | "6"
        | "7"
        | "8"
        | "9"
        | "10" = "1",
      size: "256x256" | "512x512" | "1024x1024" = "1024x1024",
      response_format: "url" | "b64_json" = "url",
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id,
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createImage({
        prompt,
        n: +number_of_images,
        size,
        response_format,
      });
      return response.data.data;
    }
    

    Submitted by admin 1007 days ago

  • deno
    import { Configuration, OpenAIApi } from "npm:[email protected]"
    
    /**
     * @param prompt The maximum length is 1000 characters.
     */
    type Openai = {
      api_key: string;
      organization_id: string;
    };
    export async function main(
      auth: Openai,
      prompt: string,
      number_of_images: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' = '1',
      size: '256x256' | '512x512' | '1024x1024' = '1024x1024',
      response_format: 'url' | 'b64_json' = 'url'
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createImage({
        prompt,
        n: +number_of_images,
        size,
        response_format
      });
      return response.data.data;
    }
    

    Submitted by admin 1010 days ago

  • deno
    import type { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { Configuration, OpenAIApi } from "npm:[email protected]"
    
    /**
     * @param prompt The maximum length is 1000 characters.
     */
    export async function main(
      auth: Resource<'openai'>,
      prompt: string,
      number_of_images: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' = '1',
      size: '256x256' | '512x512' | '1024x1024' = '1024x1024',
      response_format: 'url' | 'b64_json' = 'url'
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createImage({
        prompt,
        n: +number_of_images,
        size,
        response_format
      });
      return response.data.data;
    }
    

    Submitted by adam186 1138 days ago

  • deno
    import type { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { Configuration, OpenAIApi } from "npm:[email protected]"
    
    /**
     * @param prompt The maximum length is 1000 characters.
     */
    export async function main(
      auth: Resource<'openai'>,
      prompt: string,
      number_of_images: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' = '1',
      size: '256x256' | '512x512' | '1024x1024' = '1024x1024',
      response_format: 'url' | 'b64_json' = 'url'
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createImage({
        prompt,
        n: +number_of_images,
        size,
        response_format
      });
      return response.data.data;
    }
    

    Submitted by adam186 1173 days ago

  • deno
    import type { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { Configuration, OpenAIApi } from "npm:[email protected]"
    
    /**
     * @param prompt The maximum length is 1000 characters.
     */
    export async function main(
      auth: Resource<'openai'>,
      prompt: string,
      number_of_images: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' = '1',
      size: '256x256' | '512x512' | '1024x1024' = '1024x1024',
      response_format: 'url' | 'b64_json' = 'url'
    ) {
      const configuration = new Configuration({
        apiKey: auth.api_key,
        organization: auth.organization_id
      });
      const openai = new OpenAIApi(configuration);
    
      const response = await openai.createImage({
        prompt,
        n: +number_of_images,
        size,
        response_format
      });
      return response.data.data;
    }
    

    Submitted by adam186 1251 days ago