GPT Image 2 API Docs – AI Image Generator API

REST API for GPT Image 2, GPT Image 2.5/2.6, Nano Banana, Seedream and more. Text-to-image and image editing with one API key, billed in the same credits as the website.
Nov 28, 2026

The imagesv2.ai API lets your app, script or workflow (Dify, n8n, Zapier, your backend) generate and edit images with the same models and the same credit prices as the web generator. One API key, one balance.

  • Base URL: https://imagesv2.ai/api/v1
  • Auth: Authorization: Bearer <your API key>
  • Get a key: Settings → API Keys (sign in, click Create, copy the key)
  • Top up credits: Pricing
  • Using Dify? Install the imagesv2 plugin from the Dify Marketplace and paste your key — no code needed.

Generation is asynchronous: you create a task, then poll it until it is success or failed. Most images finish in 10–60 seconds; high quality GPT Image 2 can take up to about 2 minutes.

Quick start

# 1. Create a task
curl https://imagesv2.ai/api/v1/images/generations \
  -H "Authorization: Bearer $IMAGESV2_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "Studio product photo of a matte black water bottle on a beige stone plinth, soft shadow, 4k",
    "quality": "medium",
    "size": "1024x1024"
  }'
# → 202 {"id":"7f3c...","status":"pending","model":"gpt-image-2","credits_cost":40,"poll_url":"https://imagesv2.ai/api/v1/tasks/7f3c..."}

# 2. Poll until status is success
curl https://imagesv2.ai/api/v1/tasks/7f3c... \
  -H "Authorization: Bearer $IMAGESV2_API_KEY"
# → {"id":"7f3c...","status":"success","images":[{"url":"https://r2.imagesv2.ai/..."}],"credits_cost":40,...}

Poll every 3–5 seconds. Image URLs are permanent links on our CDN.

Endpoints

MethodPathWhat it does
POST/api/v1/images/generationsStart a text-to-image or image-edit task
GET/api/v1/tasks/{id}Read a task's status and result
POST/api/v1/uploadsUpload reference images for editing
GET/api/v1/modelsList models, options and credit prices (no key needed)
GET/api/v1/meCheck a key and read your credit balance

POST /api/v1/images/generations

JSON body:

FieldTypeRequiredNotes
promptstringyesWhat to create or how to change the input images
modelstringnoDefaults to gpt-image-2. See Models
image_urlsstring[]noTurns the request into an edit (image-to-image). Use URLs from /api/v1/uploads or images you generated here
nintegerno1–4 images (GPT Image models and Seedream 5.0 Lite; others return 1)
qualitystringnoGPT Image models: low, medium, high, auto (2.5/2.6 also xhigh, max). Default auto
sizestringnoGPT Image models: auto, 1024x1024, 1536x1024, 1024x1536, 2048x2048, 3072x2048, 2048x3072. Default auto
output_formatstringnopng (default), jpeg, webp
backgroundstringnoauto, transparent, opaque. Transparent needs png or webp
aspect_ratiostringnoNano Banana, Seedream, MiniMax H3, MAI Image: e.g. 1:1, 16:9, 9:16, 4:5
resolutionstringnoNano Banana 2 / 2.1 / Pro: 1K, 2K, 4K. Seedream: basic, high. MiniMax H3: 2K, 4K. MAI: 1K, 2K

Response 202 Accepted:

{
  "id": "7f3c2a8e-...",
  "status": "pending",
  "model": "gpt-image-2",
  "credits_cost": 40,
  "poll_url": "https://imagesv2.ai/api/v1/tasks/7f3c2a8e-..."
}

Credits are charged when the task is created. If generation fails, the credits are refunded automatically.

GET /api/v1/tasks/{id}

{
  "id": "7f3c2a8e-...",
  "status": "success",
  "model": "gpt-image-2",
  "prompt": "Studio product photo of ...",
  "credits_cost": 40,
  "watermarked": false,
  "images": [{ "url": "https://r2.imagesv2.ai/raw/....png" }],
  "error": null,
  "created_at": "2026-11-28T08:00:00.000Z",
  "completed_at": "2026-11-28T08:00:31.000Z"
}

status is one of pending, processing, success, failed, canceled. When failed, error says why and the credits are back in your balance.

Accounts that have never purchased credits receive watermarked images ("watermarked": true), the same rule as the website. Any purchase removes the watermark.

POST /api/v1/uploads

Multipart form with one or more files fields (JPEG, PNG, WebP, GIF, AVIF or HEIC, up to 40 MB each, 10 per request). Returns URLs to pass as image_urls.

curl https://imagesv2.ai/api/v1/uploads \
  -H "Authorization: Bearer $IMAGESV2_API_KEY" \
  -F "[email protected]"
# → {"urls":["https://r2.imagesv2.ai/9b1e....jpg"]}

curl https://imagesv2.ai/api/v1/images/generations \
  -H "Authorization: Bearer $IMAGESV2_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "Put this bottle on a sunlit marble kitchen counter, lifestyle ad photo",
    "image_urls": ["https://r2.imagesv2.ai/9b1e....jpg"],
    "quality": "medium"
  }'

For safety the API only fetches images hosted on imagesv2.ai. Upload external images first.

Models

GET /api/v1/models returns the live list with every option and price. Credits below are per image at default settings.

Model IDNameText-to-imageEdit
gpt-image-2GPT Image 210 (low) / 40 (medium) / 110 (high)30 / 60 / 130
gpt-image-2.5-flareGPT Image 2.5 Flare (fast)10 / 40 / 60+20
gpt-image-2.5-sunburstGPT Image 2.5 Sunburst (precise edits)10 / 40 / 60+20
gpt-image-2.6-flareGPT Image 2.6 Flare30 / 50 / 60+20
gpt-image-2.6-sunburstGPT Image 2.6 Sunburst30 / 50 / 60+20
gemini-nano-banana-2.1Nano Banana 2.140 (1K)60
gemini-3.1-flash-imageNano Banana 270 (1K)90
gemini-3-pro-imageNano Banana Pro140 (1K)160
seedream/5.5Seedream 5.52030
seedream/5.0-liteSeedream 5.0 Lite3030
minimax/h3-image/text-to-imageMiniMax H3 Image30 (2K)50
fal-ai/mai-image-2.7MAI Image 2.740 (1K)80

Higher resolutions, larger custom sizes and extra reference images cost more; the exact charge is always returned as credits_cost before any work starts. Credit packages are on the pricing page.

Errors

Errors use HTTP status codes and a JSON body:

{ "error": { "code": "insufficient_credits", "message": "Not enough credits for this request.", "credits_remaining": 5, "recharge_url": "https://imagesv2.ai/pricing?utm_source=api" } }
HTTPcodeMeaning
400invalid_requestMissing prompt, unknown model, bad option value, image URL not on imagesv2.ai
401invalid_api_keyMissing, malformed, deleted or unknown key
402insufficient_creditsBalance too low. recharge_url links to top-up. Nothing was charged
403account_suspendedThe account behind this key cannot generate
404not_foundTask does not exist or belongs to another account
429rate_limitedToo many requests. Wait retry_after seconds

Rate limits

Per API key: 20 generation requests, 30 upload requests and 120 read requests (task polling, /me) per minute. Need more? Contact us from the feedback page.

Keys and security

  • Keep keys on the server side. Anyone with your key can spend your credits.
  • Delete a leaked key in Settings → API Keys; it stops working immediately.
  • Optional header X-Imagesv2-Client: <your-app-name> helps us debug requests from your integration.

Images you generate follow our Terms of Service and Privacy Policy.