Skip to main content
POST
/
v2
/
router
/
images
/
generations
Create image
curl --request POST \
  --url https://api.orq.ai/v2/router/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "model": "<string>",
  "background": "transparent",
  "moderation": "low",
  "n": 1,
  "output_compression": 50,
  "output_format": "png",
  "quality": "auto",
  "response_format": "url",
  "size": "<string>",
  "style": "vivid",
  "name": "<string>",
  "fallbacks": [
    {
      "model": "<string>"
    }
  ],
  "retry": {
    "count": 3,
    "on_codes": [
      429,
      500,
      502,
      503,
      504
    ]
  },
  "cache": {
    "type": "exact_match",
    "ttl": 3600
  },
  "load_balancer": {
    "type": "weight_based",
    "models": [
      {
        "model": "openai/gpt-4o",
        "weight": 0.7
      }
    ]
  },
  "timeout": {
    "call_timeout": 30000
  },
  "orq": {
    "name": "<string>",
    "fallbacks": [
      {
        "model": "openai/gpt-4o-mini"
      }
    ],
    "cache": {
      "type": "exact_match",
      "ttl": 3600
    },
    "retry": {
      "count": 3,
      "on_codes": [
        429,
        500,
        502,
        503,
        504
      ]
    },
    "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"
      ]
    },
    "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
    }
  }
}
'
{
  "created": 123,
  "data": [
    {
      "revised_prompt": "<string>",
      "b64_json": "<string>",
      "url": "<string>"
    }
  ],
  "usage": {
    "input_tokens_details": {
      "image_tokens": 123,
      "text_tokens": 123
    },
    "input_tokens": 123,
    "output_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

input

prompt
string
required

A text description of the desired image(s).

model
string
required

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

background
enum<string> | null

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

Available options:
transparent,
opaque,
auto
moderation
enum<string> | null

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

Available options:
low,
auto
n
integer | null
default:1

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

Required range: 1 <= x <= 10
output_compression
integer | null

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.

Required range: 0 <= x <= 100
output_format
enum<string> | null

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

Available options:
png,
jpeg,
webp
quality
enum<string> | null

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

Available options:
auto,
high,
medium,
low,
hd,
standard
response_format
enum<string> | null

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.

Available options:
url,
b64_json
size
string | null

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

style
enum<string> | null

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

Available options:
vivid,
natural
name
string

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

fallbacks
object[]

Array of fallback models to use if primary model fails

retry
object

Retry configuration for the request

cache
object

Cache configuration for the request.

load_balancer
object

Load balancer configuration for the request.

timeout
object

Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured.

orq
object

Response

200 - application/json

Represents an image generation response from the API.

created
number
required

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

data
object[]
required

Represents the url or the content of an image generated.

usage
object