Token Switch智能网关平台模型接口文档
1. 概览
Token Switch 智能网关平台是一个面向大模型应用场景的 统一 AI 服务转发与管理平台,主要用于连接与分发多个主流大模型生态,包括 ChatGPT、Claude、Gemini 等。通过 Token Switch,开发者可以以统一接口调用不同模型,简化接入成本,提升调用效率,并实现更灵活的模型选择。
1.1. 平台介绍
- 模型调用Base URL:
https://neolink.com/api - 模型调用API Key:
xxxxxxxx
1.2. 鉴权方式
所有接口请求需要在 HTTP Header 中携带 API Key 进行鉴权:
http
Authorization: Bearer <API Key>注意:部分模型(如 Google 系列)如遇到不能识别
Authorization参数的情形,可使用x-goog-api-key传递鉴权信息:httpx-goog-api-key: <API Key>
1.3. 通用请求格式
- 所有接口均使用 HTTPS 协议
- 请求体格式为
application/json(部分上传接口使用multipart/form-data) - 字符编码统一使用 UTF-8
- 请求路径中的
{apiUrl}需替换为实际的 Base URL
1.4. 通用响应格式
大部分接口返回标准 JSON 格式响应,包含以下常见字段:
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 请求唯一标识 |
object | string | 返回对象类型 |
created | integer | 创建时间戳(秒) |
model | string | 使用的模型 ID |
choices | array | 返回结果列表(聊天接口) |
data | array/object | 返回数据(图像、音频等接口) |
usage | object | Token 用量信息 |
不同模型协议的响应格式可能存在差异,具体请参考各接口文档。
1.5. 错误码说明
以下仅为通用 HTTP 状态码,不同模型可能有额外的业务错误码,请参考具体接口文档。更多业务错误码说明请参阅 用户错误码指南。
HTTP状态码及其含义:
| 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." | 服务负载过高,暂时无法处理请求。 |
