API 文档
OpenAVID 提供完全兼容 OpenAI 规范的接口,替换为我们的 Base URL 即可调度全域 GPU 算力。
基础信息
| Base URL | https://api.openavid.com/v1 |
| 鉴权方式 | Bearer Token(Authorization: Bearer sk-avid-xxx) |
| 请求格式 | application/json |
| 计费维度 | 输入 / 输出 Token + GPU 秒 |
| 速率限制 | 默认 600 RPM / 账号,可申请提升 |
获取模型列表
GET /v1/models
Authorization: Bearer sk-avid-xxx
{
"object": "list",
"data": [
{ "id": "qwen-max", "owned_by": "aliyun-pai" },
{ "id": "pangu-large", "owned_by": "huawei-ascend" },
{ "id": "jiutian-70b", "owned_by": "cmcc" },
{ "id": "starsky-v1", "owned_by": "telecom" },
{ "id": "yuanjing-70b", "owned_by": "unicom" }
]
}
Chat 对话补全
POST /v1/chat/completions
请求参数
| 参数 | 类型 | 必填 | 说明 |
| model | string | 是 | 模型 ID,自动路由到对应算力池 |
| messages | array | 是 | 对话消息数组,兼容 OpenAI 格式 |
| gpu_preference | string | 否 | cost(默认)/ latency / domestic,调度策略 |
| pool | string | 否 | 指定算力池:aliyun / huawei / cmcc / telecom / unicom |
| temperature | number | 否 | 0 ~ 2,默认 0.7 |
| stream | boolean | 否 | 是否流式返回,默认 false |
请求示例
curl https://api.openavid.com/v1/chat/completions \
-H "Authorization: Bearer sk-avid-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-max",
"gpu_preference": "cost",
"messages": [
{"role": "user", "content": "介绍一下算力调度"}
]
}'
响应示例
{
"id": "chatcmpl-avid-8f21",
"object": "chat.completion",
"model": "qwen-max",
"choices": [
{ "index": 0, "message": { "role": "assistant", "content": "算力调度是…" } }
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 286,
"total_tokens": 298,
"gpu_seconds": 1.42,
"pool": "aliyun-pai",
"cost_cny": 0.00125
}
}
Python SDK 示例
from openai import OpenAI
client = OpenAI(
base_url="https://api.openavid.com/v1",
api_key="sk-avid-xxx",
)
resp = client.chat.completions.create(
model="qwen-max",
messages=[{"role": "user", "content": "你好"}],
extra_body={"gpu_preference": "cost"},
)
print(resp.choices[0].message.content)
print(resp.usage)
可用模型列表
| 模型 ID | 算力池 | 最大上下文 | 单价 / 千 Token |
| qwen-max | 阿里云 PAI | 1M | ¥0.0042 |
| qwen-plus | 阿里云 PAI | 256K | ¥0.0021 |
| pangu-large | 华为云昇腾 | 256K | ¥0.0036 |
| jiutian-70b | 中国移动 | 128K | ¥0.0038 |
| starsky-v1 | 中国电信 | 128K | ¥0.0024 |
| yuanjing-70b | 中国联通 | 64K | ¥0.0018 |
错误码
| 状态码 | 含义 | 处理建议 |
| 400 | 请求参数错误 | 检查 model 与 messages 格式 |
| 401 | API Key 无效或过期 | 在仪表板重新生成密钥 |
| 402 | 余额不足 | 充值或调整预算预警阈值 |
| 429 | 触发速率限制 | 退避重试,或申请提额 |
| 503 | 算力池全部不可用 | 稍后重试,系统会自动故障转移 |