Skip to main content

概述

太行HUB企业级AI网关平台 - 模型接口文档

太行HUB 企业级网关平台是一个面向大模型应用场景的 统一 AI 服务转发与管理平台,主要用于连接与分发多个主流大模型生态,包括 Qwen、DeepSeek、Seedance 等。通过太行HUB,开发者可以以统一接口调用不同模型,简化接入成本,提升调用效率,并实现更灵活的模型选择。

1. 平台信息

配置项说明
模型调用 Base URLhttps://api.taiha.cn
模型调用 API Keysk-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 格式响应,包含以下常见字段:

字段类型说明
idstring请求唯一标识
objectstring返回对象类型
createdinteger创建时间戳(秒)
modelstring使用的模型 ID
choicesarray返回结果列表(聊天接口)
dataarray/object返回数据(图像、音频等接口)
usageobjectToken 用量信息

不同模型协议的响应格式可能存在差异,具体请参考各接口文档。

5. 错误码说明

HTTP 状态码及其含义:

状态码message (zh)message (en)含义
400请求参数有误,请检查后重试Invalid request parameters. Please check and try again.请求格式错误或不能被服务器理解。通常意味着客户端错误。
401API 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 URLhttps://api.taiha.cn
鉴权方式Bearer Token / x-goog-api-key
请求格式application/json
编码UTF-8