Wan 图像
- 文生图、图像编辑、多图参考
- 支持组图模式,一次最多 12 张
- 可指定调色板与 bbox 局部编辑
认证
All endpoints authenticate with a Bearer token.
Get an API key: open the console and create one.
Add it to the request header:
Authorization: Bearer YOUR_OAIRoute_KEY请求结构
请求体是平铺的 JSON,创作字段与输出字段都在顶层,没有 content 数组包装。
The body is flat JSON: creative fields and output fields sit at the top level, with no content array wrapper.
支持的场景
| 场景 | 字段组合 |
|---|---|
| 文生图 | prompt |
| 图像编辑 | prompt + image |
| 多图参考 | prompt + image(多张) |
| 局部编辑 | prompt + image + bbox_list |
| 组图 | enable_sequential: true + n |
| 指定配色 | prompt + color_palette |
带 image 时输出比例静默跟随最后一张输入图,且上限压到 2K,无法出 4K。
| Scenario | Field combination |
|---|---|
| Text to image | prompt |
| Image editing | prompt + image |
| Multi-image reference | prompt + image (several images) |
| Regional edit | prompt + image + bbox_list |
| Sequential set | enable_sequential: true + n |
| Specified palette | prompt + color_palette |
With image, the output ratio silently follows the last input image, and the ceiling drops to 2K — you can't get 4K.
请求参数
提交成功只返回任务 ID,不含图片本身。拿结果用 task_id 轮询获取任务状态,图片地址在 result.images[0].url,该地址会过期,请及时转存。
取值 wan2.7-image-pro 或 wan2.7-image。
-pro 在文生图下最高支持 4K,编辑与组图上限 2K;标准版全部最高 2K。
画面描述,上限 5000 字符。文生图必填,编辑模式建议填写。
参考图,最多 9 张。公网地址或 Base64。
格式 JPEG、PNG、WEBP、BMP,单边 240 到 8000 像素,比例 1:8 到 8:1,单张不超过 20MB。传入即进入编辑模式。
生成张数,默认 1。普通模式 1 到 4;开启 enable_sequential 后 1 到 12。
三种写法:档位 1K、2K、4K;比例 1:1、16:9、9:16、4:3、3:4、3:2、2:3(按 2K 解析);或精确像素 1024x1024。
档位 1K、2K、4K,可与 size 里的比例组合。
-pro 文生图范围 768×768 到 4096×4096;编辑、组图与标准版上限 2048×2048。
反向描述,写不希望出现的内容。
是否在右下角加 AI 生成标识,默认 false。
随机种子,取值 0 到 2147483647。相同种子与参数风格趋近一致。
额外推理以改善构图,默认 true。
只在非组图且无输入图时生效。
组图模式,输出多张连贯画面,适合漫画与分镜,默认 false。
开启后会关闭 thinking_mode 与 color_palette,并将上限压到 2K。
局部编辑的框选区域,嵌套形式 [[[x1,y1,x2,y2],...],...]。
外层长度必须与 image 一致,无需框选的图传 [],每张最多 2 个框,使用原图像素坐标,原点在左上角。
调色板,3 到 10 项,每项含十六进制色值与占比。
占比合计必须正好为 100.00%。仅非组图模式可用。
A successful submission returns only the task ID, not the image itself. Poll Get task status with the task_id; the image URL is at result.images[0].url and expires, so copy it promptly.
wan2.7-image-pro or wan2.7-image.
-pro supports up to 4K for text to image, with editing and sequential sets capped at 2K; the standard model is capped at 2K in every mode.
The scene description, up to 5000 characters. Required for text to image; recommended in edit mode.
Reference images, up to 9. Public URLs or Base64.
Formats JPEG, PNG, WEBP, BMP; each side 240 to 8000 pixels; ratio 1:8 to 8:1; up to 20MB each. Passing these enters edit mode.
Number of images, default 1. Normal mode accepts 1 to 4; with enable_sequential on, 1 to 12.
Three forms: a tier 1K, 2K, 4K; a ratio 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 (interpreted at 2K); or exact pixels 1024x1024.
The tier 1K, 2K, 4K, combinable with a ratio in size.
For -pro text to image the range is 768×768 to 4096×4096; editing, sequential sets, and the standard model are capped at 2048×2048.
A negative description of what you don't want to appear.
Whether to add an AI-generated mark in the bottom right; defaults to false.
Random seed, 0 to 2147483647. The same seed and parameters produce similar styles.
Extra reasoning to improve composition; defaults to true.
Takes effect only outside sequential mode and with no input images.
Sequential mode, producing several coherent images — good for comics and storyboards. Defaults to false.
Enabling it turns off thinking_mode and color_palette and lowers the ceiling to 2K.
Boxes for regional editing, nested as [[[x1,y1,x2,y2],...],...].
The outer length must match image; pass [] for images needing no box, at most 2 boxes each, using source-image pixel coordinates with the origin at the top left.
A color palette of 3 to 10 entries, each with a hex color and a percentage.
The percentages must sum to exactly 100.00%. Available only outside sequential mode.
计费
按成功生成的张数乘以单价计费,输入不计费。分辨率与比例不影响价格,失败任务不计费。
Billed as the number of successfully generated images times the unit price; input isn't charged. Resolution and ratio don't affect price, and failed tasks aren't billed.
响应
提交成功返回受理结构:
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
}
]
}状态码,200 表示任务已受理。
本次提交的任务列表。
受理状态,提交成功时为 submitted。
任务 ID,用它轮询结果。
完成态返回:
{
"code": 200,
"data": {
"id": "task_01K8SGYNNNVBQTXNR4MM964S7K",
"status": "completed",
"progress": 100,
"result": {
"images": [
{ "url": ["https://cdn.oairoute.com/f/image/task_01K8_0.png"], "expires_at": 1763174708 }
]
},
"created": 1763088289,
"completed": 1763088302
}
}A successful submission returns an accepted structure:
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
}
]
}The status code; 200 means the task was accepted.
The list of tasks submitted this time.
The acceptance status; submitted on success.
The task ID; use it to poll for the result.
The completed state returns:
{
"code": 200,
"data": {
"id": "task_01K8SGYNNNVBQTXNR4MM964S7K",
"status": "completed",
"progress": 100,
"result": {
"images": [
{ "url": ["https://cdn.oairoute.com/f/image/task_01K8_0.png"], "expires_at": 1763174708 }
]
},
"created": 1763088289,
"completed": 1763088302
}
}错误码
| HTTP | 含义 |
|---|---|
| 400 | 参数错误,type 为 invalid_request_error |
| 401 | Token 缺失或无效,type 为 authentication_error |
| 402 | 余额不足,type 为 payment_required |
| 429 | 触发限流 |
| HTTP | Meaning |
|---|---|
| 400 | Invalid parameters, with type invalid_request_error |
| 401 | Token missing or invalid, with type authentication_error |
| 402 | Insufficient balance, with type payment_required |
| 429 | Rate limit hit |
For more status codes and retry guidance see Error codes and rate limits; for troubleshooting steps on common errors see the FAQ.
支持的模型列表
| 模型 ID | 定位 |
|---|---|
wan2.7-image-pro | 画质优先,文生图最高 4K |
wan2.7-image | 标准版,速度更快,全部模式最高 2K |
GET https://api.oairoute.com/api/pricing。| Model ID | Positioning |
|---|---|
wan2.7-image-pro | Quality first; text to image up to 4K |
wan2.7-image | Standard: faster, capped at 2K in every mode |
GET https://api.oairoute.com/api/pricing.