docs: 图像生成API全部改为同步模式,修正响应格式与实际API一致

- 删除所有异步模型描述(qwen-image-plus系列改为同步)
- 修正成功响应:usage字段按实际返回(万象含tokens,千问含宽高)
- 修正失败响应:两种实际格式(参数缺失/模型不存在)
- 修正image URL:dashscope OSS → token.opencomputing.cn/idfile
- 修正size格式:1024x1024 → 1024*1024
- 各模型明细节删除重复的成功/失败响应示例
- /v1/tasks标注仅用于视频生成等异步任务
This commit is contained in:
yumoqing 2026-06-03 23:59:26 +08:00
parent e1bde5d801
commit 23816650ab

View File

@ -561,7 +561,7 @@ curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
| 参数 | 类型 | 说明 | | 参数 | 类型 | 说明 |
|------|------|------| |------|------|------|
| `image_url` | string | 图生图时提供参考图 URL | | `image_url` | string | 图生图时提供参考图 URL |
| `size` | string | 尺寸,如 `"1024x1024"` | | `size` | string | 尺寸,如 `"1024*1024"` |
| `n` | integer | 生成数量 | | `n` | integer | 生成数量 |
| `style` | string | 风格参数 | | `style` | string | 风格参数 |
| `quality` | string | 质量参数 | | `quality` | string | 质量参数 |
@ -574,43 +574,56 @@ curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
"model": "qwen-image-2.0-pro", "model": "qwen-image-2.0-pro",
"catelogid": "t2i", "catelogid": "t2i",
"prompt": "A beautiful sunset over the ocean", "prompt": "A beautiful sunset over the ocean",
"size": "1024x1024", "size": "1024*1024",
"n": 1 "n": 1
} }
``` ```
### 响应格式 ### 响应格式
同步模型直接返回图像数据,异步模型返回任务信息 直接返回图像数据。
**成功响应(以 wan2.7-image-pro 为例)** **成功响应:**
```json ```json
{ {
"status": "SUCCEEDED", "status": "SUCCEEDED",
"usage": {"image_count": 1}, "usage": {
"image_count": 1,
"input_tokens": 22,
"output_tokens": 2,
"size": "1024*1024",
"total_tokens": 24
},
"image_count": 1, "image_count": 1,
"image": ["https://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/1d/...png"] "image": ["https://token.opencomputing.cn/idfile?path=/tmp/...png"]
} }
``` ```
> `usage` 字段因模型不同可能返回不同内容:万象系列返回 `input_tokens`/`output_tokens`/`size`/`total_tokens`;千问系列返回 `height`/`width`/`image_count`
**失败响应:** **失败响应:**
参数缺失:
```json ```json
{ {
"status": "FAILED", "status": "error",
"error": "InvalidParameter.InvalidParameter" "data": {
"message": "Missing required parameter: prompt"
}
} }
``` ```
**异步模型提交响应:** 模型不存在或参数无效:
```json ```json
{ {
"status": "ok", "error": {
"data": { "message": "Parameters error.",
"taskid": "task_xxx", "type": "invalidparameters",
"status": "PENDING" "param": null,
"code": "invalidparameters"
} }
} }
``` ```
@ -657,7 +670,7 @@ curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \
"prompt_extend": true "prompt_extend": true
}' }'
# ---- 千问图像 qwen-image-plus步) ---- # ---- 千问图像 qwen-image-plus步) ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \ curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \
-H 'Authorization: Bearer *** \ -H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \
@ -680,8 +693,6 @@ curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \
##### T2I - 文生图 ##### T2I - 文生图
**同步模型**(直接返回图像数据):
| 参数名 | 类型 | 必填 | 默认值 | 说明 | 可选值 | | 参数名 | 类型 | 必填 | 默认值 | 说明 | 可选值 |
|--------|------|------|--------|------|--------| |--------|------|------|--------|------|--------|
| `model` | string | 是 | - | 模型名称 | 见下方模型列表 | | `model` | string | 是 | - | 模型名称 | 见下方模型列表 |
@ -697,34 +708,12 @@ curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \
| `wan2.7-image-pro` | 万象专业版,创意性、稳定性、写实质感全面升级 | 0.5元/张 | | `wan2.7-image-pro` | 万象专业版,创意性、稳定性、写实质感全面升级 | 0.5元/张 |
| `wan2.7-image-plus` | 万象Plus版高分辨率图像生成性价比高 | 0.2元/张 | | `wan2.7-image-plus` | 万象Plus版高分辨率图像生成性价比高 | 0.2元/张 |
**成功响应示例:**
```json
{
"status": "SUCCEEDED",
"usage": {"image_count": 1},
"image_count": 1,
"image": ["https://..."]
}
```
**失败响应示例:**
```json
{
"status": "FAILED",
"error": "InvalidParameter.InvalidParameter"
}
```
--- ---
#### 千问图像Qwen-Image #### 千问图像Qwen-Image
##### qwen-image-2.0 系列 - 文生图 ##### qwen-image-2.0 系列 - 文生图
**同步模型**(直接返回图像数据):
| 参数名 | 类型 | 必填 | 默认值 | 说明 | 可选值 | | 参数名 | 类型 | 必填 | 默认值 | 说明 | 可选值 |
|--------|------|------|--------|------|--------| |--------|------|------|--------|------|--------|
| `model` | string | 是 | - | 模型名称 | `qwen-image-2.0-pro`, `qwen-image-2.0-2026-03-03` | | `model` | string | 是 | - | 模型名称 | `qwen-image-2.0-pro`, `qwen-image-2.0-2026-03-03` |
@ -743,32 +732,10 @@ curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \
| `qwen-image-2.0-pro` | 千问图像生成Pro系列文字渲染、真实质感、语义遵循能力更强 | 0.5元/张 | | `qwen-image-2.0-pro` | 千问图像生成Pro系列文字渲染、真实质感、语义遵循能力更强 | 0.5元/张 |
| `qwen-image-2.0-2026-03-03` | 千问图像生成2.0快照版2026-03-03兼顾效果与响应速度 | 0.5元/张 | | `qwen-image-2.0-2026-03-03` | 千问图像生成2.0快照版2026-03-03兼顾效果与响应速度 | 0.5元/张 |
**成功响应示例:**
```json
{
"status": "SUCCEEDED",
"usage": {"image_count": 1},
"image_count": 1,
"image": ["https://..."]
}
```
**失败响应示例:**
```json
{
"status": "FAILED",
"error": "InvalidParameter.InvalidParameter"
}
```
--- ---
##### qwen-image-plus 系列 - 文生图 ##### qwen-image-plus 系列 - 文生图
**异步模型**(需通过 `/v1/tasks?taskid=xxx` 查询状态):
| 参数名 | 类型 | 必填 | 默认值 | 说明 | 可选值 | | 参数名 | 类型 | 必填 | 默认值 | 说明 | 可选值 |
|--------|------|------|--------|------|--------| |--------|------|------|--------|------|--------|
| `model` | string | 是 | - | 模型名称 | `qwen-image-plus`, `qwen-image-plus-2026-01-09` | | `model` | string | 是 | - | 模型名称 | `qwen-image-plus`, `qwen-image-plus-2026-01-09` |
@ -784,37 +751,11 @@ curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \
| `qwen-image-plus` | 千问图像Plus系列擅长多样化艺术风格与文字渲染 | 0.2元/张 | | `qwen-image-plus` | 千问图像Plus系列擅长多样化艺术风格与文字渲染 | 0.2元/张 |
| `qwen-image-plus-2026-01-09` | 千问图像Plus快照版2026-01-09为qwen-image-max的蒸馏加速版 | 0.2元/张 | | `qwen-image-plus-2026-01-09` | 千问图像Plus快照版2026-01-09为qwen-image-max的蒸馏加速版 | 0.2元/张 |
**响应示例(异步提交):**
```json
{
"status": "ok",
"data": {
"taskid": "task_xxx",
"status": "PENDING"
}
}
```
**查询任务状态(`/v1/tasks?taskid=task_xxx`**
```json
{
"status": "ok",
"data": {
"status": "SUCCEEDED",
"usage": {"image_count": 1},
"image_count": 1,
"image": ["https://..."]
}
}
```
--- ---
## GET /v1/tasks ## GET /v1/tasks
查询异步任务状态。 查询异步任务状态(仅用于视频生成等异步任务)。
### 必填参数 ### 必填参数