Images
Generate, edit, and read images — POST /v1/images/generations, /v1/images/edits, and /v1/images/understanding.
POST /v1/images/generations takes OpenAI's images request. The router resolves model like chat
and rewrites only that field — size, n, quality, response_format, and any provider-specific
extra reach the upstream untouched. The response is relayed unchanged.
curl http://localhost:8080/v1/images/generations \
-H "Authorization: Bearer sk_tr_..." \
-H "Content-Type: application/json" \
-d '{ "model": "openai/gpt-image-1", "prompt": "A watercolor fox in a snowy forest", "size": "1024x1024" }'{ "created": 1760000000, "data": [{ "b64_json": "iVBORw0KGgo…" }] }Depending on the model and response_format, each item carries b64_json or a temporary url. With
the OpenAI SDK, set baseURL to http://localhost:8080/v1 and call images.generate.
Providers
Every catalog provider that lists the image capability on the OpenAI dialect serves this
endpoint — OpenAI, Gemini, Together AI, Meta Muse, and xAI — plus any OpenAI-compatible custom
provider (for example a hosted FLUX endpoint addressed as <provider-slug>/<model>).
Codex accounts generate images too, through the Responses image_generation tool on a ChatGPT
plan; the router returns the same images shape. Accounts on the free or k12 plan cannot, so the
router moves on to the next target.
GET /v1/models/image lists the image models this key may use: aliases and chains first, then
provider/model ids (see Models by kind).
Slow models
Generation can take tens of seconds; the router waits up to 90 seconds before answering 504.
400 means the model names a provider without image generation; 503 means no account is connected
for it.
Aliases and chains
Image models route through aliases and chains like chat models: turn on
Show media models in the form, pick the targets, and a failing target falls back to the next. Keep
a route's targets to image models only. A route whose targets are all image models is listed with
"kind": "image" in GET /v1/models; for a model whose id does not say so (FLUX), set its Output
formats to Image only. The route's Per image selling price applies whichever target serves.
Pricing
A flat price (Per request on an override, alias, or chain) is charged for each image returned:
n: 4 costs four times as much. The wallet must cover the n asked for before the request runs. A
model priced by tokens is charged the tokens the provider reports; one that reports none costs
nothing, so give it a flat price.
A model nothing prices (no override, no built-in price, and no alias or chain price) is free, like one
priced at 0: nothing is charged, so the operator carries the provider's cost. A key owned by a portal
user then needs the same minimum balance as for a free chat model. Operator keys are not checked. A
provider/model id is charged the operator's price for that model; an alias or chain is charged its
selling price.
Edits
Two shapes edit an existing image. Both need the images scope and send the upstream a multipart
request to images/edits.
The standard OpenAI multipart route, POST /v1/images/edits, takes image (or several image[])
plus an optional mask; every other field passes through:
curl http://localhost:8080/v1/images/edits \
-H "Authorization: Bearer sk_tr_..." \
-F model=openai/gpt-image-1 \
-F prompt="Add a red scarf" \
-F image=@fox.pngOr stay on JSON: add input_image to a generations request, as a data URL or raw base64 (a string,
or an array of them). Remote http(s) URLs are refused with 400.
{
"model": "openai/gpt-image-1",
"prompt": "Make it night",
"input_image": "data:image/png;base64,iVBORw0KGgo…"
}Image understanding
POST /v1/images/understanding asks a vision chat model about one or more images. It needs the
chat scope and is billed by tokens like chat.
curl http://localhost:8080/v1/images/understanding \
-H "Authorization: Bearer sk_tr_..." \
-H "Content-Type: application/json" \
-d '{ "model": "openai/gpt-4o-mini", "prompt": "What is in this picture?", "images": ["https://example.com/fox.jpg"], "max_tokens": 300 }'{
"model": "gpt-4o-mini",
"text": "A red fox in the snow.",
"usage": { "prompt_tokens": 812, "completion_tokens": 9, "total_tokens": 821 }
}images holds URLs or data URLs. Only targets whose model reads images are tried;
GET /v1/models/image_to_text lists them.
Images inside chat
An operator can turn on a generate_image tool on the dashboard's Image Tool page (settings
image_tool_enabled and image_tool_model, the image model that serves it). Once on, chats from keys with the images scope
get the tool on models that can call tools; the model draws when it decides to, and the image shows
inline in its reply. Each image is billed as its own usage row, apart from the chat tokens.
A portal user can pick their own image model (an alias or chain) and a prompt on the portal's Image Tool page
(GET/PATCH /v1/user/image-tool). Both apply to chats from all their keys: the model replaces the
operator's, and the prompt is added after what the chat asked for.