NAME

OpenAPI::Client::OpenAI::Path::images-variations - Documentation for the /images/variations path.

OPERATIONS

POST /images/variations

createImageVariation

$client->create_image_variation({
    body => { ... },
});

Creates a variation of a given image. This endpoint only supports dall-e-2 .

Responses

200 - OK

Content-Type: application/json

Example:

{
   "background" : "transparent",
   "created" : 1713833628,
   "data" : [
      {
         "b64_json" : "..."
      }
   ],
   "output_format" : "png",
   "quality" : "high",
   "size" : "1024x1024",
   "usage" : {
      "input_tokens" : 50,
      "input_tokens_details" : {
         "image_tokens" : 40,
         "text_tokens" : 10
      },
      "output_tokens" : 50,
      "total_tokens" : 100
   }
}

SCHEMAS

CreateImageVariationRequest

Properties:

  • image (string, required) - The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.

  • model (anyOf) - The model to use for image generation. Only dall-e-2 is supported at this time.

    Default: dall-e-2

  • n (integer) - The number of images to generate. Must be between 1 and 10.

    Default: 1

  • response_format (string) - The format in which the generated images are returned. Must be one of url or b64_json . URLs are only valid for 60 minutes after the image has been generated.

    Allowed values: url, b64_json

    Default: url

  • size (string) - The size of the generated images. Must be one of 256x256 , 512x512 , or 1024x1024 .

    Allowed values: 256x256, 512x512, 1024x1024

    Default: 1024x1024

  • user (string) - A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more .

Image

Properties:

  • b64_json (string) - The base64-encoded JSON of the generated image. Returned by default for the GPT image models, and only present if response_format is set to b64_json for dall-e-2 and dall-e-3 .

  • revised_prompt (string) - For dall-e-3 only, the revised prompt that was used to generate the image.

  • url (string) - When using dall-e-2 or dall-e-3 , the URL of the generated image if response_format is set to url (default value). Unsupported for the GPT image models.

ImageGenInputUsageDetails

Properties:

  • image_tokens (integer, required) - The number of image tokens in the input prompt.

  • text_tokens (integer, required) - The number of text tokens in the input prompt.

ImageGenOutputTokensDetails

Properties:

  • image_tokens (integer, required) - The number of image output tokens generated by the model.

  • text_tokens (integer, required) - The number of text output tokens generated by the model.

ImageGenUsage

Properties:

  • input_tokens (integer, required) - The number of tokens (images and text) in the input prompt.

  • input_tokens_details (ImageGenInputUsageDetails, required)

    See "ImageGenInputUsageDetails" below for shape.

  • output_tokens (integer, required) - The number of output tokens generated by the model.

  • output_tokens_details (ImageGenOutputTokensDetails)

    See "ImageGenOutputTokensDetails" below for shape.

  • total_tokens (integer, required) - The total number of tokens (images and text) used for the image generation.

ImagesResponse

Properties:

  • background (string) - The background parameter used for the image generation. Either transparent or opaque .

    Allowed values: transparent, opaque

  • created (integer, required) - The Unix timestamp (in seconds) of when the image was created.

  • data (array of Image) - The list of generated images.

  • output_format (string) - The output format of the image generation. Either png , webp , or jpeg .

    Allowed values: png, webp, jpeg

  • quality (string) - The quality of the image generated. Either low , medium , or high .

    Allowed values: low, medium, high

  • size (string) - The size of the image generated. Either 1024x1024 , 1024x1536 , or 1536x1024 .

    Allowed values: 1024x1024, 1024x1536, 1536x1024

  • usage (ImageGenUsage)

    See "ImageGenUsage" below for shape.

SEE ALSO

OpenAPI::Client::OpenAI::Path

COPYRIGHT AND LICENSE

Copyright (C) 2023-2026 by Nelson Ferraz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.