Discord

← API reference

Images

POST/v1/images

Parameters

ParameterTypeDescription
promptstringRequired.
modelstringOptional, default "gpt-image-1" (also the "auto" resolution). No auto-router for images yet — see Which models below.
input_referencesarrayOptional. Image-to-image mode — [{"type":"image_url","image_url":{"url":...}}], URL or base64 data: URI. Only supported on chat-image and edit-capable models.
nintegerOptional, default 1. Number of images to generate.
aspect_ratio / resolutionstringOptional. Combine to request a size; ignored (default size used) if the model doesn't support the combination.
sizestringOptional. Explicit "WxH" — overrides aspect_ratio/resolution when given.
qualitystringOptional. OpenAI models only — ignored elsewhere.
output_format / background / output_compression—Optional. OpenAI models only — ignored elsewhere.
moderationstringOptional, "low" or "auto". OpenAI models only, and only in generation mode — the edit endpoint doesn't accept it; ignored elsewhere.
input_fidelitystringOptional, "low" or "high". OpenAI models only, and only in image-to-image edit mode (requires input_references) — how much fine detail from the input image to preserve; ignored elsewhere.
userstringOptional, your own stable end-user id, capped at 64 characters. Forwarded to OpenAI models for their own abuse monitoring; also recorded on every model as this platform's own advisory per-end-user attribution, visible via GET /api/usage/by-end-user.
streambooleanNot supported — true is rejected with a 400, not silently ignored.

Example response

{
  "created": 1731430000,
  "data": [{ "b64_json": "...", "url": null, "revised_prompt": "...", "media_type": "image/png" }],
  "usage": { "prompt_tokens": 13, "completion_tokens": 1568, "total_tokens": 1581, "cost": 0.063 }
}

Some models (e.g. gpt-image-1) also echo background/output_format/quality/size at the top level, mirroring the provider's own response. A few Fal-hosted models return a real url instead of b64_json.

GET/v1/images/models

Unbilled. Live list of every valid model slug for POST /v1/images — bare ids only, no price or capability breakdown (see /models for that).

Example response

{
  "object": "list",
  "data": [
    { "id": "gpt-image-1", "object": "model" },
    { "id": "imagen-4.0-generate-001", "object": "model" },
    { "id": "flux-1.1-pro", "object": "model" }
  ]
}