This commit is contained in:
yumoqing 2026-04-01 16:02:02 +08:00
parent 1e0158ad1f
commit 2c8d02427d
3 changed files with 320 additions and 1 deletions

View File

@ -0,0 +1,292 @@
# 元境平台
## 申请APIKEY
用户需要在元境平台https://opencomputing.ai上注册和登录 登录后点击左上角元境平台进入菜单,点击“下位系统接口-下位系统, 在界面中点击“创建APIKEY”
输入信息后点击提交APIKEY创建完成
点击"复制apikey" 在弹出窗口看到apikey 复制他
## 充值
用户需要在元境平台上充值目前支持alipay支付宝充值
操作方法
* 用户登录
* 呼出用户菜单(点击右上角用户名)
* 点击充值
* 输入充值信息
在弹出界面中选择支付宝充值,输入合适的金额,点击提交转支付宝充值页面, 完成后等1分钟查看账户当前余额
## 查看当前余额
* 用户登录
* 呼出用户菜单
* 点击财务
## base url
https://opencomputing.ai
## openai 兼容接口
我们提供一套兼容openai的API
### 文本生成
* path /llmage/t2t
* method 'POST'
* headers
```
{
"Content-Type": "application/json",
"Authorization": "Bearer <your-apikey>" # 客户从元境平台申请到的APIKEY
}
```
* data
{
"model": # 模型识别码, 是供应方提供给model名字
“prompt": # 提示词, 必须输入
"sys_prompt" # 系统提示词,可选
“stream” # 流式输出开关
"..." # 其他提示词
}
* 返回
符合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: [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 | 供应商 | 模型名 |
|--------|--------|--------|
| CrEMkFQfRCmbmopZsCqLj | 豆包 | doubao-seedance-1-5-pro-251215 |
| u9HZyfDoqU6uKI6M1BTks | 通义万象 | wan2.6-t2v |
| r0ill7L0s6PtBS8mkmg-7 | vidu | viduq3-pro |
| YjjGgxO_Xma8PWsMjJvps | 豆包 | eedance2.0 (未开通)|
### 万象上传数据要求
| 字段名 (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` |
### 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` | 视频长度。视频时长(秒)。 |
### 例子
使用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,
"radio": "16:9",
"resolution": "480p"
}'
```
## 图生视频
| 模型id | 供应商 | 模型名 |
|--------|--------|--------|
| 7RTOJD6K8A7RXCMG4GnQ9 | 豆包 | doubao-seedance-1-5-pro-251215 |
| FK_h7FLYnosv2TkMN4ATC | vidu | viduq3-pro |
| x4HksKp9mXR1Yv60mw6Py | 通义万象 | wan2.6-r2v |
### 通义万象上传数据要求
| 字段名 (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` |
### 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` | 视频长度。视频时长(秒)。 |
| image_file1 | string | 否 | - | 首帧图片。视频开始的画面URL 或 Base64。 |
| image_file2 | string | 否 | - | 尾帧图片。视频结束的画面URL 或 Base64。 |
### 例子
使用seedance的例子
```
```
## 参考生视频
| 模型id | 供应商 | 模型名 |
|--------|--------|--------|
| VooAIOtJdawpZjusWEzrh | 豆包 | doubao-seedance-1-5-pro-251215 |
### seedance上传数据要求
| 字段名 | 类型 | 必填 | 默认值 | 说明 |
| :--- | :--- | :--- | :--- | :--- |
| prompt | string | 是 | - | 提示词。描述视频内容的文本。 |
| radio | 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` | 视频长度。视频时长(秒)。 |
| image_file1 | string | 是 | - | 参考图片1。主要的参考画面URL 或 Base64。 |
| image_file2 | string | 否 | - | 参考图片2。额外的参考画面。 |
| image_file3 | string | 否 | - | 参考图片3。额外的参考画面。 |
### 例子
### 任务提交
* path /llmage/video
* method POST
* headers
```
{
"Content-Type": "application/json",
"Authorization": "Bearer <your-apikey>" # 客户从元境平台申请到的APIKEY
}
```
* data
除llmid外不同的模型需要的数据不同请看上传数据说明
* 返回
```
{
"taskid": # 任务id 后续使用此id查询执行结果
"status": # 状态 有:
# SUCCEEDED: 成功
# FAILED失败
# CREATED已创建
# PENDING排队中
# RUNNING运行中
}
```
返回例子:
```
{
"taskid": "936759404378734592",
"status": "created"
}
```
## 查询任务状态
* path /llmage/tasks
* method GET
* headers
```
{
"Content-Type": "application/json",
"Authorization": "Bearer <your-apikey>" # 客户从元境平台申请到的APIKEY
}
```
* params
```
{
"taskid": "936759404378734592"
}
```
* 返回
```
{
"status": # 状态 有:
# SUCCEEDED: 成功
# FAILED失败
# CREATED已创建
# PENDING排队中
# RUNNING运行中
"taskid": # 供应商生成的任务号如果失败taskid无意义
"usage": # status==SUCCEEDED时有效计费信息
"image": # 视频封面url
"video": # 视频url
}
```
返回例子:
```
{
"usage": { # 由于各个供应商,模型的计价方式不同
# usage的内容会有所变化
"action": "t2v",
"credits": 10,
"type": "text2video",
"model": "viduq3-pro",
"resolution": "540p",
"off_peak": false,
"duration": 1
},
"image": "https://opencomputing.ai/idfile?path=/tmp/19/43/137/39/cover.jpeg",
"video": "https://opencomputing.ai/idfile?path=/tmp/137/173/31/47/video.mp4",
"status": "SUCCEEDED"
}
```
### 例子
```
#!/usr/bin/env bash
curl -X GET https://opencomputing.ai/llmage/tasks?taskid=$1 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-apikey-from-opencomputing.ai>"
```
## 错误信息
* 401: {"error": "Invalid API Key"}
* 400: {"error": "Missing required parameter: prompt"}
* 429: {"error": "Insufficient balance"} (余额不足)

View File

@ -0,0 +1,17 @@
{
"widgettype": "VBox",
"options":{
"height": "100%",
"width": "100%"
},
"subwidgets":[
{
"widgettype":"MdWidget",
"options":{
"width":"50%",
"md_url":"{{entire_url('api_')}}{{params_kw._lang}}.md",
"height":"100%"
}
}
]
}

View File

@ -52,7 +52,17 @@
}
}
},
{
"name":"api",
"label":"API",
"refresh":true,
"content":{
"widgettype":"urlwidget",
"options":{
"url":"{{entire_url('api')}}"
}
}
},
{
"name":"about",
"label":"关于我们",