NAME

OpenAI::API::Request::Image::Generation - generates images from a prompt

SYNOPSIS

use OpenAI::API::Request::Image::Generation;

my $request = OpenAI::API::Request::Image::Generation->new(
    prompt => 'A cute baby sea otter',
    size   => '256x256',
);

my $res = $request->send();

my @images = $res->{data}->@*;

DESCRIPTION

Creates an image given a prompt.

METHODS

new()

  • prompt

    A text description of the desired image(s).

  • n [optional]

    The number of images to generate. Must be between 1 and 10. Defaults to 1.

  • size [optional]

    The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024. Defaults to 1024x1024.

  • response_format [optional]

    The format in which the generated images are returned. Must be one of url or b64_json. Defaults to url.

  • user [optional]

    A unique identifier representing your end-user.

send()

send($openai_config)

Sends the request and returns a data structured similar to the one documented in the API reference.

SEE ALSO

OpenAI API Reference: Models