update: API文档升级为v1接口(model+catelogid模式),补充文生图章节

This commit is contained in:
yumoqing 2026-05-31 09:54:30 +08:00
parent c938359c14
commit aac345894c

View File

@ -5,13 +5,13 @@
* 申请APIKEY
* 充值
完成上述步骤后, 可以按照下面的例子实现文生文,文生视频,图生视频,参考生视频的模型推理服务
完成上述步骤后, 可以按照下面的例子实现文生文,文生图,文生视频,图生视频,参考生视频的模型推理服务
元境平台支持的模型,请参看模型广场
## 申请APIKEY
用户需要在元境平台https://ai.opencomputing.cn上用手机登录 登录“创建APIKEY”
用户需要在元境平台https://ai.opencomputing.cn上用手机登录 登录"创建APIKEY"
输入信息后点击提交APIKEY创建完成
@ -29,6 +29,23 @@
## API对接的base url
https://opencomputing.ai
## 查询可用模型列表
* path /llmage/v1/models
* method GET
* headers
```
{
"Content-Type": "application/json",
"Authorization": "Bearer <your-apikey>"
}
```
* params (可选)
```
{
"catelogid": "t2v" # 按分类筛选,如 t2t/t2i/t2v/i2v/ref2v 等
}
```
## openai 兼容接口
我们提供一套兼容openai的API
### 文本生成
@ -38,341 +55,433 @@ https://opencomputing.ai
```
{
"Content-Type": "application/json",
"Authorization": "Bearer <your-apikey>" # 客户从元境平台申请到的APIKEY
"Authorization": "Bearer <your-apikey>" # 客户从元境平台申请到的APIKEY
}
```
* data
```
{
"model": # 模型识别码, 是供应方提供给model名字
“prompt": # 提示词, 必须输入
"sys_prompt" # 系统提示词,可选
“stream” # 流式输出开关
"..." # 其他提示词
"model": "<模型名>", # 模型识别码,如 qwen3-max
"catelogid": "t2t", # 可选,默认 t2t
"prompt": "你的问题", # 提示词,必须输入
"sys_prompt": "", # 系统提示词,可选
"stream": true # 流式输出开关
}
```
* 返回
符合openai协议的流式或非流式结果
* 流式:
```
./oc.curl 你是谁
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"logprobs": null, "index": 0, "delta": {"content": "", "role": "assistant"}}], "model": "qwen3-max", "reasoning_content": null, "content": "", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u6211\u662f", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u6211\u662f", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u901a\u4e49\u5343", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u901a\u4e49\u5343", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u95ee\uff0c\u963f\u91cc\u5df4\u5df4\u96c6\u56e2\u65d7\u4e0b\u7684", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u95ee\uff0c\u963f\u91cc\u5df4\u5df4\u96c6\u56e2\u65d7\u4e0b\u7684", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u8d85\u5927\u89c4\u6a21\u8bed\u8a00\u6a21\u578b\u3002\u6211\u80fd\u591f", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u8d85\u5927\u89c4\u6a21\u8bed\u8a00\u6a21\u578b\u3002\u6211\u80fd\u591f", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u56de\u7b54\u95ee\u9898\u3001\u521b\u4f5c\u6587\u5b57\uff0c", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u56de\u7b54\u95ee\u9898\u3001\u521b\u4f5c\u6587\u5b57\uff0c", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u6bd4\u5982\u5199\u6545\u4e8b\u3001\u5199\u516c", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u6bd4\u5982\u5199\u6545\u4e8b\u3001\u5199\u516c", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u6587\u3001\u5199\u90ae\u4ef6\u3001\u5199\u5267\u672c", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u6587\u3001\u5199\u90ae\u4ef6\u3001\u5199\u5267\u672c", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u3001\u903b\u8f91\u63a8\u7406\u3001\u7f16\u7a0b\u7b49\u7b49", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u3001\u903b\u8f91\u63a8\u7406\u3001\u7f16\u7a0b\u7b49\u7b49", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\uff0c\u8fd8\u80fd\u8868\u8fbe\u89c2\u70b9\uff0c\u73a9\u6e38\u620f", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\uff0c\u8fd8\u80fd\u8868\u8fbe\u89c2\u70b9\uff0c\u73a9\u6e38\u620f", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u7b49\u3002\u5982\u679c\u4f60\u6709\u4efb\u4f55\u95ee\u9898\u6216", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u7b49\u3002\u5982\u679c\u4f60\u6709\u4efb\u4f55\u95ee\u9898\u6216", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u9700\u8981\u5e2e\u52a9\uff0c\u6b22\u8fce\u968f\u65f6\u544a\u8bc9\u6211", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u9700\u8981\u5e2e\u52a9\uff0c\u6b22\u8fce\u968f\u65f6\u544a\u8bc9\u6211", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\uff01", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\uff01", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "", "role": null}, "index": 0, "finish_reason": "stop"}], "model": "qwen3-max", "reasoning_content": null, "content": "", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [], "model": "qwen3-max", "finish": "1", "usage": {"total_tokens": 70, "completion_tokens": 60, "prompt_tokens": 10, "prompt_tokens_details": {"cached_tokens": 0}}, "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-xxx", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"logprobs": null, "index": 0, "delta": {"content": "", "role": "assistant"}}], "model": "qwen3-max", "reasoning_content": null, "content": "", "finish": "0"}
...
data: [DONE]
```
* 非流式
```
./oc.curl 你是谁
{"id": "chatcmpl-eea7abb9-24d5-9f70-b6f6-d7da4f22a8b8", "object": "chat.completion", "created": 1775011902, "choices": [{"finish_reason": "stop", "index": 0, "message": {"content": "我是通义千问,阿里巴巴集团旗下的超大规模语言模型。我能够回答问题、创作文字,比如写故事、写公文、写邮件、写剧本、逻辑推理、编程等等,还能表达观点,玩游戏等。如果你有任何问题或需要帮助,欢迎随时告诉我!", "role": "assistant"}}], "model": "qwen3-max", "reasoning_content": null, "content": "我是通义千问,阿里巴巴集团旗下的超大规模语言模型。我能够回答问题、创作文字,比如写故事、写公文、写邮件、写剧本、逻辑推理、编程等等,还能表达观点,玩游戏等。如果你有任何问题或需要帮助,欢迎随时告诉我!", "finish": "1", "usage": {"completion_tokens": 60, "prompt_tokens": 10, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 70}}
{"id": "chatcmpl-xxx", "object": "chat.completion", "created": 1775011902, "choices": [{"finish_reason": "stop", "index": 0, "message": {"content": "我是通义千问...", "role": "assistant"}}], "model": "qwen3-max", "content": "我是通义千问...", "finish": "1", "usage": {...}}
```
## 文生图
| 模型名 | 供应商 | 说明 |
|--------|--------|------|
| wan2.2-t2i-plus | 阿里百炼 | 万相2.2专业版,创意性、稳定性、写实质感全面升级 |
| wan2.5-t2i-preview | 阿里百炼 | 万相2.5 preview版 |
| wan2.2-t2i-flash | 阿里百炼 | 万相2.2极速版,速度快,性价比高 |
| cogview-3-flash | 智谱AI | CogView-3-Flash 免费图像生成 |
### 上传数据要求
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| model | string | 是 | - | 模型名。如 wan2.2-t2i-plus |
| catelogid | string | 是 | - | 分类标识。固定为 `t2i` |
| prompt | string | 是 | - | 提示词。用于描述你希望生成的图片内容。 |
| negative_prompt | string | 否 | (empty) | 负面提示词。用于描述你希望避免出现的内容。 |
### 任务提交
* path /llmage/v1/image/generations
* method POST
* headers
```
{
"Content-Type": "application/json",
"Authorization": "Bearer <your-apikey>"
}
```
* data
```
{
"model": "wan2.2-t2i-plus",
"catelogid": "t2i",
"prompt": "一只猫坐在月亮上",
"negative_prompt": "模糊,低质量"
}
```
* 返回
```
{
"taskid": "xxx", # 任务id后续查询结果
"status": "CREATED" # SUCCEEDED/FAILED/CREATED/PENDING/RUNNING
}
```
### 例子
```
#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/v1/image/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-apikey>" \
-d '{
"model": "wan2.2-t2i-plus",
"catelogid": "t2i",
"prompt": "一只猫坐在月亮上,水彩画风格"
}'
```
## 文生视频
目前支持:
| 模型id | 供应商 | 模型名 |
|--------|--------|--------|
| o5vfXYD5BURJWRTWpopE5 | 阿里云 happyhorse-1.0-t2v
| YjjGgxO_Xma8PWsMjJvps | 豆包 | doubao-seedance-2-0-260128 |
| TWay-xd0p0pkEX-_Kuhto | We Token AI | dreamina-seedance-2-0-260128(*), dreamina-seedance-2-0-fast-260128 |
| CrEMkFQfRCmbmopZsCqLj | 豆包 | doubao-seedance-1-5-pro-251215 |
| CrEMkFQfRCmbmopZsCqLj | 豆包 | doubao-seedance-1-5-pro-251215 |
| u9HZyfDoqU6uKI6M1BTks | 通义万象 | wan2.6-t2v |
| r0ill7L0s6PtBS8mkmg-7 | vidu | viduq3-pro |
| YjjGgxO_Xma8PWsMjJvps | 豆包 | eedance2.0 (未开通)|
| 模型名 | 供应商 | 说明 |
|--------|--------|------|
| happyhorse-1.0-t2v | 阿里云 | 快乐马文生视频 |
| doubao-seedance-2-0-260128 | 豆包 | seedance 2.0 |
| dreamina-seedance-2-0-260128 | We Token AI | 豆包海外版 |
| doubao-seedance-1-5-pro-251215 | 豆包 | seedance 1.5 |
| wan2.6-t2v | 通义万象 | 万象2.6文生视频 |
| viduq3-pro | vidu | vidu文生视频 |
### happyhorse-1.0-t2v上传数据要求
### happyhorse-1.0-t2v 上传数据要求
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| llmid | 模型编号 | 是 | - | - |
| model | 模型名 |否 | happyhorse-1.0-t2v |
| prompt | string | 是 | - | 提示词。用于描述你希望生成的视频内容。 |
的内容。 |
| resolution | string | 否 | `720P` | 视频尺寸。指定生成视频的分辨率。<br>可选值:<br>`720p`, `1080P` |
| ratio | string | 否 | adaptive | 可选adaptive, 16:9, 4:3, 1:1, 3:4, 9:16, 21:9 |
| duration | integer | 否 | `5` | 视频时长。指定生成视频的长度(秒)。<br>可选值:整数秒 |
| model | string | 是 | - | 模型名。`happyhorse-1.0-t2v` |
| catelogid | string | 是 | - | 分类标识。固定为 `t2v` |
| prompt | string | 是 | - | 提示词。 |
| resolution | string | 否 | `720P` | 分辨率。可选:`720P`, `1080P` |
| ratio | string | 否 | adaptive | 宽高比。可选:`16:9`, `4:3`, `1:1`, `3:4`, `9:16` |
| duration | integer | 否 | `5` | 视频时长(秒)。 |
### seedance 2.0 上传数据要求
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| llmid | 模型编号 | 是 | - | - |
| model | 模型名 |否 doubao-seedance-2-0-260128 doubao-seedance-2-0-260128 或 doubao-seedance-2-0-fast-260128
| prompt | string | 是 | - | 提示词。用于描述你希望生成的视频内容。 |
的内容。 |
| resolution | string | 否 | `720p` | 视频尺寸。指定生成视频的分辨率。<br>可选值:<br>`480p`, `720p`, `1080p` |
| ratio | string | 否 | adaptive | 可选adaptive, 16:9, 4:3, 1:1, 3:4, 9:16, 21:9 |
| duration | integer | 否 | `5` | 视频时长。指定生成视频的长度(秒)。<br>可选值:整数秒 |
| model | string | 是 | - | 模型名。`doubao-seedance-2-0-260128``doubao-seedance-2-0-fast-260128` |
| catelogid | string | 是 | - | 分类标识。固定为 `t2v` |
| prompt | string | 是 | - | 提示词。 |
| resolution | string | 否 | `720p` | 分辨率。可选:`480p`, `720p`, `1080p` |
| ratio | string | 否 | adaptive | 宽高比。可选:`16:9`, `4:3`, `1:1`, `3:4`, `9:16` |
| duration | integer | 否 | `5` | 视频时长(秒)。 |
### 万象上传数据要求
### 万象 上传数据要求
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| llmid | 模型编号 | 是 | - | - |
| model | 模型名 | 否 | 标星 | - |
| prompt | string | 是 | - | 提示词。用于描述你希望生成的视频内容。 |
| negative_prompt | string | 否 | (empty) | 反向提示词。用于描述你希望视频中避免出现的内容。 |
| size | string | 否 | `1920*1080` | 视频尺寸。指定生成视频的分辨率。<br>可选值:<br>`832*480`, `480*832`, `624*624`, `1280*720`, `720*1280`, `960*960`, `1088*832`, `832*1088`, `1920*1080`, `1080*1920`, `1440*1440`, `1632*1248`, `1248*1632` |
| duration | integer | 否 | `15` | 视频时长。指定生成视频的长度(秒)。<br>可选值:<br>`5`, `10`, `15` |
| model | string | 是 | - | 模型名。`wan2.6-t2v` |
| catelogid | string | 是 | - | 分类标识。固定为 `t2v` |
| prompt | string | 是 | - | 提示词。 |
| negative_prompt | string | 否 | (empty) | 负面提示词。 |
| size | string | 否 | `1920*1080` | 视频尺寸。可选:`832*480`, `480*832`, `624*624`, `1280*720`, `720*1280`, `960*960`, `1920*1080`, `1080*1920`, `1440*1440` |
| duration | integer | 否 | `15` | 视频时长(秒)。可选:`5`, `10`, `15` |
### vidu 上传参数
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| llmid | 模型编号 | 是 | - | - |
| prompt | string | 是 | - | 提示词。用于描述生成视频的内容。 |
| off_peak | string | 否 | `N` | 错峰执行。是否开启非高峰时段生成。<br>可选值:`Y` (是), `N` (否) |
| duration | integer | 否 | `10` | 视频长度。生成视频的时长(秒)。<br>范围1-16 秒 (根据字段描述) |
| ratio | string | 否 | `16:9` | 长宽比。指定视频的画面比例。<br>可选值:<br>`16:9`, `9:16`, `4:3`, `3:4`, `1:1` |
| resolution | string | 否 | `1080p` | 分辨率。指定生成视频的清晰度。<br>可选值:<br>`540p`, `720p`, `1080p` |
### seedance 上传数据要求
| 字段名 | 类型 | 必填 | 默认值 | 说明 |
| :--- | :--- | :--- | :--- | :--- |
| llmid | 模型编号 | 是 | - | - |
| prompt | string | 是 | - | 提示词。描述生成视频的内容。 |
| radio | string | 否 | - | 宽高比例。指定视频的长宽比。<br>可选值:<br>`16:9`, `keep_ratio`, `4:3`, `1:1`, `3:4`, `9:16`, `9:21`, `21:9`, `adaptive` |
| resolution | string | 否 | `1080p` | 分辨率。指定视频清晰度。<br>可选值:<br>`480p`, `720p`, `1080p` |
| duration | integer | 否 | `12` | 视频长度。视频时长(秒)。 |
### 例子
快乐马测试例子
```
curl -X POST https://opencomputing.ai/llmage/video \
-H "Authorization: Bearer <APIKEY>" \
-F "llmid=o5vfXYD5BURJWRTWpopE5" \
-F "prompt=天上飞过居多的各式各样的万圣节的南瓜" \
-F "ratio=4:3" \
-F "resolution=720P" \
-F "duration=4"
```
使用seedance的例子
```
#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/video \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-apikey-from-opencomputing.ai" \
-d '{
"llmid": "CrEMkFQfRCmbmopZsCqLj",
"prompt": "小猫在抓老鼠",
"duration": 5,
"ratio": "16:9",
"resolution": "480p"
}'
```
## 图生视频
| 模型id | 供应商 | 模型名 | 功能 |
|--------|--------|--------|------|
| 7y7kfYM0Xasizyi37WvAZ | 阿里云 happyhorse-1.0-i2v 文图生视频
| UeYax4591ytnPcr9eumry | 豆包 | doubao-seedance-2-0-260128 | 文图生视频 |
| tb0VSY6WeyGbzaolU1_qE | We Token AI豆包海外版 | dreamina-seedance-2-0-fast-260128, dreamina-seedance-2-0-260128 |
| 7RTOJD6K8A7RXCMG4GnQ9 | 豆包 | doubao-seedance-1-5-pro-251215 | 文图生视频 |
| 7RTOJD6K8A7RXCMG4GnQ9 | 豆包 | doubao-seedance-1-5-pro-251215 | 文生视频 |
| FK_h7FLYnosv2TkMN4ATC | vidu | viduq3-pro |
| x4HksKp9mXR1Yv60mw6Py | 通义万象 | wan2.6-r2v |
### 快乐马上传数据要求
接口只支持首帧生视频
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| llmid | 模型编号 | 是 | - | - |
| prompt | string | 是 | - | 提示词。用于描述你希望生成的视频内容。 |
| image_file | 图片文件 | 是 | - | 首帧图片。 |
| resolution | string | 否 | `720P` | 视频尺寸。指定生成视频的分辨率。<br>可选值:<br>`720P`, `1080P` |
| duration | integer | 否 | `5` | 视频时长。指定生成视频的长度(秒)。<br>可选值:整数秒 |
```
#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/video \
-H "Authorization: Bearer <your-apikey>" \
-F "llmid=o5vfXYD5BURJWRTWpopE5" \
-F "prompt=一起来调科目三" \
-F "duration=15" \
-F "resolution=720P" \
-F "image1_file=@./02.jpg"
```
### seedance 2.0 上传数据要求
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| llmid | 模型编号 | 是 | - | - |
| model | 模型名 |否 doubao-seedance-2-0-260128 doubao-seedance-2-0-260128 或 doubao-seedance-2-0-fast-260128
| prompt | string | 是 | - | 提示词。用于描述你希望生成的视频内容。 |
| image1_file | 图片文件 | 是 | - | 首帧图片。 |
| image2_file | 图片文件 | 是 | - | 尾帧图片。 |
| resolution | string | 否 | `720p` | 视频尺寸。指定生成视频的分辨率。<br>可选值:<br>`480p`, `720p`, `1080p` |
| ratio | string | 否 | adaptive | 可选adaptive, 16:9, 4:3, 1:1, 3:4, 9:16, 21:9 |
| duration | integer | 否 | `5` | 视频时长。指定生成视频的长度(秒)。<br>可选值:整数秒 |
### 通义万象上传数据要求
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| llmid | 模型编号 | 是 | - | - |
| prompt | string | 是 | - | 提示词。用于描述你希望生成的视频内容。 |
| negative_prompt | string | 否 | (empty) | 反向提示词。用于描述你希望视频中避免出现的内容。 |
| size | string | 否 | `1920*1080` | 视频尺寸。指定生成视频的分辨率。<br>可选值:<br>`832*480`, `480*832`, `624*624`, `1280*720`, `720*1280`, `960*960`, `1088*832`, `832*1088`, `1920*1080`, `1080*1920`, `1440*1440`, `1632*1248`, `1248*1632` |
| duration | integer | 否 | `15` | 视频时长。指定生成视频的长度(秒)。<br>可选值:<br>`5`, `10`, `15` |
| image_file1 | string/file | 是 | - | 首帧图片。视频的起始画面(通常为图片 URL 或 Base64。 |
| image_file2 | string/file | 是 | - | 尾帧图片。视频的结束画面(通常为图片 URL 或 Base64。 |
### vidu 上传数据要求
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| llmid | 模型编号 | 是 | - | - |
| model | string | 否 | `viduq3-pro` | 模型。选择生成视频所使用的模型版本。<br>可选值:<br>`viduq2-turbo`, `viduq3-pro` |
| prompt | string | 是 | - | 提示词。描述视频内容的文本。 |
| off_peak | string | 否 | `N` | 错峰执行。是否开启非高峰时段生成。<br>可选值:<br>`Y` (是), `N` (否) |
| image_file1 | string/file | 是 | - | 首帧图片。视频的起始画面(通常为图片 URL 或 Base64。 |
| image_file2 | string/file | 是 | - | 尾帧图片。视频的结束画面(通常为图片 URL 或 Base64。 |
| duration | integer | 否 | `10` | 视频长度。生成视频的时长(秒)。<br>范围1-16 秒 |
| ratio | string | 否 | `16:9` | 长宽比。指定视频的画面比例。<br>可选值:<br>`16:9`, `9:16`, `4:3`, `3:4`, `1:1` |
| resolution | string | 否 | `1080p` | 分辨率。指定生成视频的清晰度。<br>可选值:<br>`540p`, `720p`, `1080p` |
| model | string | 是 | - | 模型名。`viduq3-pro` |
| catelogid | string | 是 | - | 分类标识。固定为 `t2v` |
| prompt | string | 是 | - | 提示词。 |
| off_peak | string | 否 | `N` | 错峰执行。可选:`Y` (是), `N` (否) |
| duration | integer | 否 | `10` | 视频长度。范围1-16 秒 |
| ratio | string | 否 | `16:9` | 宽高比。可选:`16:9`, `9:16`, `4:3`, `3:4`, `1:1` |
| resolution | string | 否 | `1080p` | 分辨率。可选:`540p`, `720p`, `1080p` |
### seedance 1.5 上传数据要求
| 字段名 | 类型 | 必填 | 默认值 | 说明 |
| :--- | :--- | :--- | :--- | :--- |
| llmid | 模型编号 | 是 | - | - |
| prompt | string | 是 | - | 提示词。描述视频内容的文本。 |
| radio | string | 否 | - | 宽高比例。指定视频的长宽比。<br>可选值:<br>`16:9`, `keep_ratio`, `4:3`, `1:1`, `3:4`, `9:16`, `9:21`, `21:9`, `adaptive` |
| resolution | string | 否 | `1080p` | 分辨率。指定视频清晰度。<br>可选值:<br>`480p`, `720p`, `1080p` |
| duration | integer | 否 | `12` | 视频长度。视频时长(秒)。 |
| image_file1 | string | 否 | - | 首帧图片。视频开始的画面URL 或 Base64。 |
| image_file2 | string | 否 | - | 尾帧图片。视频结束的画面URL 或 Base64。 |
| model | string | 是 | - | 模型名。`doubao-seedance-1-5-pro-251215` |
| catelogid | string | 是 | - | 分类标识。固定为 `t2v` |
| prompt | string | 是 | - | 提示词。 |
| ratio | string | 否 | - | 宽高比。可选:`16:9`, `4:3`, `1:1`, `3:4`, `9:16`, `adaptive` |
| resolution | string | 否 | `1080p` | 分辨率。可选:`480p`, `720p`, `1080p` |
| duration | integer | 否 | `12` | 视频时长(秒)。 |
### 任务提交
* path /llmage/v1/video/generations
* method POST
* headers
```
{
"Content-Type": "application/json",
"Authorization": "Bearer <your-apikey>"
}
```
* data
不同的模型需要的数据不同,请看上方各模型的上传数据说明。必须包含 model 和 catelogid。
* 返回
```
{
"taskid": "xxx", # 任务id后续查询结果
"status": "CREATED" # SUCCEEDED/FAILED/CREATED/PENDING/RUNNING
}
```
### 例子
使用seedance 1.5的例子
快乐马文生视频
```
#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/video \
-H "Authorization: Bearer <your-apikey-from-opencomputing.ai" \
-F "model=dreamina-seedance-2-0-260128" \
-F "llmid=CrEMkFQfRCmbmopZsCqLj" \
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-apikey>" \
-d '{
"model": "happyhorse-1.0-t2v",
"catelogid": "t2v",
"prompt": "天上飞过各式各样的万圣节南瓜",
"ratio": "4:3",
"resolution": "720P",
"duration": 4
}'
```
seedance 1.5 文生视频
```
#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-apikey>" \
-d '{
"model": "doubao-seedance-1-5-pro-251215",
"catelogid": "t2v",
"prompt": "小猫在抓老鼠",
"duration": 5,
"ratio": "16:9",
"resolution": "480p"
}'
```
## 图生视频
| 模型名 | 供应商 | 说明 |
|--------|--------|------|
| happyhorse-1.0-i2v | 阿里云 | 快乐马图生视频(首帧) |
| doubao-seedance-2-0-260128 | 豆包 | seedance 2.0 图生视频 |
| dreamina-seedance-2-0-260128 | We Token AI | 豆包海外版图生视频 |
| doubao-seedance-1-5-pro-251215 | 豆包 | seedance 1.5 图生视频 |
| viduq3-pro | vidu | vidu首尾帧图生视频 |
| wan2.6-r2v | 通义万象 | 万象2.6预置角色生视频 |
### 快乐马上传数据要求
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| model | string | 是 | - | 模型名。`happyhorse-1.0-i2v` |
| catelogid | string | 是 | - | 分类标识。固定为 `i2v` |
| prompt | string | 是 | - | 提示词。 |
| image_file | file | 是 | - | 首帧图片。 |
| resolution | string | 否 | `720P` | 分辨率。可选:`720P`, `1080P` |
| duration | integer | 否 | `5` | 视频时长(秒)。 |
### seedance 2.0 上传数据要求
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| model | string | 是 | - | 模型名。`doubao-seedance-2-0-260128` |
| catelogid | string | 是 | - | 分类标识。固定为 `i2v` |
| prompt | string | 是 | - | 提示词。 |
| image1_file | file | 是 | - | 首帧图片。 |
| image2_file | file | 是 | - | 尾帧图片。 |
| resolution | string | 否 | `720p` | 分辨率。可选:`480p`, `720p`, `1080p` |
| ratio | string | 否 | adaptive | 宽高比。可选:`16:9`, `4:3`, `1:1`, `3:4`, `9:16` |
| duration | integer | 否 | `5` | 视频时长(秒)。 |
### 通义万象上传数据要求
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| model | string | 是 | - | 模型名。`wan2.6-r2v` |
| catelogid | string | 是 | - | 分类标识。固定为 `i2v` |
| prompt | string | 是 | - | 提示词。 |
| negative_prompt | string | 否 | (empty) | 负面提示词。 |
| size | string | 否 | `1920*1080` | 视频尺寸。 |
| duration | integer | 否 | `15` | 视频时长(秒)。可选:`5`, `10`, `15` |
| image_file1 | file | 是 | - | 首帧图片。 |
| image_file2 | file | 是 | - | 尾帧图片。 |
### vidu 上传数据要求
| 字段名 (Name) | 类型 (Type) | 必填 (Required) | 默认值 (Default) | 说明 (Description) |
| :--- | :--- | :--- | :--- | :--- |
| model | string | 是 | - | 模型名。`viduq3-pro` |
| catelogid | string | 是 | - | 分类标识。固定为 `i2v` |
| prompt | string | 是 | - | 提示词。 |
| off_peak | string | 否 | `N` | 错峰执行。可选:`Y` (是), `N` (否) |
| image_file1 | file | 是 | - | 首帧图片。 |
| image_file2 | file | 是 | - | 尾帧图片。 |
| duration | integer | 否 | `10` | 视频长度。范围1-16 秒 |
| ratio | string | 否 | `16:9` | 宽高比。可选:`16:9`, `9:16`, `4:3`, `3:4`, `1:1` |
| resolution | string | 否 | `1080p` | 分辨率。可选:`540p`, `720p`, `1080p` |
### seedance 1.5 上传数据要求
| 字段名 | 类型 | 必填 | 默认值 | 说明 |
| :--- | :--- | :--- | :--- | :--- |
| model | string | 是 | - | 模型名。`doubao-seedance-1-5-pro-251215` |
| catelogid | string | 是 | - | 分类标识。固定为 `i2v` |
| prompt | string | 是 | - | 提示词。 |
| ratio | string | 否 | - | 宽高比。可选:`16:9`, `4:3`, `1:1`, `3:4`, `9:16`, `adaptive` |
| resolution | string | 否 | `1080p` | 分辨率。可选:`480p`, `720p`, `1080p` |
| duration | integer | 否 | `12` | 视频时长(秒)。 |
| image_file1 | file | 否 | - | 首帧图片。 |
| image_file2 | file | 否 | - | 尾帧图片。 |
### 任务提交
* path /llmage/v1/video/generations
* method POST
* headers
```
{
"Content-Type": "application/json",
"Authorization": "Bearer <your-apikey>"
}
```
* data
不同的模型需要的数据不同,请看上方各模型的上传数据说明。必须包含 model 和 catelogid。
* 返回
```
{
"taskid": "xxx",
"status": "CREATED"
}
```
### 例子
快乐马图生视频
```
#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
-H "Authorization: Bearer <your-apikey>" \
-F "model=happyhorse-1.0-i2v" \
-F "catelogid=i2v" \
-F "prompt=图片变换为万圣节各种南瓜飞上天" \
-F "duration=15" \
-F "resolution=720P" \
-F "image_file=@./02.jpg"
```
seedance 2.0 图生视频
```
#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
-H "Authorization: Bearer <your-apikey>" \
-F "model=doubao-seedance-2-0-260128" \
-F "catelogid=i2v" \
-F "prompt=从图片1到图片2丝滑转换" \
-F "duration=5" \
-F "ratio=16:9" \
-F "resolution=480p" \
-F "image1_file=@./myimg1.jpg" \
-F "image1_file=@./myimg2.jpg"
-F "image2_file=@./myimg2.jpg"
```
## 参考生视频
| 模型id | 供应商 | 模型名 |
|--------|--------|--------|
| 6o9n_7u2K927hNlD8_72f | 阿里云 | happyhorse-1.0-r2v |
| dmPXF65TD1riKj9KaxLmg | 豆包 | doubao-seedance-2-0-260128(*), doubao-seedance-2-0-fast-260128 |
| nVbH7lEO51soqTbLGIHE_ | WeTokenAI 豆包海外版 | dreamina-seedance-2-0-260128(*), dreamina-seedance-2-0-fast-260128 |
| 模型名 | 供应商 | 说明 |
|--------|--------|------|
| happyhorse-1.0-r2v | 阿里云 | 快乐马参考生视频 |
| doubao-seedance-2-0-260128 | 豆包 | seedance 2.0 参考生视频 |
| dreamina-seedance-2-0-260128 | We Token AI | 豆包海外版参考生视频 |
### 快乐马 上传数据要求
| 字段名 | 类型 | 必填 | 默认值 | 说明 |
| :--- | :--- | :--- | :--- | :--- |
| model | str | 否 | | 默认值为打星模型 |
| prompt | string | 是 | - | 提示词。描述视频内容的文本。 |
| ratio | string | 否 | - | 宽高比例。指定视频的长宽比。<br>可选值:<br>`16:9`, `4:3`, `1:1`, `3:4`, `9:16`, `9:21`, `21:9` |
| resolution | string | 否 | `1080P` | 分辨率。指定视频清晰度。<br>可选值:<br>`720P`, `1080P` |
| duration | integer | 否 | `15` | 视频长度。视频时长(秒)。 |
| model | string | 是 | - | 模型名。`happyhorse-1.0-r2v` |
| catelogid | string | 是 | - | 分类标识。固定为 `ref2v` |
| prompt | string | 是 | - | 提示词。 |
| ratio | string | 否 | - | 宽高比。可选:`16:9`, `4:3`, `1:1`, `3:4`, `9:16` |
| resolution | string | 否 | `1080P` | 分辨率。可选:`720P`, `1080P` |
| duration | integer | 否 | `15` | 视频时长(秒)。 |
| image_files | 数组 | 是 | [] | 参考图片数组。最多9个图片文件 |
### seedance 2.0 上传数据要求
| 字段名 | 类型 | 必填 | 默认值 | 说明 |
| :--- | :--- | :--- | :--- | :--- |
| model | str | 否 | | 默认值为打星模型 |
| prompt | string | 是 | - | 提示词。描述视频内容的文本。 |
| ratio | string | 否 | - | 宽高比例。指定视频的长宽比。<br>可选值:<br>`16:9`, `4:3`, `1:1`, `3:4`, `9:16`, `9:21`, `21:9` |
| resolution | string | 否 | `1080p` | 分辨率。指定视频清晰度。<br>可选值:<br>`480p`, `720p`, `1080p` |
| duration | integer | 否 | `12` | 视频长度。视频时长(秒)。 |
| model | string | 是 | - | 模型名。`doubao-seedance-2-0-260128` |
| catelogid | string | 是 | - | 分类标识。固定为 `ref2v` |
| prompt | string | 是 | - | 提示词。 |
| ratio | string | 否 | - | 宽高比。可选:`16:9`, `4:3`, `1:1`, `3:4`, `9:16` |
| resolution | string | 否 | `1080p` | 分辨率。可选:`480p`, `720p`, `1080p` |
| duration | integer | 否 | `12` | 视频时长(秒)。 |
| image_files | 数组 | 是 | [] | 参考图片数组。 |
| video_files | 数组 | 否 | [] | 参考视频数组。 |
| audio_files | 数组 | 否 | [] | 参考音频数组。 |
### 任务提交
* path /llmage/video
* method POST
* path /llmage/v1/video/generations
* method POST
* headers
```
{
"Content-Type": "application/json",
"Authorization": "Bearer <your-apikey>" # 客户从元境平台申请到的APIKEY
"Authorization": "Bearer <your-apikey>"
}
```
* data
除llmid外不同的模型需要的数据不同请看上传数据说明
不同的模型需要的数据不同,请看上方各模型的上传数据说明。必须包含 model 和 catelogid。
* 返回
```
{
"taskid": # 任务id 后续使用此id查询执行结果
"status": # 状态 有:
# SUCCEEDED: 成功
# FAILED失败
# CREATED已创建
# PENDING排队中
# RUNNING运行中
}
```
返回例子:
```
{
"taskid": "936759404378734592",
"status": "created"
"taskid": "xxx",
"status": "CREATED"
}
```
### 例子
seedance 2.0 参考生视频
```
curl -X POST https://opencomputing.ai/llmage/video \
-H "Authorization: Bearer <APIKEY>" \
-F "llmid=dmPXF65TD1riKj9KaxLmg" \
-F "model": "doubao-seedance-2-0-260128" \
#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
-H "Authorization: Bearer <your-apikey>" \
-F "model=doubao-seedance-2-0-260128" \
-F "catelogid=ref2v" \
-F "image_files=@./1.jpg" \
-F "image_files=@./2.jpg" \
-F "prompt=平滑过度从第一张图片到第二张图片" \
-F "prompt=平滑过从第一张图片到第二张图片" \
-F "ratio=4:3" \
-F "resolution=720p" \
-F "duration=4"
```
快乐马参考生视频
```
#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
-H "Authorization: Bearer <your-apikey>" \
-F "model=happyhorse-1.0-r2v" \
-F "catelogid=ref2v" \
-F "image_files=@./1.jpg" \
-F "image_files=@./2.jpg" \
-F "prompt=平滑过渡从第一张图片到第二张图片" \
-F "ratio=4:3" \
-F "resolution=720P" \
-F "duration=4"
```
## 查询任务状态
* path /llmage/tasks
* method GET
* path /llmage/v1/tasks
* method GET
* headers
```
{
"Content-Type": "application/json",
"Authorization": "Bearer <your-apikey>" # 客户从元境平台申请到的APIKEY
"Authorization": "Bearer <your-apikey>"
}
```
* params
```
{
"taskid": "936759404378734592"
"taskid": "xxx"
}
```
* 返回
```
{
"status": # 状态 有:
# SUCCEEDED: 成功
# FAILED失败
# CREATED已创建
# PENDING排队中
# RUNNING运行中
"taskid": # 供应商生成的任务号如果失败taskid无意义
"usage": # status==SUCCEEDED时有效计费信息
"image": # 视频封面url
"video": # 视频url
"status": "SUCCEEDED", # SUCCEEDED/FAILED/CREATED/PENDING/RUNNING
"taskid": "xxx", # 供应商任务号
"usage": {...}, # SUCCEEDED时有效计费信息
"image": "https://...", # 图片/视频封面url
"video": "https://..." # 视频url
}
```
返回例子:
```
{
"usage": { # 由于各个供应商,模型的计价方式不同
# usage的内容会有所变化
"usage": {
"action": "t2v",
"credits": 10,
"type": "text2video",
@ -390,44 +499,12 @@ curl -X POST https://opencomputing.ai/llmage/video \
### 例子
```
#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/tasks?taskid=<taskid> \
-H "Authorization: Bearer <your-apikey-from-opencomputing.ai>"
curl -X GET "https://opencomputing.ai/llmage/v1/tasks?taskid=xxx" \
-H "Authorization: Bearer <your-apikey>"
```
## 错误信息
* 401: {"error": "Invalid API Key"}
* 400: {"error": "Missing required parameter: prompt"}
* 429: {"error": "Insufficient balance"} (余额不足)
## 快乐马的测试例子
```
# ref2v
curl -X POST https://opencomputing.ai/llmage/video \
-H "Authorization: Bearer <APIKEY>" \
-F "llmid=6o9n_7u2K927hNlD8_72f" \
-F "image_files=@./1.jpg" \
-F "image_files=@./2.jpg" \
-F "prompt=平滑过度从第一张图片到第二张图片" \
-F "ratio=4:3" \
-F "resolution=720P" \
-F "duration=4"
# i2v
curl -X POST https://opencomputing.ai/llmage/video \
-H "Authorization: Bearer <APIKEY>" \
-F "llmid=7y7kfYM0Xasizyi37WvAZ" \
-F "prompt=图片分块转换为万圣节的各种南瓜,飞上了天" \
-F "image_file=@2.jpg" \
-F "ratio=4:3" \
-F "resolution=720P" \
-F "duration=4"
# t2v
curl -X POST https://opencomputing.ai/llmage/video \
-H "Authorization: Bearer <APIKEY>" \
-F "llmid=o5vfXYD5BURJWRTWpopE5" \
-F "prompt=天上飞过居多的各式各样的万圣节的南瓜" \
-F "ratio=4:3" \
-F "resolution=720P" \
-F "duration=4"
```