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.
https://imagesv2.ai/api/v1Authorization: Bearer <your API key>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.
# 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.
| Method | Path | What it does |
|---|---|---|
POST | /api/v1/images/generations | Start a text-to-image or image-edit task |
GET | /api/v1/tasks/{id} | Read a task's status and result |
POST | /api/v1/uploads | Upload reference images for editing |
GET | /api/v1/models | List models, options and credit prices (no key needed) |
GET | /api/v1/me | Check a key and read your credit balance |
JSON body:
| Field | Type | Required | Notes |
|---|---|---|---|
prompt | string | yes | What to create or how to change the input images |
model | string | no | Defaults to gpt-image-2. See Models |
image_urls | string[] | no | Turns the request into an edit (image-to-image). Use URLs from /api/v1/uploads or images you generated here |
n | integer | no | 1–4 images (GPT Image models and Seedream 5.0 Lite; others return 1) |
quality | string | no | GPT Image models: low, medium, high, auto (2.5/2.6 also xhigh, max). Default auto |
size | string | no | GPT Image models: auto, 1024x1024, 1536x1024, 1024x1536, 2048x2048, 3072x2048, 2048x3072. Default auto |
output_format | string | no | png (default), jpeg, webp |
background | string | no | auto, transparent, opaque. Transparent needs png or webp |
aspect_ratio | string | no | Nano Banana, Seedream, MiniMax H3, MAI Image: e.g. 1:1, 16:9, 9:16, 4:5 |
resolution | string | no | Nano 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.
{
"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.
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.
GET /api/v1/models returns the live list with every option and price. Credits below are per image at default settings.
| Model ID | Name | Text-to-image | Edit |
|---|---|---|---|
gpt-image-2 | GPT Image 2 | 10 (low) / 40 (medium) / 110 (high) | 30 / 60 / 130 |
gpt-image-2.5-flare | GPT Image 2.5 Flare (fast) | 10 / 40 / 60 | +20 |
gpt-image-2.5-sunburst | GPT Image 2.5 Sunburst (precise edits) | 10 / 40 / 60 | +20 |
gpt-image-2.6-flare | GPT Image 2.6 Flare | 30 / 50 / 60 | +20 |
gpt-image-2.6-sunburst | GPT Image 2.6 Sunburst | 30 / 50 / 60 | +20 |
gemini-nano-banana-2.1 | Nano Banana 2.1 | 40 (1K) | 60 |
gemini-3.1-flash-image | Nano Banana 2 | 70 (1K) | 90 |
gemini-3-pro-image | Nano Banana Pro | 140 (1K) | 160 |
seedream/5.5 | Seedream 5.5 | 20 | 30 |
seedream/5.0-lite | Seedream 5.0 Lite | 30 | 30 |
minimax/h3-image/text-to-image | MiniMax H3 Image | 30 (2K) | 50 |
fal-ai/mai-image-2.7 | MAI Image 2.7 | 40 (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 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" } }| HTTP | code | Meaning |
|---|---|---|
| 400 | invalid_request | Missing prompt, unknown model, bad option value, image URL not on imagesv2.ai |
| 401 | invalid_api_key | Missing, malformed, deleted or unknown key |
| 402 | insufficient_credits | Balance too low. recharge_url links to top-up. Nothing was charged |
| 403 | account_suspended | The account behind this key cannot generate |
| 404 | not_found | Task does not exist or belongs to another account |
| 429 | rate_limited | Too many requests. Wait retry_after seconds |
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.
X-Imagesv2-Client: <your-app-name> helps us debug requests from your integration.Images you generate follow our Terms of Service and Privacy Policy.