用一句文字指令改图:传要编辑的主图(图 1),可再加最多 2 张参考图(图 2、图 3),拿回一张改好的图。输出与主图像素尺寸完全一致,不用选尺寸或画幅。通常 8–20 秒。只有主图 $0.05、加 1 张参考图 $0.06、加 2 张 $0.07,成功才计费。
Authorization: Bearer YOUR_API_KEY| 输入 | 价格 |
|---|---|
| 只有主图 | $0.05/张 |
| 主图 + 1 张参考图 | $0.06/张 |
| 主图 + 2 张参考图 | $0.07/张 |
model 填 qwen-image-edit-spicy。价格只看参考图张数,与主图尺寸、seed 无关。计费示例:只用主图改 100 张 = $5.00;每次都带 2 张参考图改 100 张 = $7.00。失败不扣费。
# ─── Edit one image with a text instruction ($0.05) ─────
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-edit-spicy",
"prompt": "Replace the background with a rainy neon street at night, keep the person unchanged",
"image": "https://example.com/portrait.jpg"
}'
# Response (async — a task is created):
# { "code": 200, "data": { "taskId": "clxxx", "state": "pending" } }
# ─── Main image + 2 reference images ($0.07) ───────────────
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-edit-spicy",
"prompt": "Put the jacket from image 2 on the person in image 1, and use the street from image 3 as the background",
"image": "https://example.com/person.jpg",
"reference_images": ["https://example.com/jacket.jpg", "https://example.com/street.jpg"],
"seed": 42
}'
# ─── Poll for the result ──────────────────────────────────
curl "https://api.apimodels.app/v1/images/generations?task_id=TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
# { "code": 200, "data": { "state": "completed", "resultUrls": ["https://r2.apimodels.app/..."] } }| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| model | 是 | string | qwen-image-edit-spicy |
| prompt | 是 | string | 编辑指令。要编辑的图是图 1,参考图依次是图 2、图 3 |
| image | 是 | string | 要编辑的主图,URL 或 base64(也收 image_url / image_base64,或 image_urls 的第一张)。输出的构图和像素尺寸都跟它走 |
| reference_images | 否 | string[] | 最多 2 张参考图,URL 或 base64;每张 +$0.01。image_urls 里主图之后的几张也算参考图 |
| seed | 否 | number | 随机种子(0 到 2147483647),固定可复现;不传或 0 为随机 |
| callback_url | 否 | string | 任务完成后的回调 URL |
| size / aspect_ratio / resolution | 否 | string | 收下但忽略,不报错:输出尺寸固定等于主图尺寸 |
试一试:Playground