Docs
All model guides

GPT Image 2

OpenAI

gpt-image-2

Good for product shots and posters with readable text. Generate from a prompt, or edit with up to 16 reference images. Output up to 4K. One image per request.

Text-to-imageImage-to-imageImage editTypography
WorkbenchGenerate with GPT Image 2
Sign in to generate · 1 Credits

Credits are reserved before generation and released automatically if it fails.

Output

Completed images appear here after a successful Credit debit.

API

Call GPT Image 2

ImgRouter uses one request contract. Send this model ID to POST /v1/images/generations. Examples below match the recommended defaults on this page.

POST/v1/images/generations
cURL
curl https://api.imgrouter.com/v1/images/generations \
  -H "Authorization: Bearer $IMGROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: gpt-image-2-generate-001" \
  -d '{
  "model": "gpt-image-2",
  "prompt": "A cozy coffee shop interior with warm lighting, wooden tables, and plants by the window on a rainy afternoon.",
  "size": "1:1",
  "resolution": "1K",
  "n": 1
}'
Request body

Parameters and usage notes

These are the ImgRouter fields. Official upstream names such as image_urls are mapped from reference_images.

modelstring · requiredDefault and required: gpt-image-2.
promptstring · requiredText instruction, 1–5,000 characters. Describe the image or the edit you want.
sizestring · default 1:1Aspect ratio. Supported: auto, 1:1, 3:2, 2:3, 4:3, 3:4, 5:4, 4:5, 16:9, 9:16, 2:1, 1:2, 3:1, 1:3, 21:9, 9:21. Prefer an explicit ratio instead of auto when you need predictable framing.
resolutionstring · default 1KOutput tier. Supported: 1K, 2K, 4K. Higher tiers cost more Credits.
ninteger · 1–1Number of output images. Send a number, not a quoted string. Defaults to 1 and cannot exceed 1.
reference_imagesstring[] · max 16Public HTTPS image URLs for image-to-image or edit. Send this field to POST /v1/images/edits. Official docs may call this image_urls.
Controls

Size, resolution, and output

Aspect ratio or size

auto1:13:22:34:33:45:44:516:99:162:11:23:11:321:99:21

Resolution

1K2K4K

Output format

url

Route notes

Supports generation and editing with up to sixteen reference images.

Only one output image is created per request.

Use an explicit ratio and resolution for predictable dimensions and pricing.

Reference workflow

Edit with reference images

Send public HTTPS source images with the same core controls. This route accepts up to 16 reference images.

POST/v1/images/edits
cURL
curl https://api.imgrouter.com/v1/images/edits \
  -H "Authorization: Bearer $IMGROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: gpt-image-2-edit-001" \
  -d '{
  "model": "gpt-image-2",
  "prompt": "Preserve the subject and composition. Change the scene to soft blue hour.",
  "size": "1:1",
  "resolution": "1K",
  "n": 1,
  "reference_images": [
    "https://example.com/reference.jpg"
  ]
}'
Response

Read the completed output

Successful requests return completed image URLs and a request ID. Store the assets you need permanently; routed output URLs may expire.

200 · JSON
{
  "id": "req_01K4…",
  "object": "image.generation",
  "created": 1787424152,
  "data": [
    { "url": "https://static.imgrouter.com/images/req_01K4.webp" }
  ],
  "usage": { "images": 1 }
}

Use GET /v1/requests/{request_id} for reconciliation and GET /v1/balance for the authenticated key's current Credit position.