Skip to Content

错误码

网关统一返回结构化错误体,格式因协议而异(见下方「错误响应格式」)。

HTTP 状态error.type含义
401authentication_errorAPI Key 无效或缺失
400invalid_request请求格式错误
402insufficient_balance / limit_exceeded余额不足 / 超出消费限额
429concurrency_exceeded / qpm_exceeded / qpm_exceeded_fallback / upstream_rate_limited触发限流
502adapter_error上游模型适配异常
503model_unavailable模型不可用(未启用对应协议或无可用上游通道)

常见错误说明

  • 401:检查 Key 是否有效,以及是否通过 Authorization: Bearer wk-...x-api-key 传递。见 API Key 格式
  • 402
    • insufficient_balance — 账户余额不足。
    • limit_exceeded — 超出单个 Key 的消费限额。
  • 429
    • concurrency_exceeded — 超过账号/套餐的并发上限。
    • qpm_exceeded / qpm_exceeded_fallback — 超过每分钟请求数(QPM)上限。
    • upstream_rate_limited — 模型绑定的所有上游通道配额已满(All upstream channels are at capacity)。
  • 503:该模型不可用,常见于请求协议(如 responses)未在该模型上启用,或无可用上游通道。可稍后重试或切换其他模型。

限流错误类型因协议而异:OpenAI 兼容端点(/v1/chat/completions 等)返回 concurrency_exceeded / qpm_exceeded / qpm_exceeded_fallback / upstream_rate_limited;Anthropic 端点(/v1/messages)返回 rate_limit_error

错误响应格式

OpenAI 兼容端点(/v1/chat/completions/v1/responses 等):

{ "error": { "message": "详细原因", "type": "authentication_error" } }

Anthropic 端点(/v1/messages):

{ "type": "error", "error": { "type": "authentication_error", "message": "详细原因" } }