视觉模型
视觉模型使用任务式异步接口,通过创建任务提交生成请求,再通过查询接口获取结果。
1. Image Generation(图片生成)
1.1 文生图
根据文本描述生成图片。
请求说明
基本信息
- 请求地址:
https://model.sophnet.com/api/open-apis/projects/easyllms/imagegenerator/task - 请求方式:POST
Header 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Content-Type | String | 是 | 固定值 application/json |
| Authorization | String | 是 | "Bearer " + API Key |
Body 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| model | string | 是 | 模型名称,如 Z-Image-Turbo、Qwen-Image |
| input.prompt | string | 是 | 图片描述文本 |
| parameters.size | string | 否 | 图片尺寸,如 "1024*1024"、"1328*1328" |
| parameters.n | integer | 否 | 生成图片数量,默认 1 |
创建任务示例
BASH
curl -X POST https://model.sophnet.com/api/open-apis/projects/easyllms/imagegenerator/task \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "Z-Image-Turbo",
"input": {
"prompt": "一幅美丽的山水画,水墨风格"
},
"parameters": {
"size": "1024*1024",
"n": 1
}
}'1.2 图生图
基于参考图片和文本描述生成新图片。
Body 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| model | string | 是 | 模型名称,如 Qwen-Image-Edit-2509 |
| input.prompt | string | 是 | 图片编辑描述 |
| input.images | array | 是 | 参考图片 URL 数组 |
| parameters.size | string | 否 | 图片尺寸 |
| parameters.n | integer | 否 | 生成图片数量,默认 1 |
创建任务示例
BASH
curl -X POST https://model.sophnet.com/api/open-apis/projects/easyllms/imagegenerator/task \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "Qwen-Image-Edit-2509",
"input": {
"prompt": "将图片风格改为油画风格",
"images": ["https://example.com/source.jpg"]
},
"parameters": {
"size": "1024*1024",
"n": 1
}
}'1.3 查询任务
基本信息
- 请求地址:
https://model.sophnet.com/api/open-apis/projects/easyllms/imagegenerator/task/{taskId} - 请求方式:GET
Header 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Authorization | String | 是 | "Bearer " + API Key |
请求示例
BASH
curl -X GET https://model.sophnet.com/api/open-apis/projects/easyllms/imagegenerator/task/{taskId} \
-H "Authorization: Bearer $API_KEY"2. Video Generation(视频生成)
2.1 文生视频
根据文本描述生成视频。
请求说明
基本信息
- 请求地址:
https://model.sophnet.com/api/open-apis/projects/easyllms/videogenerator/generate - 请求方式:POST
Header 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Content-Type | String | 是 | 固定值 application/json |
| Authorization | String | 是 | "Bearer " + API Key |
Body 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| model | string | 是 | 模型名称,如 Wan2.2-T2V-Plus、happyhorse-1.0-t2v |
| content | array | 是 | 内容数组,包含 text 类型元素 |
| content[].type | string | 是 | 固定值 "text" |
| content[].text | string | 是 | 视频描述文本 |
| parameters.duration | integer | 否 | 视频时长(秒) |
| parameters.size | string | 否 | 视频分辨率,如 "1280*720" |
创建任务示例
BASH
curl -X POST https://model.sophnet.com/api/open-apis/projects/easyllms/videogenerator/generate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "Wan2.2-T2V-Plus",
"content": [
{"type": "text", "text": "一只可爱的小猫在阳光下玩耍"}
],
"parameters": {
"duration": 5,
"size": "1280*720"
}
}'2.2 图生视频
基于参考图片和文本描述生成视频。
Body 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| model | string | 是 | 模型名称,如 Wan2.2-I2V-Plus、happyhorse-1.0-i2v |
| content | array | 是 | 内容数组,包含 image_url 和 text 元素 |
| content[].type | string | 是 | "image_url" 或 "text" |
| content[].image_url.url | string | 是 | 参考图片 URL(type 为 image_url 时) |
| content[].text | string | 是 | 视频描述文本(type 为 text 时) |
| parameters.duration | integer | 否 | 视频时长(秒) |
| parameters.size | string | 否 | 视频分辨率 |
创建任务示例
BASH
curl -X POST https://model.sophnet.com/api/open-apis/projects/easyllms/videogenerator/generate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "Wan2.2-I2V-Plus",
"content": [
{"type": "image_url", "image_url": {"url": "https://example.com/reference.jpg"}},
{"type": "text", "text": "让图片中的人物动起来"}
],
"parameters": {
"duration": 5,
"size": "1280*720"
}
}'2.3 查询任务
基本信息
- 请求地址:
https://model.sophnet.com/api/open-apis/projects/easyllms/videogenerator/generate/{taskId} - 请求方式:GET
Header 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Authorization | String | 是 | "Bearer " + API Key |
请求示例
BASH
curl -X GET https://model.sophnet.com/api/open-apis/projects/easyllms/videogenerator/generate/{taskId} \
-H "Authorization: Bearer $API_KEY"