diff --git a/wwwroot/api_doc.md b/wwwroot/api_doc.md index b768f1d..eb5007e 100644 --- a/wwwroot/api_doc.md +++ b/wwwroot/api_doc.md @@ -561,7 +561,7 @@ curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \ | 参数 | 类型 | 说明 | |------|------|------| | `image_url` | string | 图生图时提供参考图 URL | -| `size` | string | 尺寸,如 `"1024x1024"` | +| `size` | string | 尺寸,如 `"1024*1024"` | | `n` | integer | 生成数量 | | `style` | string | 风格参数 | | `quality` | string | 质量参数 | @@ -574,43 +574,56 @@ curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \ "model": "qwen-image-2.0-pro", "catelogid": "t2i", "prompt": "A beautiful sunset over the ocean", - "size": "1024x1024", + "size": "1024*1024", "n": 1 } ``` ### 响应格式 -同步模型直接返回图像数据,异步模型返回任务信息。 +直接返回图像数据。 -**成功响应(以 wan2.7-image-pro 为例):** +**成功响应:** ```json { "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": ["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 { - "status": "FAILED", - "error": "InvalidParameter.InvalidParameter" + "status": "error", + "data": { + "message": "Missing required parameter: prompt" + } } ``` -**异步模型提交响应:** +模型不存在或参数无效: ```json { - "status": "ok", - "data": { - "taskid": "task_xxx", - "status": "PENDING" + "error": { + "message": "Parameters error.", + "type": "invalidparameters", + "param": null, + "code": "invalidparameters" } } ``` @@ -657,7 +670,7 @@ curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \ "prompt_extend": true }' -# ---- 千问图像 qwen-image-plus(异步) ---- +# ---- 千问图像 qwen-image-plus(同步) ---- curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \ -H 'Authorization: Bearer *** \ -H 'Content-Type: application/json' \ @@ -680,8 +693,6 @@ curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \ ##### T2I - 文生图 -**同步模型**(直接返回图像数据): - | 参数名 | 类型 | 必填 | 默认值 | 说明 | 可选值 | |--------|------|------|--------|------|--------| | `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-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-2.0 系列 - 文生图 -**同步模型**(直接返回图像数据): - | 参数名 | 类型 | 必填 | 默认值 | 说明 | 可选值 | |--------|------|------|--------|------|--------| | `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-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 系列 - 文生图 -**异步模型**(需通过 `/v1/tasks?taskid=xxx` 查询状态): - | 参数名 | 类型 | 必填 | 默认值 | 说明 | 可选值 | |--------|------|------|--------|------|--------| | `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-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 -查询异步任务状态。 +查询异步任务状态(仅用于视频生成等异步任务)。 ### 必填参数