概述
太行HUB企业级AI网关平台 - 模型接口文档
太行HUB 企业级网关平台是一个面向大模型应用场景的 统一 AI 服务转发与管理平台,主要用于连接与分发多个主流大模型生态,包括 Qwen、DeepSeek、Seedance 等。通过太行HUB,开发者可以以统一接口调用不同模型,简化接入成本,提升调用效率,并实现更灵活的模型选择。
1. 平台信息
| 配置项 | 说明 |
|---|---|
| 模型调用 Base URL | https://api.taiha.cn |
| 模型调用 API Key | sk-xxxxxxxx |
2. 鉴权方式
所有接口请求需要在 HTTP Header 中携带 API Key 进行鉴权:
Authorization: Bearer <API Key>
注意:部分模型(如 Google 系列)如遇到不能识别
Authorization参数的情形,可使用x-goog-api-key传递鉴权信息:x-goog-api-key: <API Key>获取您的API KEY,可以在控制台中的API密钥处创建,创建后请妥善保管您的API KEY避免泄漏。
3. 通用请求格式
| 规范 | 说明 |
|---|---|
| 协议 | 所有接口均使用 HTTPS 协议 |
| 请求体格式 | application/json(部分上传接口使用 multipart/form-data) |
| 字符编码 | 统一使用 UTF-8 |
| 路径参数 | 请求路径中的 {apiUrl} 需替换为实际的 Base URL |
4. 通用响应格式
大部分接口返回标准 JSON 格式响应,包含以下常见字段:
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 请求唯一标识 |
object | string | 返回对象类型 |
created | integer | 创建时间戳(秒) |
model | string | 使用的模型 ID |
choices | array | 返回结果列表(聊天接口) |
data | array/object | 返回数据(图像、音频等接口) |
usage | object | Token 用量信息 |
不同模型协议的响应格式可能存在差异,具体请参考各接口文档。
5. 错误码说明
HTTP 状态码及其含义:
| 状态码 | message (zh) | message (en) | 含义 |
|---|---|---|---|
| 400 | 请求参数有误,请检查后重试 | Invalid request parameters. Please check and try again. | 请求格式错误或不能被服务器理解。通常意味着客户端错误。 |
| 401 | API Key 无效或不可用,请检查后重试 | API Key is invalid or unavailable. Please check and try again. | API密钥验证未通过。请检查 API Key 是否正确,或令牌是否过期。 |
| 402 | 账户余额或额度不足,请充值或调整预算后重试 | Insufficient balance or quota. Please top up or adjust your budget and try again. | 账户余额不足。 |
| 403 | 当前账号或 API Key 暂无权限,请检查配置后重试 | Your account or API Key does not have permission. Please check your configuration and try again. | 权限不足。 |
| 404 | 当前模型或接口暂不可用,请检查后重试 | The model or endpoint is currently unavailable. Please check and try again. | 请求的资源未找到。可能正在访问不存在的端点。 |
| 406 | 请求内容不符合要求,请修改后重试 | The request content does not meet requirements. | 请求内容不符合要求。 |
| 408 | 请求处理超时,请稍后重试 | Request timed out. Please try again later. | 请求超时。 |
| 413 | 输入内容过长或文件过大,请缩短或调整后重试 | Input is too long or the file is too large. | 输入内容过长或文件过大。 |
| 422 | 请求内容无法处理,请检查参数后重试 | The request content cannot be processed. | 请求内容无法处理。 |
| 429 | 当前请求较多,请稍后重试 | Too many requests. Please try again later. | 超过速率限制,请求过于频繁。 |
| 500 | 请求处理失败,请稍后重试;如多次出现,请联系平台管理员 | Request processing failed. Please try again later; if this persists, contact the platform administrator. | 服务器内部错误。 |
| 502 | 当前服务返回异常,请稍后重试 | The upstream service returned an error. | 上游服务异常。 |
| 503 | 当前服务暂不可用,请稍后重试 | The service is temporarily unavailable. | 服务器暂时不可用。可能是服务器维护或负载过高。 |
| 504 | 服务响应超时,请稍后重试 | Service response timed out. | 服务响应超时。 |
| 524 | 请求处理时间较长,请稍后重试 | Request processing is taking longer than expected. | 请求处理时间过长。 |
| 529 | 当前服务负载较高,请稍后重试 | Service load is high. Please try again later. | 服务负载过高。 |
note
以上仅为通用 HTTP 状态码,不同模型可能有额外的业务错误码,请参考具体接口文档。
6. 模型调用示例
curl https://api.taiha.cn/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API KEY>" \
-d '{
"model": "<Model ID>",
"messages": [
{"role": "user", "content": "你好"}
]
}'
文档信息
| 项目 | 内容 |
|---|---|
| 文档名称 | 太行HUB企业级AI网关平台模型接口文档 |
| Base URL | https://api.taiha.cn |
| 鉴权方式 | Bearer Token / x-goog-api-key |
| 请求格式 | application/json |
| 编码 | UTF-8 |