跳到主要内容

错误码

中转层状态码​

码名称含义能重试
400Bad Request请求体不合法改请求
401Unauthorizedkey 无效否
403Forbidden分组无此模型权限否
404Not Found路径不存在(含未实现端点)否
413Payload Too Large请求体过大缩小请求
429Too Many Requests限流 / 额度耗尽退避重试
500Internal Server Error上游异常可重试
502Bad Gateway上游不可达可重试
503Service Unavailable上游暂不可用可重试
504Gateway Timeout上游超时可重试

常见 message 文本对照​

message 片段含义处理
Invalid tokenkey 无效或已禁用换 key / 启用
token quota is not enough令牌额度用尽加额度
insufficient user quota账户余额不足充值
model not found模型不在分组内/v1/models 确认
no available channel暂时无可用上游稍后重试
context length exceeded输入超上下文窗口截断或换大窗口模型
rate limit触发限流指数退避
read request body failed请求体读取失败检查上传方式

上游错误透传​

上游模型的原始错误会透传,code 字段可能非空,例如:

{
"error": {
"code": "invalid_request_error",
"message": "max_tokens: must be greater than 0 (...)",
"type": "new_api_error"
}
}

这类错误不要重试——是参数问题。

未实现端点​

以下端点固定返回 404(不是 501):

/v1/files
/v1/fine-tunes
/v1/images/variations
/v1beta/models/{model}:countTokens

排障三步​

  1. 看 HTTP 状态码 → 判断是鉴权、参数、还是上游问题
  2. 看 request id → 提供给客服可精确定位
  3. 对照本表 → 决定改配置还是重试