外观
错误码
所有错误以 OpenAI 兼容格式返回:HTTP 状态码 + JSON 错误体,其中 type 是错误大类、code 是具体错误码。
json
{
"error": {
"message": "API Key 缺失、无效或已禁用",
"type": "authentication_error",
"code": "invalid_api_key"
}
}错误码表
| HTTP | type | code | 含义 | 处置建议 |
|---|---|---|---|---|
| 401 | authentication_error | invalid_api_key | API Key 缺失、无效或已禁用 | 检查 Authorization 头与控制台 Key 状态 |
| 404 | invalid_request_error | model_not_found | 模型不存在或未上架 | 对照定价页可用模型列表 |
| 400 | invalid_request_error | invalid_request_error | 请求体不是合法 JSON 或缺少 model | 检查请求格式与必填字段 |
| 429 | insufficient_quota | quota_exceeded | 当日 token 配额已用尽 | 次日自动恢复 |
| 402 | insufficient_quota | insufficient_balance | 余额不足 | 前往控制台充值后重试 |
| 5xx | — | — | 上游模型服务异常 | 稍后重试,持续失败请联系平台 |