Create Image
Generate images from text, or guide them with input_references - one endpoint for every image model.
Generate an image from a text prompt, or guide the result with
input_references for an edit or remix. The same call handles every image
model - there is no separate endpoint to switch to for reference-guided
requests.
POST /v1/imagesAuthentication
AuthorizationBearerrequiredAPI key as bearer token in the Authorization header. Create keys at
Manage API Keys.
Headers
Content-TypestringrequiredMust be application/json.
Body
modelstringrequiredImage model id from GET /v1/models. Example: gpt-image-2,
gpt-image-1-mini, gemini-3-pro-image.
promptstringrequiredText description of the image to generate, or the instruction to apply
to input_references.
input_referencesImageReference[]optionalSource images to guide the result. Each entry is
{ "type": "image_url", "image_url": { "url": "..." } }, where url is
an https:// URL, a data: URL, or a file_id from POST /v1/files.
Rejected for models that don't accept image input.
nintegeroptionalDefault 1Number of images to generate. Some models only support 1.
aspect_ratiostringoptionalOutput shape. Every image model takes a ratio, and each declares the
ones it supports in architecture.image_aspect_ratios. auto leaves
the choice to the model.
auto1:13:22:34:33:416:99:1621:9qualitystringoptionalHow much rendering effort the model spends. Declared per model in
architecture.image_qualities.
autolowmediumhighresolutionstringoptionalOutput detail expressed as a resolution step, for models that work this
way. Declared per model in architecture.image_resolutions. A model
offers quality or resolution, never both.
auto5121K2K4Koutput_formatstringoptionalOutput image format, where the model supports choosing one.
pngjpegwebpoutput_compressionintegeroptionalCompression level (0-100) for jpeg or webp output.
userstringoptionalEnd-user identifier for abuse tracking.
Responses are always base64
Images come back as data[].b64_json, on every model. One output shape
means the code that reads a result never has to branch on which model
produced it.
The model catalogue decides, not the gateway
GET /v1/models reports each model's architecture.image_aspect_ratios,
image_qualities and image_resolutions. A value outside those lists
returns 400, and so does a knob the model doesn't offer - nothing is
silently dropped or substituted, so a request that succeeds is a request
the model actually honoured.
Response
idstringoptionalGateway-assigned response identifier (avn_...). Used across logs,
billing, and feedback.
createdintegeroptionalUnix timestamp (seconds) when the images were generated.
modelstringoptionalThe model that generated the images.
dataImage[]optionalArray of generated images. Each contains b64_json, plus
revised_prompt if the model rewrote your prompt.
sizestringoptionalPixel dimensions of the result, when the model reports them.
usageobjectoptionalToken usage (input_tokens, output_tokens, total_tokens, plus
input_tokens_details/output_tokens_details image vs. text
breakdowns) for token-billed models. Models billed per image report
all-zero usage plus an image_count.
Errors
All errors follow the OpenAI structured shape:
{ "error": { "type": "invalid_request_error", "message": "..." } }| Status | error.type | Meaning |
|---|---|---|
400 | invalid_request_error | Schema violation, unsupported parameter value, or content policy rejection. |
401 | authentication_error | Missing or invalid API key. |
402 | billing_error | Account out of credit or hit a spend limit. |
429 | rate_limit_error | RPM exceeded. Respect Retry-After. |
500 | internal_server_error | Unexpected gateway failure. |