docs: add curl test examples for all API endpoints in api_doc.md

This commit is contained in:
yumoqing 2026-06-02 17:11:17 +08:00
parent 067b1003e3
commit 8b05c8628f

View File

@ -38,6 +38,28 @@ Base url: `https://token.opencomputing.cn/llmage/v1`
}
```
```bash
# 非流式
curl -X POST 'https://token.opencomputing.cn/llmage/v1/chat/completions' \
-H 'Authorization: Bearer ***' \
-H 'Content-Type: application/json' \
-d '{
"model": "qwen3-max",
"messages": [{"role": "user", "content": "你好,请介绍你自己"}],
"stream": false
}'
# 流式
curl -X POST 'https://token.opencomputing.cn/llmage/v1/chat/completions' \
-H 'Authorization: Bearer ***' \
-H 'Content-Type: application/json' \
-d '{
"model": "qwen3-max",
"messages": [{"role": "user", "content": "写一首关于春天的诗"}],
"stream": true
}'
```
### 响应格式
**非流式响应:**
@ -125,6 +147,149 @@ data: [DONE]
通过 `/v1/tasks?taskid=xxx` 查询任务状态。
### curl 测试用例
```bash
# ---- Vidu T2V 文生视频 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "viduq3-pro",
"catelogid": "t2v",
"prompt": "一只猫在草地上奔跑",
"duration": 5,
"ratio": "16:9",
"resolution": "720p"
}'
# ---- Vidu I2V 图生视频 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "viduq3-pro",
"catelogid": "i2v",
"prompt": "画面中的人物微笑挥手",
"image_file": "https://example.com/first_frame.jpg",
"duration": 5,
"ratio": "16:9"
}'
# ---- Vidu Ref2V 参考生视频(主体模式) ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "viduq3-pro",
"catelogid": "r2v",
"prompt": "一个女孩在海边跳舞",
"subjects": [
{"images": ["https://example.com/character.jpg"]}
],
"duration": 5,
"aspect_ratio": "16:9"
}'
# ---- Seedance T2V 文生视频 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "doubao-seedance-2-0-260128",
"catelogid": "t2v",
"prompt": "一杯咖啡冒着热气,阳光从窗外洒入",
"resolution": "720p",
"duration": 8,
"ratio": "16:9"
}'
# ---- Seedance TI2V 文图生视频 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "doubao-seedance-2-0-260128",
"catelogid": "i2v",
"prompt": "画面中的汽车缓缓启动驶向远方",
"image1_file": "https://example.com/car.jpg",
"resolution": "720p",
"duration": 8
}'
# ---- 通义万象 T2V 文生视频 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.6-t2v",
"catelogid": "t2v",
"prompt": "一条金鱼在清澈的水中游动",
"size": "1920*1080",
"duration": "5"
}'
# ---- 通义万象 I2V 图生视频 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.6-i2v",
"catelogid": "i2v",
"prompt": "画面中的花朵慢慢绽放",
"image_file": "https://example.com/flower.jpg",
"size": "1920*1080"
}'
# ---- 通义万象 Ref2V 角色参考生视频 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.6-r2v",
"catelogid": "r2v",
"prompt": "角色在公园中散步",
"video1_file": "https://example.com/character_video.mp4",
"size": "1920*1080",
"duration": "10"
}'
# ---- 可灵 T2V 文生视频 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "kling-v2-1-master",
"catelogid": "t2v",
"prompt": "夕阳下的海滩,海浪拍打礁石"
}'
# ---- 海螺 TI2V 图生视频 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "hailuo",
"catelogid": "i2v",
"prompt": "画面中的孩子开心地跑向镜头",
"image_file": "https://example.com/child.jpg",
"resolution": "768P",
"duration": 6
}'
# ---- 快乐马 T2V 文生视频 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/video/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "happyhorse-1.0-t2v",
"catelogid": "t2v",
"prompt": "一匹骏马在草原上奔驰",
"size": "1920*1080",
"duration": "5"
}'
```
### 各模型输入参数明细
> 以下为各平台/模型的具体输入参数。调用时通过 `model` + `catelogid` 自动路由到对应供应商。
@ -446,6 +611,61 @@ data: [DONE]
}
```
### curl 测试用例
```bash
# ---- 万象 wan2.7-image-pro同步 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.7-image-pro",
"catelogid": "t2i",
"prompt": "一只可爱的橘猫趴在窗台上晒太阳",
"size": "1024*1024",
"n": 1
}'
# ---- 万象 wan2.7-image-plus同步 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.7-image-plus",
"catelogid": "t2i",
"prompt": "一幅水墨山水画",
"size": "2048*2048",
"n": 1
}'
# ---- 千问图像 qwen-image-2.0-pro同步图生图 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "qwen-image-2.0-pro",
"catelogid": "t2i",
"prompt": "将这张图片转换为油画风格",
"image_file": "https://example.com/photo.jpg",
"size": "2048*2048",
"n": 1,
"watermark": false,
"prompt_extend": true
}'
# ---- 千问图像 qwen-image-plus异步 ----
curl -X POST 'https://token.opencomputing.cn/llmage/v1/image/generations' \
-H 'Authorization: Bearer *** \
-H 'Content-Type: application/json' \
-d '{
"model": "qwen-image-plus",
"catelogid": "t2i",
"prompt": "赛博朋克风格的城市夜景",
"size": "1024*1024",
"n": 1
}'
```
### 各模型输入参数明细
> 以下为各平台/模型的具体输入参数。调用时通过 `model` + `catelogid` 自动路由到对应供应商。
@ -618,6 +838,11 @@ GET /llmage/v1/tasks?taskid=task_xxx
任务状态值: `UNKNOWN` / `SUCCEEDED` / `FAILED`
```bash
curl 'https://token.opencomputing.cn/llmage/v1/tasks?taskid=task_xxx' \
-H 'Authorization: Bearer ***
```
---
## GET /v1/models
@ -653,6 +878,16 @@ GET /llmage/v1/models
}
```
```bash
# 获取全部模型
curl 'https://token.opencomputing.cn/llmage/v1/models' \
-H 'Authorization: Bearer ***
# 按目录过滤(如只获取文生视频模型)
curl 'https://token.opencomputing.cn/llmage/v1/models?catelogid=t2v' \
-H 'Authorization: Bearer ***
```
---
## GET /v1/models/catelog
@ -706,6 +941,20 @@ GET /llmage/v1/models/catelog?catelogid=t2v&exclude_id=abc123
|--------|------|
| 400 | 缺少 catelogid 参数 |
```bash
# 获取文生文模型列表
curl 'https://token.opencomputing.cn/llmage/v1/models/catelog?catelogid=t2t' \
-H 'Authorization: Bearer ***
# 获取文生视频模型列表(排除某模型)
curl 'https://token.opencomputing.cn/llmage/v1/models/catelog?catelogid=t2v&exclude_id=abc123' \
-H 'Authorization: Bearer ***
# 获取文生图模型列表
curl 'https://token.opencomputing.cn/llmage/v1/models/catelog?catelogid=t2i' \
-H 'Authorization: Bearer ***
```
---
## 通用说明