altrouter.ai
Models/OpenAI/GPT Image 2
GP

OpenAI: GPT Image 2

Imagegpt-image-2

OpenAI image generation and editing with accurate text rendering.

API docs
Playgroundgpt-image-2
Reference image
Resolution
Latency3.1 s
24hnow
Specifications
Authoropenai
ModalityImage
Price$0.037 / image$0.053 / image
Savings30%
Quick start
from openai import OpenAI

client = OpenAI(
    base_url="https://api.altrouter.ai/v1",
    api_key="ar-...",
)

img = client.images.generate(
    model="gpt-image-2",
    prompt="a red fox in the snow",
)
print(img.data[0].url)

Same OpenAI-compatible endpoint — just swap base_url and key.

API

OpenAI-compatible image generation endpoint. The result is re-hosted on our CDN and returned as a URL.

POST/v1/images/generations
Body parameters
modelstringrequired"gpt-image-2"
The model id.
promptstringrequired
The text description of the image.
imagestringURL or base64
Reference images for editing.
resolutionenum2K · 4Kdefault 2K
Resolution tier (affects price).
Response
createdinteger
Unix creation time (seconds).
dataarray
Images. Each: url (our CDN), b64_json, revised_prompt.
Example
cURLPythonJSON
curl https://api.altrouter.ai/v1/images/generations \
  -H "Authorization: Bearer ar-..." \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-image-2",
  "prompt": "a red fox in the snow",
  "resolution": "2K"
}'
Errors
400Invalid request.
401Missing or invalid API key.
402Insufficient credits, or the key’s spending cap is exhausted.
404Model not found.
429Rate limit exceeded.
More from OpenAI
GPT-5.4
gpt-5.4
GPT-5.5
gpt-5.5
GPT-5.2
gpt-5.2
GPT-5.6
gpt-5.6
GPT-5.6 Pro
gpt-5.6-pro
GPT-5.6 Mini
gpt-5.6-mini