接口地址
POST /api/qwen-image-edit
鉴权方式
- 登录态会话(浏览器 Cookie)
- API Key(请求头): Authorization: Bearer sk-xxxxxxxx
请求参数
- instruction / prompt: 编辑指令(最多 800 字符)
- model: 可选,默认 chatgpt-image-2-free;也可传 chatgpt-image-2 作为别名
- imageUrl / imageUrls / imageBase64: 至少提供一个图片输入,最多 4 张;不同模型的上限见下方模型表
- n: 输出图片数量;当前图片编辑模型最多输出 1 张,多余数量会按模型上限裁剪
- aspectRatio: 比例取值依模型而定。ChatGPT Image 2 Free 支持 auto、1:1、3:2、2:3
- 可选字段:watermark, negative_prompt, size, prompt_extend
支持的模型
| model | 名称 | 输入图 | 输出图 | aspectRatio | 积分/张 |
|---|---|---|---|---|---|
| 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 | 由上游模型决定 | 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 或 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 |
未传 model 时会使用 chatgpt-image-2-free。gpt-image-2 和 chatgpt-image-2-free 是不同上游通道,推荐优先使用 chatgpt-image-2-free。
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": "把背景改成雪山,主体保持不变",
"aspectRatio": "1:1",
"n": 1
}'Python 示例
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": "把背景改成雪山,主体保持不变",
"aspectRatio": "1:1",
"n": 1,
}
response = requests.post(url, json=payload, headers=headers, timeout=120)
response.raise_for_status()
print(response.json())价格与积分
API 与网页共用积分账户。完整套餐见定价页;下表为当前公开积分单价摘要。 查看定价
| 项目 | 积分 | 说明 |
|---|---|---|
| 图片编辑 / 文生图 | 6 | 多数模型每次输出 1 张 |
| 视频生成 | 21 | 按次计费 |
| 新用户赠送 | 15 | 注册后到账 |
| Basic 月付 | 600 / mo | $9.90 |
| Pro 月付 | 1300 / mo | $19.90 |
| Max 月付 | 2100 / mo | $29.90 |
成功响应示例
{
"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"
}常见错误码
- 400: 参数错误
- 401: 未认证
- 402: 积分不足
- 500: 服务异常