gpt-image-2-official API
Generate, transform, and inpaint images with OpenAI's official GPT Image model on Openrouter API.
gpt-image-2-officialgpt-image-2-official API pricing
All prices in USD. Openrouter API rates compared with the official list price for the same unit.
| Token type | Openrouter API | Official | Save |
|---|---|---|---|
| Text input per 1M tokens | $4.40 | $5.00 | −12% |
| Cached text input per 1M tokens | $1.10 | $1.25 | −12% |
| Image input per 1M tokens | $7.04 | $8.00 | −12% |
| Cached image input per 1M tokens | $1.76 | $2.00 | −12% |
| Image output per 1M tokens | $26.40 | $30.00 | −12% |
Approximate cost per output
| Option | Openrouter API | Official |
|---|---|---|
| 1024x1024 · auto | ≈ $0.005368 | $0.0061 |
| 1024x1024 · high | ≈ $0.1856 | $0.2109 |
| 1024x1024 · low | ≈ $0.005368 | $0.0061 |
| 1024x1024 · medium | ≈ $0.04655 | $0.0529 |
| 1024x1280 · auto | ≈ $0.004752 | $0.0054 |
| 1024x1280 · high | ≈ $0.1617 | $0.1837 |
| 1024x1280 · low | ≈ $0.004752 | $0.0054 |
| 1024x1280 · medium | ≈ $0.04004 | $0.0455 |
| 1024x1536 · auto | ≈ $0.004312 | $0.0049 |
| 1024x1536 · high | ≈ $0.145 | $0.1648 |
| 1024x1536 · low | ≈ $0.004312 | $0.0049 |
| 1024x1536 · medium | ≈ $0.03634 | $0.0413 |
| 1024x2048 · auto | ≈ $0.003608 | $0.0041 |
| 1024x2048 · high | ≈ $0.1248 | $0.1418 |
| 1024x2048 · low | ≈ $0.003608 | $0.0041 |
| 1024x2048 · medium | ≈ $0.03133 | $0.0356 |
| 1024x3072 · auto | ≈ $0.002816 | $0.0032 |
| 1024x3072 · high | ≈ $0.1045 | $0.1187 |
| 1024x3072 · low | ≈ $0.002816 | $0.0032 |
| 1024x3072 · medium | ≈ $0.02622 | $0.0298 |
| 1024x768 · auto | ≈ $0.003696 | $0.0042 |
| 1024x768 · high | ≈ $0.1272 | $0.1446 |
| 1024x768 · low | ≈ $0.003696 | $0.0042 |
| 1024x768 · medium | ≈ $0.03194 | $0.0363 |
| 1152x2048 · auto | ≈ $0.004312 | $0.0049 |
| 1152x2048 · high | ≈ $0.1493 | $0.1697 |
| 1152x2048 · low | ≈ $0.004312 | $0.0049 |
| 1152x2048 · medium | ≈ $0.03749 | $0.0426 |
| 1152x2688 · auto | ≈ $0.00396 | $0.0045 |
| 1152x2688 · high | ≈ $0.1326 | $0.1507 |
| 1152x2688 · low | ≈ $0.00396 | $0.0045 |
| 1152x2688 · medium | ≈ $0.03406 | $0.0387 |
| 1280x1024 · auto | ≈ $0.004752 | $0.0054 |
| 1280x1024 · high | ≈ $0.1617 | $0.1837 |
| 1280x1024 · low | ≈ $0.004752 | $0.0054 |
| 1280x1024 · medium | ≈ $0.04004 | $0.0455 |
| 1280x3840 · auto | ≈ $0.003784 | $0.0043 |
| 1280x3840 · high | ≈ $0.1404 | $0.1595 |
| 1280x3840 · low | ≈ $0.003784 | $0.0043 |
| 1280x3840 · medium | ≈ $0.0352 | $0.04 |
| 1344x2688 · auto | ≈ $0.004928 | $0.0056 |
| 1344x2688 · high | ≈ $0.1709 | $0.1942 |
| 1344x2688 · low | ≈ $0.004928 | $0.0056 |
| 1344x2688 · medium | ≈ $0.04286 | $0.0487 |
| 1360x2048 · auto | ≈ $0.00572 | $0.0065 |
| 1360x2048 · high | ≈ $0.1942 | $0.2207 |
| 1360x2048 · low | ≈ $0.00572 | $0.0065 |
| 1360x2048 · medium | ≈ $0.04866 | $0.0553 |
| 1536x1024 · auto | ≈ $0.004312 | $0.0049 |
| 1536x1024 · high | ≈ $0.145 | $0.1648 |
| 1536x1024 · low | ≈ $0.004312 | $0.0049 |
| 1536x1024 · medium | ≈ $0.03634 | $0.0413 |
| 1536x2048 · auto | ≈ $0.006688 | $0.0076 |
| 1536x2048 · high | ≈ $0.2349 | $0.2669 |
| 1536x2048 · low | ≈ $0.006688 | $0.0076 |
| 1536x2048 · medium | ≈ $0.05887 | $0.0669 |
| 1536x512 · auto | ≈ $0.01426 | $0.0162 |
| 1536x512 · high | ≈ $0.05658 | $0.0643 |
| 1536x512 · low | ≈ $0.001584 | $0.0018 |
| 1536x512 · medium | ≈ $0.01426 | $0.0162 |
| 1536x864 · auto | ≈ $0.003344 | $0.0038 |
| 1536x864 · high | ≈ $0.114 | $0.1295 |
| 1536x864 · low | ≈ $0.003344 | $0.0038 |
| 1536x864 · medium | ≈ $0.0286 | $0.0325 |
| 1648x3840 · auto | ≈ $0.006336 | $0.0072 |
| 1648x3840 · high | ≈ $0.2166 | $0.2461 |
| 1648x3840 · low | ≈ $0.006336 | $0.0072 |
| 1648x3840 · medium | ≈ $0.05553 | $0.0631 |
| 1920x3840 · auto | ≈ $0.008096 | $0.0092 |
| 1920x3840 · high | ≈ $0.2852 | $0.3241 |
| 1920x3840 · low | ≈ $0.008096 | $0.0092 |
| 1920x3840 · medium | ≈ $0.07146 | $0.0812 |
| 2016x864 · auto | ≈ $0.002904 | $0.0033 |
| 2016x864 · high | ≈ $0.09733 | $0.1106 |
| 2016x864 · low | ≈ $0.002904 | $0.0033 |
| 2016x864 · medium | ≈ $0.02508 | $0.0285 |
| 2048x1024 · auto | ≈ $0.003608 | $0.0041 |
| 2048x1024 · high | ≈ $0.1248 | $0.1418 |
| 2048x1024 · low | ≈ $0.003608 | $0.0041 |
| 2048x1024 · medium | ≈ $0.03133 | $0.0356 |
| 2048x1152 · auto | ≈ $0.004312 | $0.0049 |
| 2048x1152 · high | ≈ $0.1493 | $0.1697 |
| 2048x1152 · low | ≈ $0.004312 | $0.0049 |
| 2048x1152 · medium | ≈ $0.03749 | $0.0426 |
| 2048x1360 · auto | ≈ $0.00572 | $0.0065 |
| 2048x1360 · high | ≈ $0.1942 | $0.2207 |
| 2048x1360 · low | ≈ $0.00572 | $0.0065 |
| 2048x1360 · medium | ≈ $0.04866 | $0.0553 |
| 2048x1536 · auto | ≈ $0.006688 | $0.0076 |
| 2048x1536 · high | ≈ $0.2349 | $0.2669 |
| 2048x1536 · low | ≈ $0.006688 | $0.0076 |
| 2048x1536 · medium | ≈ $0.05887 | $0.0669 |
| 2048x2048 · auto | ≈ $0.01065 | $0.0121 |
| 2048x2048 · high | ≈ $0.3769 | $0.4283 |
| 2048x2048 · low | ≈ $0.01065 | $0.0121 |
| 2048x2048 · medium | ≈ $0.09434 | $0.1072 |
| 2048x2560 · auto | ≈ $0.01012 | $0.0115 |
| 2048x2560 · high | ≈ $0.3535 | $0.4017 |
| 2048x2560 · low | ≈ $0.01012 | $0.0115 |
| 2048x2560 · medium | ≈ $0.08738 | $0.0993 |
| 2160x3840 · auto | ≈ $0.009944 | $0.0113 |
| 2160x3840 · high | ≈ $0.3524 | $0.4004 |
| 2160x3840 · low | ≈ $0.009944 | $0.0113 |
| 2160x3840 · medium | ≈ $0.08826 | $0.1003 |
| 2336x3520 · auto | ≈ $0.01197 | $0.0136 |
| 2336x3520 · high | ≈ $0.4147 | $0.4712 |
| 2336x3520 · low | ≈ $0.01197 | $0.0136 |
| 2336x3520 · medium | ≈ $0.1038 | $0.1179 |
| 2480x3312 · auto | ≈ $0.01311 | $0.0149 |
| 2480x3312 · high | ≈ $0.466 | $0.5296 |
| 2480x3312 · low | ≈ $0.01311 | $0.0149 |
| 2480x3312 · medium | ≈ $0.1166 | $0.1325 |
| 2560x2048 · auto | ≈ $0.01012 | $0.0115 |
| 2560x2048 · high | ≈ $0.3535 | $0.4017 |
| 2560x2048 · low | ≈ $0.01012 | $0.0115 |
| 2560x2048 · medium | ≈ $0.08738 | $0.0993 |
| 2576x3216 · auto | ≈ $0.01426 | $0.0162 |
| 2576x3216 · high | ≈ $0.5019 | $0.5703 |
| 2576x3216 · low | ≈ $0.01426 | $0.0162 |
| 2576x3216 · medium | ≈ $0.1239 | $0.1408 |
| 2688x1152 · auto | ≈ $0.00396 | $0.0045 |
| 2688x1152 · high | ≈ $0.1326 | $0.1507 |
| 2688x1152 · low | ≈ $0.00396 | $0.0045 |
| 2688x1152 · medium | ≈ $0.03406 | $0.0387 |
| 2688x1344 · auto | ≈ $0.004928 | $0.0056 |
| 2688x1344 · high | ≈ $0.1709 | $0.1942 |
| 2688x1344 · low | ≈ $0.004928 | $0.0056 |
| 2688x1344 · medium | ≈ $0.04286 | $0.0487 |
| 2880x2880 · auto | ≈ $0.01751 | $0.0199 |
| 2880x2880 · high | ≈ $0.6263 | $0.7117 |
| 2880x2880 · low | ≈ $0.01751 | $0.0199 |
| 2880x2880 · medium | ≈ $0.1566 | $0.178 |
| 3072x1024 · auto | ≈ $0.002816 | $0.0032 |
| 3072x1024 · high | ≈ $0.1045 | $0.1187 |
| 3072x1024 · low | ≈ $0.002816 | $0.0032 |
| 3072x1024 · medium | ≈ $0.02622 | $0.0298 |
| 3216x2576 · auto | ≈ $0.01426 | $0.0162 |
| 3216x2576 · high | ≈ $0.5019 | $0.5703 |
| 3216x2576 · low | ≈ $0.01426 | $0.0162 |
| 3216x2576 · medium | ≈ $0.1239 | $0.1408 |
| 3312x2480 · auto | ≈ $0.01311 | $0.0149 |
| 3312x2480 · high | ≈ $0.466 | $0.5296 |
| 3312x2480 · low | ≈ $0.01311 | $0.0149 |
| 3312x2480 · medium | ≈ $0.1166 | $0.1325 |
| 3520x2336 · auto | ≈ $0.01197 | $0.0136 |
| 3520x2336 · high | ≈ $0.4147 | $0.4712 |
| 3520x2336 · low | ≈ $0.01197 | $0.0136 |
| 3520x2336 · medium | ≈ $0.1038 | $0.1179 |
| 3840x1280 · auto | ≈ $0.003784 | $0.0043 |
| 3840x1280 · high | ≈ $0.1404 | $0.1595 |
| 3840x1280 · low | ≈ $0.003784 | $0.0043 |
| 3840x1280 · medium | ≈ $0.0352 | $0.04 |
| 3840x1648 · auto | ≈ $0.006336 | $0.0072 |
| 3840x1648 · high | ≈ $0.2166 | $0.2461 |
| 3840x1648 · low | ≈ $0.006336 | $0.0072 |
| 3840x1648 · medium | ≈ $0.05553 | $0.0631 |
| 3840x1920 · auto | ≈ $0.008096 | $0.0092 |
| 3840x1920 · high | ≈ $0.2852 | $0.3241 |
| 3840x1920 · low | ≈ $0.008096 | $0.0092 |
| 3840x1920 · medium | ≈ $0.07146 | $0.0812 |
| 3840x2160 · auto | ≈ $0.009944 | $0.0113 |
| 3840x2160 · high | ≈ $0.3524 | $0.4004 |
| 3840x2160 · low | ≈ $0.009944 | $0.0113 |
| 3840x2160 · medium | ≈ $0.08826 | $0.1003 |
| 512x1536 · auto | ≈ $0.001584 | $0.0018 |
| 512x1536 · high | ≈ $0.05658 | $0.0643 |
| 512x1536 · low | ≈ $0.001584 | $0.0018 |
| 512x1536 · medium | ≈ $0.01426 | $0.0162 |
| 768x1024 · auto | ≈ $0.003696 | $0.0042 |
| 768x1024 · high | ≈ $0.1272 | $0.1446 |
| 768x1024 · low | ≈ $0.003696 | $0.0042 |
| 768x1024 · medium | ≈ $0.03194 | $0.0363 |
| 864x1536 · auto | ≈ $0.003344 | $0.0038 |
| 864x1536 · high | ≈ $0.114 | $0.1295 |
| 864x1536 · low | ≈ $0.003344 | $0.0038 |
| 864x1536 · medium | ≈ $0.0286 | $0.0325 |
| 864x2016 · auto | ≈ $0.002904 | $0.0033 |
| 864x2016 · high | ≈ $0.09733 | $0.1106 |
| 864x2016 · low | ≈ $0.002904 | $0.0033 |
| 864x2016 · medium | ≈ $0.02508 | $0.0285 |
What is gpt-image-2-official?
gpt-image-2-official brings OpenAI's official GPT Image generation model to Openrouter API. Build text-to-image workflows, transform images using references, or edit selected regions with a mask through one generation endpoint. Prompts support English and Chinese, and detailed descriptions are recommended. Controls include 15 aspect ratios, 1K, 2K, and 4K resolution tiers, and auto, low, medium, or high quality. Generate up to four images per request and supply up to 16 reference images, with PNG, JPEG, or WebP output.
Call the model through Openrouter API with one API key and Bearer authentication. Processing is asynchronous: the generation request returns a task_id for subsequent queries. Openrouter API uses pay-as-you-go token billing and bills only successful requests. A 1024x1024 image at auto quality is estimated at about $0.005368 per image, not a fixed per-image charge. The default configuration is about 12% below the developer's list price, and prompt-cache reads are supported.
gpt-image-2-official highlights
Three Image Workflows
Generate from text, transform reference images, or use a mask for inpainting through the same endpoint.
Resolution And Aspect Controls
Choose 1K, 2K, or 4K resolution tiers and 15 supported aspect ratios. The size parameter also accepts pixel dimensions.
Multiple Images And References
Request up to four output images at once and provide up to 16 reference images for reference-based workflows.
Output Format Controls
Return PNG, JPEG, or WebP images. Adjust output_compression from 0–100 for JPEG and WebP output.
How to call the gpt-image-2-official API in 4 steps
- 01
Get an API key
Sign in to Openrouter API, top up from $50, and create an sk-ora key in the console.
- 02
Set the base URL
Use https://openrouterapi.ru/v1 as the base URL in your SDK or HTTP client.
- 03
Send the request
Call POST /v1/images/generations with "model": "gpt-image-2-official" and the parameters below.
- 04
Handle the response
The response contains a task_id. Poll GET /v1/tasks/{task_id} until the status is completed, then download the result URLs.
Request examples
Documentation: GPT-Image-2-Official Image Generationcurl --request POST \
--url https://openrouterapi.ru/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2-official",
"prompt": "An ancient castle beneath a starry sky",
"size": "16:9",
"resolution": "2k",
"quality": "high",
"n": 1
}'Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Required | gpt-image-2-official | Image generation model name |
nsfw_check | boolean | Optional | false | Whether to run content moderation before submitting the image task. |
prompt | string | Required | — | Text description for image generation |
size | string | Optional | 1:1 | Image aspect ratio |
resolution | string | Optional | 1k | Resolution tier (**new field**) |
quality | string | Optional | auto | Image quality |
moderation | string | Optional | auto | Moderation strength |
output_format | string | Optional | png | Output format |
output_compression | integer | Optional | — | Output compression level, range `0-100` |
n | integer | Optional | 1 | Number of images to generate |
image_urls | array | Optional | — | Reference image URL array |
mask_url | string | Optional | — | Mask image URL, used for inpainting |
What you can build with gpt-image-2-official
Campaign Asset Generation
Build a tool that generates square social assets, vertical posters, and wide banners from detailed campaign briefs.
Reference-Based Creative Variations
Let designers supply reference image URLs and prompts to create alternative image treatments within a single workflow.
Masked Image Editing
Build an editor that submits a reference image and an alpha-channel mask to regenerate selected regions through inpainting.
Creative Drafting Tools
Generate low-quality rough outlines for review, then request medium or high quality when the team needs more precise output.
Tips for better results
- 01
Separate Size And Resolution
Use size for the aspect ratio and resolution for the tier. Defaults are 1:1 and 1k; set the ratio explicitly when layout matters.
- 02
Start With Economical Drafts
Use quality low for fast, economical rough outlines; auto is typically equivalent to low. Treat per-image prices as estimates because billing is token-based.
- 03
Plan For Async Results
Store the returned task_id and query for results rather than expecting an image in the initial response. Allow extra time for 4K with high quality, which can take more than 120 seconds.
- 04
Validate References And Masks
Provide publicly accessible, stable reference URLs. For inpainting, use mask_url with image_urls and ensure the mask has an alpha channel and matches the first reference image's dimensions.
Limits and things to know
Each request supports up to four output images and 16 reference images.
Reference images are limited to 20 MB each and 256 MB total.
Processing is asynchronous, and 4K with high quality can take more than 120 seconds.
gpt-image-2-official API FAQ
How much does gpt-image-2-official cost on Openrouter API?
A 1024x1024 image at auto quality is estimated at about $0.005368 per image; at high quality, it is estimated at about $0.1856 per image. These are token-billed estimates, and the default configuration is about 12% below the developer's list price.
How do I call gpt-image-2-official?
Send a POST request to https://openrouterapi.ru/v1/images/generations with Bearer authentication, model set to gpt-image-2-official, and a required prompt. The response returns a task_id for subsequent result queries.
Which resolution and quality settings are supported?
The resolution parameter supports 1k, 2k, and 4k, while quality supports auto, low, medium, and high. Use size to select an aspect ratio or provide pixel dimensions; the defaults are 1:1, 1k, and auto quality.
Can I use reference images and masks?
Yes, image_urls accepts up to 16 publicly accessible, stable reference images, subject to a 20 MB per-image limit and 256 MB total cap. Inpainting requires mask_url together with image_urls; the mask must have an alpha channel and match the first reference image's dimensions.
Can I use generated images commercially?
Commercial use is subject to the model developer's terms. Review OpenAI's applicable terms and your rights to any supplied reference images before using outputs commercially.
How do I migrate from gpt-image-1.5-official?
The documentation reports 95% parameter alignment with gpt-image-1.5-official and says migration only requires changing the model name. Review the new resolution field and confirm your size, quality, and output settings before deploying.
Related models
gpt-image-1
gpt-image-1-official
gpt-image-1.5
gpt-image-1.5-official
gpt-image-2
gpt-image-2.5-ext
gpt-image-2.5-flare
gpt-image-2.5-sunburst
Start building with gpt-image-2-official
One key, pay as you go from $50, billed only for successful requests.
