Image generation
Generate images from a text prompt, in the OpenAI images shape. Each request is admitted, held and settled like a chat request, and billed at the provider's list price (per image, or per output token for OpenAI's gpt-image and Microsoft's MAI) plus your platform fee.
Body
application/json, up to 1 MiB; unknown fields refused- modelstringrequired
A certified image model, such as
bfl/flux-3-image,recraft/recraft-v4.1,openai/gpt-image-2orspacexai/grok-imagine-image.GET /v1/modelslists the ones your key may use withtype: "image". A team alias that names an image model works too. Chat and embedding models are refused with400 invalid_request. - promptstringrequired
What to draw, up to 32,000 characters.
- nintegeroptional
How many images, 1 to 4. Defaults to 1. Each image is billed.
- sizestringoptional
WIDTHxHEIGHT, such as1024x1024. Providers treat it as a target and may return a nearby size of the same shape. Without it the provider's default size is used. Token-priced models take only the sizes listed for them inGET /v1/pricing(image_output_tokens), such as1024x1024,1024x1536and1536x1024; others are refused with400 invalid_request. - response_formatb64_jsonoptional
Images are always returned as base64 in
data[].b64_json.urlis refused: images are not stored, so there is no URL to give. - providerOptionsobjectoptional
Options for the model's provider, passed through as given: aspect ratio, style, quality, seed and output format are set here, for example
{ "recraft": { "style": "vector_illustration" } }or{ "blackForestLabs": { "outputFormat": "jpeg" } }. For OpenAI's gpt-image, set the quality with{ "openai": { "quality": "low" } }: it decides how many tokens the image takes. See each provider's options in the AI SDK provider docs. Routing options (gateway) are ignored. - userstringoptional
Your end user, recorded for attribution and per-end-user Directives, and not forwarded.
- ibobjectoptional
tags(up to ten) andsession, as on chat completions. Not forwarded.
Headers
- Authorizationstringrequired
Bearer ib_live_…, or the key inx-api-key. See Authentication. - X-Client-Request-IDstringoptional
Your own correlation id, recorded on the receipt.
- ib-sessionstringoptional
Groups the request with others in Logs.
- ib-userstringoptional
Your end user, up to 256 characters; wins over the body's. See End users and tags.
- ib-tagsstringoptional
Comma-separated tags for cost breakdowns, at most ten with
ib.tags. Never sent upstream.
Notes
- Costoptional
Before the call, your balance holds
nimages at the highest price the request can reach: the listed price for the size you ask for (or the next larger listed size), and the most expensive size, quality or style when you passproviderOptions. For a token-priced model it holds the most output tokens one image took when we measured that size and quality, with 20% headroom, at the listed output price: every quality when you don't name one, and every size when you don't name one or when the model's tokens didn't grow with size as measured. The request settles at what the provider billed.GET /v1/pricinglists each model'sper_imageprice and itsper_image_tiers, or its token prices andimage_output_tokens. Look up the receipt withGET /v1/requests/:idusing theX-Request-IDresponse header. - Modelsoptional
Models priced per image, and token-priced ones whose output tokens we measured for every size and quality they take, because their cost is known before the call. Models the gateway lists without a price (FLUX.2, Prodia, Topaz) aren't offered.
- Failoveroptional
If a provider fails before answering, the request is tried once on another certified provider of the same model, never on a different model.
- Directivesoptional
Model and provider allowlists, budgets, rate limits,
maxRequestChargeUsd,requireZdrandrequireNoTrainingapply. Few image providers offer zero data retention, so a team that requires it can use only those that do. The estimated prompt counts againsttokensPerMinute. - Logsoptional
When your team keeps request content, the stored response shows each image's size, not the image.
- Limitsoptional
A call has 3 minutes. Responses are not streamed, and Idempotency-Key is not supported here. To change an existing image, use image edits.