docs: merge reallife_asset API into unified api_zh.md
This commit is contained in:
parent
c1ff952cef
commit
b28a2b4a76
@ -1,21 +1,21 @@
|
||||
# 元境平台API
|
||||
元境平台为下游系统提供兼容openai接口协议的API,下游系统需要开通元境平台的API,要做以下步骤
|
||||
元境平台为下游系统提供兼容openai接口协议的API和真人素材管理API。使用平台API需要做以下步骤:
|
||||
* 注册一个账号
|
||||
* 登录
|
||||
* 申请APIKEY
|
||||
* 充值
|
||||
|
||||
完成上述步骤后, 可以按照下面的例子实现文生文,文生图,文生视频,图生视频,参考生视频的模型推理服务
|
||||
完成上述步骤后,可以按照下面的接口文档实现各类服务。
|
||||
|
||||
元境平台支持的模型,请参看模型广场
|
||||
元境平台支持的模型,请参看模型广场。
|
||||
|
||||
## 申请APIKEY
|
||||
|
||||
用户需要在元境平台(https://ai.opencomputing.cn)上用手机登录, 登录"创建APIKEY"
|
||||
用户需要在元境平台(https://ai.opencomputing.cn)上用手机登录,登录"创建APIKEY"
|
||||
|
||||
输入信息后点击提交,APIKEY创建完成
|
||||
|
||||
点击"复制apikey", 在弹出窗口看到apikey, 复制他
|
||||
点击"复制apikey",在弹出窗口看到apikey,复制它
|
||||
|
||||
## 充值
|
||||
用户需要在元境平台上充值,目前支持alipay(支付宝)充值
|
||||
@ -26,6 +26,10 @@
|
||||
* 呼出用户菜单
|
||||
* 点击财务
|
||||
|
||||
---
|
||||
|
||||
# 一、大模型API(兼容OpenAI)
|
||||
|
||||
## API对接的base url
|
||||
https://opencomputing.ai
|
||||
|
||||
@ -46,16 +50,14 @@ https://opencomputing.ai
|
||||
}
|
||||
```
|
||||
|
||||
## openai 兼容接口
|
||||
我们提供一套兼容openai的API
|
||||
### 文本生成
|
||||
## 文本生成
|
||||
* path /llmage/v1/chat/completions
|
||||
* method 'POST'
|
||||
* headers
|
||||
```
|
||||
{
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer <your-apikey>" # 客户从元境平台申请到的APIKEY
|
||||
"Authorization": "Bearer <your-apikey>"
|
||||
}
|
||||
```
|
||||
* data
|
||||
@ -120,17 +122,16 @@ data: [DONE]
|
||||
* 返回
|
||||
```
|
||||
{
|
||||
"taskid": "xxx", # 任务id,后续查询结果
|
||||
"status": "CREATED" # SUCCEEDED/FAILED/CREATED/PENDING/RUNNING
|
||||
"taskid": "xxx",
|
||||
"status": "CREATED"
|
||||
}
|
||||
```
|
||||
|
||||
### 例子
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
```bash
|
||||
curl -X POST https://opencomputing.ai/llmage/v1/image/generations \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer <your-apikey>" \
|
||||
-H "Authorization: Bearer *** \
|
||||
-d '{
|
||||
"model": "wan2.2-t2i-plus",
|
||||
"catelogid": "t2i",
|
||||
@ -215,18 +216,17 @@ curl -X POST https://opencomputing.ai/llmage/v1/image/generations \
|
||||
* 返回
|
||||
```
|
||||
{
|
||||
"taskid": "xxx", # 任务id,后续查询结果
|
||||
"status": "CREATED" # SUCCEEDED/FAILED/CREATED/PENDING/RUNNING
|
||||
"taskid": "xxx",
|
||||
"status": "CREATED"
|
||||
}
|
||||
```
|
||||
|
||||
### 例子
|
||||
快乐马文生视频
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
```bash
|
||||
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer <your-apikey>" \
|
||||
-H "Authorization: Bearer *** \
|
||||
-d '{
|
||||
"model": "happyhorse-1.0-t2v",
|
||||
"catelogid": "t2v",
|
||||
@ -237,11 +237,10 @@ curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
}'
|
||||
```
|
||||
seedance 1.5 文生视频
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
```bash
|
||||
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer <your-apikey>" \
|
||||
-H "Authorization: Bearer *** \
|
||||
-d '{
|
||||
"model": "doubao-seedance-1-5-pro-251215",
|
||||
"catelogid": "t2v",
|
||||
@ -344,10 +343,9 @@ curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
|
||||
### 例子
|
||||
快乐马图生视频
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
```bash
|
||||
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
-H "Authorization: Bearer <your-apikey>" \
|
||||
-H "Authorization: Bearer *** \
|
||||
-F "model=happyhorse-1.0-i2v" \
|
||||
-F "catelogid=i2v" \
|
||||
-F "prompt=图片变换为万圣节各种南瓜飞上天" \
|
||||
@ -356,10 +354,9 @@ curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
-F "image_file=@./02.jpg"
|
||||
```
|
||||
seedance 2.0 图生视频
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
```bash
|
||||
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
-H "Authorization: Bearer <your-apikey>" \
|
||||
-H "Authorization: Bearer *** \
|
||||
-F "model=doubao-seedance-2-0-260128" \
|
||||
-F "catelogid=i2v" \
|
||||
-F "prompt=从图片1到图片2丝滑转换" \
|
||||
@ -424,10 +421,9 @@ curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
|
||||
### 例子
|
||||
seedance 2.0 参考生视频
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
```bash
|
||||
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
-H "Authorization: Bearer <your-apikey>" \
|
||||
-H "Authorization: Bearer *** \
|
||||
-F "model=doubao-seedance-2-0-260128" \
|
||||
-F "catelogid=ref2v" \
|
||||
-F "image_files=@./1.jpg" \
|
||||
@ -438,10 +434,9 @@ curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
-F "duration=4"
|
||||
```
|
||||
快乐马参考生视频
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
```bash
|
||||
curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
-H "Authorization: Bearer <your-apikey>" \
|
||||
-H "Authorization: Bearer *** \
|
||||
-F "model=happyhorse-1.0-r2v" \
|
||||
-F "catelogid=ref2v" \
|
||||
-F "image_files=@./1.jpg" \
|
||||
@ -497,14 +492,248 @@ curl -X POST https://opencomputing.ai/llmage/v1/video/generations \
|
||||
```
|
||||
|
||||
### 例子
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
```bash
|
||||
curl -X GET "https://opencomputing.ai/llmage/v1/tasks?taskid=xxx" \
|
||||
-H "Authorization: Bearer <your-apikey>"
|
||||
-H "Authorization: Bearer ***
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 二、真人素材API
|
||||
|
||||
真人素材API提供真人人像认证、素材上传和素材管理功能。所有接口通过 **Bearer Token** 认证,与大模型API使用相同的APIKEY。
|
||||
|
||||
## API对接的base url
|
||||
https://token.opencomputing.cn
|
||||
|
||||
## 业务流程
|
||||
|
||||
1. **真人认证**:调用方发起认证请求,获取 H5 链接供终端用户完成人脸识别。
|
||||
2. **查询已认证组合**:查询当前机构下所有已认证的组合 ID,用于上传素材时选择有效的 group_id。
|
||||
3. **上传素材**:使用已认证的组合 ID 上传图片/视频,系统验证组合归属关系。
|
||||
4. **状态同步**:轮询检查素材处理状态。
|
||||
|
||||
## 1. 获取真人认证链接 (H5)
|
||||
**Endpoint**: `POST /reallife_asset/api/rl_verify.dspy`
|
||||
|
||||
检查供应商配置通过后,调用供应商接口创建认证会话。
|
||||
|
||||
### 请求参数
|
||||
| 参数 | 必填 | 说明 |
|
||||
|------|------|------|
|
||||
| `vendor` | 是 | 供应商标识 |
|
||||
| `project_name` | 否 | 项目名称,默认 `default` |
|
||||
| `name` | 否 | 认证名称,方便识别的名称,查询组合列表时显示 |
|
||||
|
||||
> `user_id` 和 `org_id` 由 Bearer Token 自动获取,无需传递。
|
||||
|
||||
### 请求示例
|
||||
```bash
|
||||
curl -X POST 'https://token.opencomputing.cn/reallife_asset/api/rl_verify.dspy' \
|
||||
-H 'Authorization: Bearer *** \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"vendor": "volcengine",
|
||||
"project_name": "default",
|
||||
"name": "张三"
|
||||
}'
|
||||
```
|
||||
|
||||
### 返回示例
|
||||
**成功**:
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"data": {
|
||||
"id": "local_group_id_xxx",
|
||||
"h5_link": "https://... (H5页面链接,120秒有效)",
|
||||
"byted_token": "..."
|
||||
}
|
||||
}
|
||||
```
|
||||
**失败**(未配置):
|
||||
```json
|
||||
{
|
||||
"status": "error",
|
||||
"data": {"message": "供应商配置不存在"}
|
||||
}
|
||||
```
|
||||
|
||||
**注意**:终端用户在 H5 页面完成认证后,系统将自动登记该机构与组合 ID 的映射关系。
|
||||
|
||||
## 2. 查询已认证的组合列表
|
||||
**Endpoint**: `POST /reallife_asset/api/rl_query_groups.dspy`
|
||||
|
||||
查询当前机构下所有已认证的组合 ID,用于上传素材时选择有效的 `group_id`。
|
||||
|
||||
### 请求参数
|
||||
无需参数,系统自动从 Bearer Token 获取 `org_id`。
|
||||
|
||||
### 请求示例
|
||||
```bash
|
||||
curl -X POST 'https://token.opencomputing.cn/reallife_asset/api/rl_query_groups.dspy' \
|
||||
-H 'Authorization: Bearer ***
|
||||
```
|
||||
|
||||
### 返回示例
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"data": {
|
||||
"groups": [
|
||||
{
|
||||
"vendor_group_id": "volc-asset-group-xxx",
|
||||
"vendor": "volcengine",
|
||||
"name": "模特张三",
|
||||
"status": "active",
|
||||
"create_time": "2026-05-28 15:30:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 3. 上传素材
|
||||
**Endpoint**: `POST /reallife_asset/api/rl_upload.dspy`
|
||||
|
||||
向已认证的素材组合上传图片或视频素材。
|
||||
|
||||
### 请求参数
|
||||
| 参数 | 必填 | 说明 |
|
||||
|------|------|------|
|
||||
| `vendor_group_id` | 是 | 认证成功后获得的供应商组合 ID(通过 `rl_query_groups` 查询) |
|
||||
| `source_url` | 是 | 素材的公网 URL 或 `data:` 格式的 base64 编码(系统自动转为公网地址) |
|
||||
| `asset_type` | 否 | 素材类型:`Image` (默认) 或 `Video` |
|
||||
| `name` | 否 | 素材名称 |
|
||||
|
||||
### 请求示例(公网 URL)
|
||||
```bash
|
||||
curl -X POST 'https://token.opencomputing.cn/reallife_asset/api/rl_upload.dspy' \
|
||||
-H 'Authorization: Bearer *** \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"vendor_group_id": "volc-asset-group-xxx",
|
||||
"source_url": "https://bucket.oss.com/photo.jpg",
|
||||
"asset_type": "Image",
|
||||
"name": "模特A"
|
||||
}'
|
||||
```
|
||||
|
||||
### 请求示例(base64 直接上传)
|
||||
```bash
|
||||
curl -X POST 'https://token.opencomputing.cn/reallife_asset/api/rl_upload.dspy' \
|
||||
-H 'Authorization: Bearer *** \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"vendor_group_id": "volc-asset-group-xxx",
|
||||
"source_url": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
|
||||
"asset_type": "Image",
|
||||
"name": "模特B"
|
||||
}'
|
||||
```
|
||||
|
||||
### 返回示例
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"data": {
|
||||
"id": "asset_record_id_xxx",
|
||||
"vendor_asset_id": "asset-2026...",
|
||||
"status": "Processing"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**注意**:上传是异步操作,初始状态为 `Processing`,需调用查询素材状态接口轮询。
|
||||
|
||||
## 4. 查询素材状态
|
||||
**Endpoint**: `POST /reallife_asset/api/rl_status.dspy`
|
||||
|
||||
查询素材的处理状态(Processing / Active / Failed)。
|
||||
|
||||
### 请求参数
|
||||
| 参数 | 必填 | 说明 |
|
||||
|------|------|------|
|
||||
| `asset_id` | 是 | 上传素材时返回的本地记录 ID |
|
||||
|
||||
### 请求示例
|
||||
```bash
|
||||
curl -X POST 'https://token.opencomputing.cn/reallife_asset/api/rl_status.dspy' \
|
||||
-H 'Authorization: Bearer *** \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"asset_id": "asset_record_id_xxx"
|
||||
}'
|
||||
```
|
||||
|
||||
### 返回示例
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"data": {
|
||||
"status": "Active",
|
||||
"url": "https://... (临时下载链接,12小时有效)"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> **说明**:素材永久存储在服务器上。`url` 是临时签名下载链接,过期后可通过再次调用 `rl_status` 获取新链接。素材的永久引用为上传时返回的 `vendor_asset_id`。
|
||||
|
||||
## 5. 查询组合下所有素材
|
||||
**Endpoint**: `POST /reallife_asset/api/rl_assets.dspy`
|
||||
|
||||
查询指定 `vendor_group_id` 下的所有素材列表。
|
||||
|
||||
### 请求参数
|
||||
| 参数 | 必填 | 说明 |
|
||||
|------|------|------|
|
||||
| `vendor_group_id` | 是 | 认证成功后获得的供应商组合 ID |
|
||||
|
||||
### 请求示例
|
||||
```bash
|
||||
curl -X POST 'https://token.opencomputing.cn/reallife_asset/api/rl_assets.dspy' \
|
||||
-H 'Authorization: Bearer *** \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"vendor_group_id": "volc-asset-group-xxx"
|
||||
}'
|
||||
```
|
||||
|
||||
### 返回示例
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"data": {
|
||||
"assets": [
|
||||
{
|
||||
"id": "asset_record_id_xxx",
|
||||
"vendor_asset_id": "asset-2026...",
|
||||
"name": "模特A",
|
||||
"asset_type": "Image",
|
||||
"status": "Active",
|
||||
"url": "https://... (临时下载链接)",
|
||||
"create_time": "2026-05-28 15:30:00"
|
||||
}
|
||||
],
|
||||
"total": 3
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 错误信息
|
||||
|
||||
* 401: {"error": "Invalid API Key"}
|
||||
* 400: {"error": "Missing required parameter: prompt"}
|
||||
* 429: {"error": "Insufficient balance"} (余额不足)
|
||||
### 大模型API错误
|
||||
* 401: `{"error": "Invalid API Key"}`
|
||||
* 400: `{"error": "Missing required parameter: prompt"}`
|
||||
* 429: `{"error": "Insufficient balance"}` (余额不足)
|
||||
|
||||
### 真人素材API错误
|
||||
| 错误信息 | 原因 | 解决方案 |
|
||||
|----------|------|----------|
|
||||
| `供应商配置不存在` | 营运人员未配置 AK/SK | 联系管理员配置 |
|
||||
| `供应商服务已停用` | 供应商配置状态非 active | 联系管理员激活配置 |
|
||||
| `无效的素材组合ID或无权访问` | vendor_group_id 不属于当前机构 | 确认是否已完成认证并使用正确的 ID |
|
||||
| `素材不存在或无权访问` | asset_id 无效或归属错误 | 检查 ID 是否正确 |
|
||||
| `尚未完成认证或认证失败` | 认证未完成 | 等待用户完成 H5 认证 |
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user