Images

Create image

Create an Image

post/v2/router/images/generations

Request body

promptstring required

A text description of the desired image(s).

background'transparent' | 'opaque' | 'auto' | 'null' nullable

Allows to set transparency for the background of the generated image(s). This parameter is only supported for openai/gpt-image-1.

modelstring required

The model to use for image generation. One of openai/dall-e-2, openai/dall-e-3, or openai/gpt-image-1.

moderation'low' | 'auto' | 'null' nullable

Control the content-moderation level for images generated by gpt-image-1. Must be either low or auto.

ninteger nullable

The number of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported.

output_compressioninteger nullable

The compression level (0-100%) for the generated images. This parameter is only supported for gpt-image-1 with the webp or jpeg output formats.

output_format'png' | 'jpeg' | 'webp' | 'null' nullable

The format in which the generated images are returned. This parameter is only supported for openai/gpt-image-1.

quality'auto' | 'high' | 'medium' | 'low' | 'hd' | 'standard' | 'null' nullable

The quality of the image that will be generated. auto will automatically select the best quality for the given model.

response_format'url' | 'b64_json' | 'null' nullable

The format in which generated images are returned. Must be one of url or b64_json. This parameter isn't supported for gpt-image-1 which will always return base64-encoded images.

sizestring nullable

The size of the generated images. Must be one of the specified sizes for each model.

style'vivid' | 'natural' | 'null' nullable

The style of the generated images. This parameter is only supported for openai/dall-e-3. Must be one of vivid or natural.

metadataobject

Optional metadata for the request. This metadata will be stored in the trace and can be used for filtering.

namestring

The name to display on the trace. If not specified, the default system name will be used.

Example request

{
  "retry": {
    "count": 3,
    "on_codes": [
      429,
      500,
      502,
      503,
      504
    ]
  },
  "cache": {
    "ttl": 3600
  },
  "load_balancer": {
    "models": [
      {
        "model": "openai/gpt-4o",
        "weight": 0.7
      }
    ]
  },
  "timeout": {
    "call_timeout": 30000
  },
  "orq": {
    "retry": {
      "count": 3,
      "on_codes": [
        429,
        500,
        502,
        503,
        504
      ]
    },
    "fallbacks": [
      {
        "model": "openai/gpt-4o-mini"
      }
    ],
    "identity": {
      "id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
      "display_name": "Jane Doe",
      "email": "jane.doe@example.com",
      "metadata": [
        {
          "department": "Engineering",
          "role": "Senior Developer"
        }
      ],
      "logo_url": "https://example.com/avatars/jane-doe.jpg",
      "tags": [
        "hr",
        "engineering"
      ]
    },
    "contact": {
      "id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
      "display_name": "Jane Doe",
      "email": "jane.doe@example.com",
      "metadata": [
        {
          "department": "Engineering",
          "role": "Senior Developer"
        }
      ],
      "logo_url": "https://example.com/avatars/jane-doe.jpg",
      "tags": [
        "hr",
        "engineering"
      ]
    },
    "cache": {
      "ttl": 3600
    },
    "load_balancer": {
      "type": "weight_based",
      "models": [
        {
          "model": "openai/gpt-4o",
          "weight": 0.7
        },
        {
          "model": "anthropic/claude-3-5-sonnet",
          "weight": 0.3
        }
      ]
    },
    "timeout": {
      "call_timeout": 30000
    }
  }
}

Response

Represents an image generation response from the API.

creatednumber required

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