Qwen Image Edit API Docs
Use the image editing API from external systems. Supports session auth and Bearer API key auth.
Endpoint
POST /api/qwen-image-edit
Authentication
- Session auth (browser cookie)
- API key (request header): Authorization: Bearer sk-xxxxxxxx
Request Parameters
- instruction / prompt: Editing instruction (max 800 chars)
- model: Optional, defaults to chatgpt-image-2-free; chatgpt-image-2 is accepted as an alias
- imageUrl / imageUrls / imageBase64: At least one image input, max 4 images; per-model limits are listed below
- n: Number of output images; current image edit models return up to 1 image and extra values are clamped
- aspectRatio: Allowed values depend on the model. ChatGPT Image 2 Free supports auto, 1:1, 3:2, and 2:3
- Optional fields: watermark, negative_prompt, size, prompt_extend
Supported Models
| model | Name | Input images | Outputs | aspectRatio | Credits/image |
|---|---|---|---|---|---|
| chatgpt-image-2-free | ChatGPT Image 2 Free | 4 | 1 | auto, 1:1, 3:2, 2:3 | 6 |
| gpt-image-2 | GPT Image 2 | 1 | 1 | Provider default | 6 |
| nano-banana-2 | Nano Banana 2 | 4 | 1 | auto, 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 21:9 | 6 |
| gpt-image-1-5 | GPT Image 1.5 | 1 | 1 | 1:1, 3:2, 2:3 | 6 or 22 |
| seedream-5-0 | Seedream 5.0 | 4 | 1 | auto, 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 21:9 | 6 |
| qwen-image | Qwen Image | 3 | 1 | 1:1, 16:9, 9:16, 4:3, 3:4 | 6 |
When model is omitted, chatgpt-image-2-free is used. gpt-image-2 and chatgpt-image-2-free route to different upstream providers; chatgpt-image-2-free is recommended for most API users.
cURL: ChatGPT Image 2
curl -X POST "https://qwen-image-edit.com/api/qwen-image-edit" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-api-key" \
-d '{
"model": "chatgpt-image-2-free",
"imageUrls": ["https://your-cdn.com/input.jpg"],
"instruction": "Change the background to snowy mountains and keep the subject unchanged",
"aspectRatio": "1:1",
"n": 1
}'Python example
import requests
url = "https://qwen-image-edit.com/api/qwen-image-edit"
headers = {
"Authorization": "Bearer sk-your-api-key",
"Content-Type": "application/json",
}
payload = {
"model": "chatgpt-image-2-free",
"imageUrls": ["https://your-cdn.com/input.jpg"],
"instruction": "Change the background to snowy mountains and keep the subject unchanged",
"aspectRatio": "1:1",
"n": 1,
}
response = requests.post(url, json=payload, headers=headers, timeout=120)
response.raise_for_status()
print(response.json())Pricing & credits
API calls share the same credit balance as the web app. Full plans are on the pricing page; the table below summarizes public credit costs. View pricing
| Item | Credits | Notes |
|---|---|---|
| Image edit / text-to-image | 6 | Most models return 1 image per call |
| Video generation | 21 | Per generation |
| New user free credits | 15 | Granted after sign-up |
| Basic monthly | 600 / mo | $9.90 |
| Pro monthly | 1300 / mo | $19.90 |
| Max monthly | 2100 / mo | $29.90 |
Success Response
{
"data": [
{
"url": "data:image/png;base64,iVBORw0K...",
"index": 0
}
],
"cost": 6,
"warnings": [],
"generation": {
"uuid": "generation-uuid",
"stored_images": ["https://your-storage.com/result.png"]
},
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 2
},
"model": "chatgpt-image-2-free"
}Common Error Codes
- 400: Invalid parameters
- 401: Unauthenticated
- 402: Insufficient credits
- 500: Server error