错误码
所有错误响应统一使用以下格式:
{
"error": {
"message": "Description of the error.",
"type": "invalid_request_error",
"code": "error_code"
}
}HTTP 状态码
| 状态码 | 说明 |
|---|---|
| 200 | 成功 |
| 400 | 请求参数错误 |
| 401 | 认证失败(API Key 无效或缺失) |
| 402 | 余额不足(insufficient_balance) |
| 403 | 权限不足(模型未授权或 API Key 白名单限制) |
| 404 | 资源不存在 |
| 413 | 请求体过大 |
| 429 | 请求频率超限 |
| 500 | 服务器内部错误 |
| 502 | 上游通道不可用(upstream_no_channel) |
| 503 | 服务暂时不可用 |
常见错误码
| 错误码 | 说明 | 处理方式 |
|---|---|---|
invalid_api_key | API Key 无效 | 检查 API Key 是否正确 |
expired_api_key | API Key 已过期 | 在控制台重新生成 |
insufficient_balance | 余额不足 | 联系客服获取更多额度后重试 |
model_not_allowed | 模型未授权 | 检查 API Key 白名单或套餐模型权限 |
invalid_channel | X-Shotject-Channel 值无效 | 使用 official 或 byok |
upstream_no_channel | 当前模型无可用上游通道 | 联系管理员配置渠道 |
rate_limit_exceeded | 请求频率超限 | 降低请求频率,等待后重试 |
request_too_large | 请求体超过 64MB 限制 | 减小请求体大小 |
invalid_content_type | Content-Type 不是 application/json | 设置正确的 Content-Type |
