Change image

CURRENTLY NOT SUPPORTED

Creates a variation of a given image.

Request

POST

https://ai.api.cloud.yandex.net/v1/images/variations
        

Body

multipart/form-data
{
          "image": "example",
          "model": "example",
          "n": 1,
          "response_format": "url",
          "size": "1024x1024",
          "user": "example"
        }
        

Name

Description

image

Type: string<binary>

The image to use as the basis for the variation(s).

Example: example

model

Any of 1 type
  • Type: string

    Example: example

The model to use for image generation.

Example: example

n

Type: integer | null

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

Default: 1

Min value: 1

Max value: 10

response_format

Type: string | null

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.

Default: url

Enum: url, b64_json

size

Type: string | null

The size of the generated images.

Default: 1024x1024

Const: 1024x1024

Example: 1024x1024

user

Type: string

A unique identifier representing your end-user, which can help AI Studio to monitor and detect abuse.

Example: example

Responses

200 OK

OK

Body

application/json
{
          "created": 0,
          "data": [
            {
              "b64_json": "example",
              "url": "example",
              "revised_prompt": "example"
            }
          ],
          "background": "transparent",
          "output_format": "png",
          "size": "1024x1024",
          "quality": "low",
          "usage": {
            "input_tokens": 0,
            "total_tokens": 0,
            "output_tokens": 0,
            "output_tokens_details": {
              "image_tokens": 0,
              "text_tokens": 0
            },
            "input_tokens_details": {
              "text_tokens": 0,
              "image_tokens": 0
            }
          }
        }
        

Name

Description

created

Type: integer

The Unix timestamp (in seconds) of when the image was created.

background

Type: string

The background parameter used for the image generation. Either transparent or opaque.

Enum: transparent, opaque

data

Type: Image[]

The list of generated images.

Example
[
          {
            "b64_json": "example",
            "url": "example",
            "revised_prompt": "example"
          }
        ]
        

output_format

Type: string

The output format of the image generation. Either png, webp, or jpeg.

Enum: png, webp, jpeg

quality

Type: string

The quality of the image generated. Either low, medium, or high.

Enum: low, medium, high

size

Type: string

The size of the image generated. Either 1024x1024, 1024x1536, or 1536x1024.

Enum: 1024x1024, 1024x1536, 1536x1024

usage

Type: ImageGenUsage

The token usage information for the image generation.

Example
{
          "input_tokens": 0,
          "total_tokens": 0,
          "output_tokens": 0,
          "output_tokens_details": {
            "image_tokens": 0,
            "text_tokens": 0
          },
          "input_tokens_details": {
            "text_tokens": 0,
            "image_tokens": 0
          }
        }
        

Image

Represents the content or the URL of a generated image.

Name

Description

b64_json

Type: string

The base64-encoded JSON of the generated image.

Example: example

revised_prompt

Type: string

CURRENTLY NOT SUPPORTED

The revised prompt that was used to generate the image.

Example: example

url

Type: string

CURRENTLY NOT SUPPORTED

The URL of the generated image generated image.

Example: example

Example
{
          "b64_json": "example",
          "url": "example",
          "revised_prompt": "example"
        }
        

ImageGenOutputTokensDetails

The output token details for the image generation.

Name

Description

image_tokens

Type: integer

The number of image output tokens generated by the model.

text_tokens

Type: integer

The number of text output tokens generated by the model.

Example
{
          "image_tokens": 0,
          "text_tokens": 0
        }
        

ImageGenInputUsageDetails

The input tokens detailed information for the image generation.

Name

Description

image_tokens

Type: integer

The number of image tokens in the input prompt.

text_tokens

Type: integer

The number of text tokens in the input prompt.

Example
{
          "text_tokens": 0,
          "image_tokens": 0
        }
        

ImageGenUsage

The token usage information for the image generation.

Name

Description

input_tokens

Type: integer

The number of tokens (images and text) in the input prompt.

input_tokens_details

Type: ImageGenInputUsageDetails

The input tokens detailed information for the image generation.

Example
{
          "text_tokens": 0,
          "image_tokens": 0
        }
        

output_tokens

Type: integer

The number of output tokens generated by the model.

total_tokens

Type: integer

The total number of tokens (images and text) used for the image generation.

output_tokens_details

Type: ImageGenOutputTokensDetails

The output token details for the image generation.

Example
{
          "image_tokens": 0,
          "text_tokens": 0
        }
        
Example
{
          "input_tokens": 0,
          "total_tokens": 0,
          "output_tokens": 0,
          "output_tokens_details": {
            "image_tokens": 0,
            "text_tokens": 0
          },
          "input_tokens_details": {
            "text_tokens": 0,
            "image_tokens": 0
          }
        }
        
Предыдущая
Следующая