Image generation API

Image generation is compatible with the OpenAI Images protocol. Only image generation models (models priced "per image" in the model catalog) can call it; chat endpoints do not accept image models.

Parameters by model ID

Set model to the model ID shown in the console model catalog (without a namespace). You can only call models enabled for your API key; otherwise you get 403 model_not_allowed.

Model ID Billing Parameters
gpt-image-2.6 Per image GPT Image models
gpt-image-2.6-flare Per image GPT Image models
gpt-image-2.6-sunburst Per image GPT Image models
nano-banana-2.0 Per image, by resolution tier Nano Banana image models
nano-banana-pro Per image, by resolution tier Nano Banana image models
Image-2.0-high Per image, by resolution tier Image 2 image models
Image-2.0-medium Per image, by resolution tier Image 2 image models
Image-2.5-flare Per image, by resolution tier Image 2 image models
Image-2.5-sunburst Per image, by resolution tier Image 2 image models

The console model catalog is the source of truth for availability.

Generate images

POST https://api.admesh.ai/v1/images/generations
curl https://api.admesh.ai/v1/images/generations \
  -H "Authorization: Bearer $ADMESH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.6",
    "prompt": "A watercolor lighthouse on a cliff at dawn",
    "n": 1
  }'

Returns a standard OpenAI Images response; each item in data is one image (url or b64_json, depending on the model).

Only the generations endpoint /v1/images/generations is available; /v1/images/edits is not.

Request fields

Field Description
model Required, an image model ID
prompt Required, text description, up to 32000 characters
n Number of images, positive integer, default 1, at most 10 per request
size, etc. Other OpenAI Images parameters are passed through as the model supports them; see the model page

stream is not supported.

Billing

  • We hold "number of images × price per image" at submission; with too little balance you get 402 insufficient_balance.
  • We settle on the number of images actually returned (no more than n) and release the rest; tokens are not billed.
  • Failed generations are not charged.
  • Per-model prices are on each model page.

Size tiers and input images

Some image models price by output resolution tier (1080p / 2K / 4K, or "≤ 2.36 MP" vs. larger) or charge per input reference image (sometimes with the first few free); see the model page. For such models the tier must be determinable: pass size (WIDTHxHEIGHT, not auto), or aspect_ratio + resolution where the model page allows it. Input images are counted from image / images. Both the hold and the settlement are computed from your request.