Skip to content

Images

Use POST /v1/images/generations for OpenAI-style image generation.

text
POST https://api.rout.my/v1/images/generations

Request

bash
curl https://api.rout.my/v1/images/generations \
  -H "Authorization: Bearer $ROUTMY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "provider/image-model-id",
    "prompt": "A clean product photo of a translucent blue cube on a white table",
    "n": 1,
    "image_config": {
      "aspect_ratio": "1:1",
      "image_size": "1K"
    }
  }'

Request fields

FieldTypeRequiredNotes
modelstringYesExact image model ID from /v1/models.
promptstringYesText description of the image.
nintegerNoNumber of images requested. Defaults to provider behavior when omitted.
sizestringNoOpenAI-style size value, when supported by the model.
qualitystringNoQuality hint, when supported by the model.
stylestringNoStyle hint, when supported by the model.
userstringNoClient-side user identifier.
image_configobjectNoProvider-neutral image settings.

image_config

FieldTypeNotes
aspect_ratiostringCommon values include 1:1, 16:9, 9:16, 4:3, 3:4, 4:5, 5:4, and 21:9.
image_sizestringCommon values include 1K, 2K, and 4K. Values are forwarded to the provider when supported.

Response

The response follows an OpenAI-style image generation shape. Depending on the upstream provider, each image can contain a URL or base64 payload.

json
{
  "created": 1744000000,
  "data": [
    {
      "url": "https://example.com/generated-image.png",
      "revised_prompt": "A clean product photo of a translucent blue cube..."
    }
  ]
}

or:

json
{
  "created": 1744000000,
  "data": [
    {
      "b64_json": "iVBORw0KGgo..."
    }
  ]
}

Client code should handle both url and b64_json.

Quota accounting

Image generation deducts per generated image, multiplied by the model's token_multiplier:

Requested sizeBase quota units per image
empty, 1K, 2K, or other non-4K values5,000
4K12,500

Provider-reported usage can also be used internally when available. The public response does not expose billing metadata.

Chat image generation

Some image-capable chat models use /v1/chat/completions with modalities: ["image", "text"]. See Chat Completions for that request shape.

API documentation for rout.my.