Skip to main content
POST
cURL
OpenAI’s GPT Image models for generation and edits: GPT Image 2, GPT Image 2.5 Flare and Sunburst, and GPT Image 2.6 Flare and Sunburst, which also make animated GIFs. OpenAI’s safety filter applies.

Mentions

Write @handle in prompt to attach one of your saved entities, exactly as in the app. Each mention counts against the budget below; a mention that does not resolve, or that the chosen model does not support, is refused with 400 invalid_config before any gems are charged. See Characters and references.

Rules

A request that breaks one of these is refused with 400 invalid_config before any gems are charged.
  • Each model offers some quality levels only; a level the chosen model does not offer is refused.
  • Set output_format to gif on a GPT Image 2.6 model for an animated GIF, with frame_count from 2 to 16 (default 9) and frame_duration_ms from 20 to 2000 (default 200). Other models refuse it. resolution does not apply: each aspect_ratio has one frame size, near 640 pixels. The result is a .gif file, and its type stays image.
  • A GIF is priced by quality and by the frame range it falls in (2 to 8, 9, 10 to 12, or 13 to 16), not per frame. The price table below shows stills: read a GIF’s price from the cost estimate.
  • A GIF on Mage, such as an earlier result, passed as an image input runs on its first frame. A GIF from anywhere else is refused: image inputs are JPEG or PNG.
Every field below that you leave out keeps its default. Option values are the tokens listed per field; a numeric token may be sent as a number. Fields the schema does not list pass through to the model unchanged. The exact charge for other settings is in the response’s billing.gems_charged, and the balance at GET /v1/account.

Authorizations

Authorization
string
header
required

Create a key in API → API Keys: select Create API key, name it in the popup, then select Create key. Copy the one-time key and send it as Authorization: Bearer mage_sk_…. Keys are for server-side code only.

Headers

Idempotency-Key
string

A key of your choosing, 1 to 255 characters, scoped to your API key. A retried submit with the same key returns the original request with 200 instead of charging again. The key identifies the first submission made with it; later bodies are not compared. A refusal recorded under the key (its envelope carries request_id) replays the same way, so a new attempt needs a new key.

Required string length: 1 - 255

Body

application/json

A partial config for GPT Image 2.

prompt
string
required

The text prompt.

Required string length: 1 - 20000
seed
integer | null

Integer seed for reproducible output; omit or send null for a random seed.

model_id
enum<string>
default:gpt-image-2

The model variant to generate with.

Available options:
gpt-image-2,
gpt-image-2.5-flare,
gpt-image-2.5-sunburst,
gpt-image-2.6-flare,
gpt-image-2.6-sunburst
aspect_ratio
enum<string>
default:4:5

Aspect ratio as W:H.

Available options:
21:9,
16:9,
3:2,
5:4,
1:1,
4:5,
2:3,
9:16,
9:21
resolution
enum<string>
default:1K

Output resolution token.

Available options:
1K,
2K
output_format
enum<string>
default:jpeg

The file to make: jpeg for a still, or gif for an animation on a GPT Image 2.6 model.

Available options:
jpeg,
gif
image

The reference image. An https URL or a data URL.

additional_images
(string<uri> | string)[]

Additional reference images. Each an https URL or a data URL.

quality
string
default:low
frame_count
number
default:9
frame_duration_ms
number
default:200

Response

The request was accepted; poll status_url for the result. A retried submit whose Idempotency-Key was used before answers 200 with the same shape, the original request, and charges nothing.

request_id
string<uuid>
required

The request id, also the id in status_url and cancel_url.

status
enum<string>
required

queued and in_progress are live; completed, failed, and cancelled are final.

Available options:
queued,
in_progress,
completed,
failed,
cancelled
architecture
string
required

The architecture the request generates with.

model_id
string | null
required

The model variant, when the architecture has variants.

created_at
string<date-time>
required

When the request was accepted.

updated_at
string<date-time>
required

When the request last changed.

billing
object
required
result
object | null
required

The output once status is completed, else null.

error
object | null
required

Why the request failed once status is failed, else null.

status_url
string<uri>
required

Poll this URL for the request.

cancel_url
string<uri>
required

POST to this URL to stop the request.

Last modified on November 6, 2026