错误

API 返回的所有错误:为什么会发生、该怎么处理,以及是否应该重试。

每个错误的返回体中都带有一个稳定的 code,结构遵循各格式自己的格式。请根据 code 分支处理,不要依赖消息文本:消息的措辞可能会变。

41 / 41
401invalid_api_key
何时出现
密钥缺失、输错、不存在或已撤销。在调用开始时被撤销的密钥,会在预留阶段被拒绝。
处理方法
以 Authorization: Bearer binf_... 或 x-api-key: binf_... 发送完整的密钥。如果密钥已被撤销,请创建一个新的。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "Missing or malformed API key. Send your binf_ key as `Authorization: Bearer <key>` or `x-api-key`.",    "type": "authentication_error",    "code": "invalid_api_key",    "param": null  }}
Messages(HTTP 401)
{  "type": "error",  "error": {    "type": "authentication_error",    "message": "Missing or malformed API key. Send your binf_ key as `Authorization: Bearer <key>` or `x-api-key`.",    "code": "invalid_api_key"  }}
403agent_inactive
何时出现
Agent 的发射尚未在链上确认,或者发射费尚未支付。
处理方法
在 Agent 的页面上完成发射。页面显示 Agent 已上线后,密钥就可以使用。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "This agent is not active yet. Activate it on its page to use the gateway.",    "type": "permission_error",    "code": "agent_inactive",    "param": null  }}
Messages(HTTP 403)
{  "type": "error",  "error": {    "type": "permission_error",    "message": "This agent is not active yet. Activate it on its page to use the gateway.",    "code": "agent_inactive"  }}
403agent_suspended
何时出现
该 Agent 已被暂停。它的所有密钥都无法发起调用。
处理方法
联系 bInference。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "This agent is suspended.",    "type": "permission_error",    "code": "agent_suspended",    "param": null  }}
Messages(HTTP 403)
{  "type": "error",  "error": {    "type": "permission_error",    "message": "This agent is suspended.",    "code": "agent_suspended"  }}
403agent_paused
何时出现
Agent 的所有者在它的驾驶舱中点击了暂停。它的所有密钥都无法发起调用,它的 hooks 也会拒绝它的交易。
处理方法
在 binference.io 上 Agent 的驾驶舱中恢复它,需要最近 10 分钟内用钱包登录过。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "This agent's owner paused it on binference.io. Resume it from the agent's cockpit there.",    "type": "permission_error",    "code": "agent_paused",    "param": null  }}
Messages(HTTP 403)
{  "type": "error",  "error": {    "type": "permission_error",    "message": "This agent's owner paused it on binference.io. Resume it from the agent's cockpit there.",    "code": "agent_paused"  }}
400invalid_request
何时出现
请求体不是 JSON,或者缺少该格式需要的字段,比如 model 或 messages。模型的服务商也可能以同样的方式拒绝某个参数。
处理方法
对照接口的参考文档检查请求体,并对照模型检查参数。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "The request body is not valid JSON.",    "type": "invalid_request_error",    "code": "invalid_request",    "param": null  }}
Messages(HTTP 400)
{  "type": "error",  "error": {    "type": "invalid_request_error",    "message": "The request body is not valid JSON.",    "code": "invalid_request"  }}
400unknown_model
何时出现
没有任何列出的模型使用这个 ID。在 POST /images 上,则是没有图像模型使用它。
处理方法
从 GET /models 或模型页面复制一个 ID;如果是图像,从 GET /images/models 复制。ID 的格式类似 anthropic/claude-sonnet-5.5。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "Unknown model `openai/gpt-9`. Every model we serve is listed at /api/v1/models.",    "type": "invalid_request_error",    "code": "unknown_model",    "param": null  }}
Messages(HTTP 400)
{  "type": "error",  "error": {    "type": "invalid_request_error",    "message": "Unknown model `openai/gpt-9`. Every model we serve is listed at /api/v1/models.",    "code": "unknown_model"  }}
400invalid_fallback
何时出现
把由厂商直接提供的模型列为备用模型,或给它配备用模型;在 models 或 fallbacks 中写了 bRoute;或调用 bRoute 时自带了备用列表。
处理方法
只把 bRoute 写在 model 中:它会自己选择模型和备用模型。由厂商直接提供的模型请单独调用。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "`broute/coding` is a bRoute: it can be the call's `model`, never a fallback.",    "type": "invalid_request_error",    "code": "invalid_fallback",    "param": null  }}
Messages(HTTP 400)
{  "type": "error",  "error": {    "type": "invalid_request_error",    "message": "`broute/coding` is a bRoute: it can be the call's `model`, never a fallback.",    "code": "invalid_fallback"  }}
400no_capable_lane
何时出现
请求需要某种能力(图像输入、文件、工具、更长的上下文),而这个 bRoute 的所有通道都没有能做到的模型。
处理方法
在 binference.io 的 bRoute 页面,给某个通道选一个能处理它的模型,或直接调用模型。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "No lane of `broute/coding` can take this request: it needs image input. Give one of its lanes a model that can.",    "type": "invalid_request_error",    "code": "no_capable_lane",    "param": null  }}
Messages(HTTP 400)
{  "type": "error",  "error": {    "type": "invalid_request_error",    "message": "No lane of `broute/coding` can take this request: it needs image input. Give one of its lanes a model that can.",    "code": "no_capable_lane"  }}
400model_not_served
何时出现
:batch 版本、已下线的版本,以及调用之后才选定付费模型的自动路由,它们的价格无法提前预留。没有免费版本的模型加上 :free,或者 :free 再加其他变体。还有按请求无法限定上限的内容计费的图像模型,比如字体。
处理方法
使用付费模型本身的 ID,或者在其后加上 :nitro、:floor、:exacto 或 :online。要用免费模型,从 GET /models 中复制标有 free 的 ID,或者发送 binference/free。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "`anthropic/claude-sonnet-5.5` has no free version here. GET /api/v1/models lists the free models (`free: true`), and `binference/free` picks one for you.",    "type": "invalid_request_error",    "code": "model_not_served",    "param": null  }}
Messages(HTTP 400)
{  "type": "error",  "error": {    "type": "invalid_request_error",    "message": "`anthropic/claude-sonnet-5.5` has no free version here. GET /api/v1/models lists the free models (`free: true`), and `binference/free` picks one for you.",    "code": "model_not_served"  }}
400tool_not_served
何时出现
会运行其他模型的工具,或者会在共享账户上保留文件、记忆或沙箱的工具:图像生成工具、托管代码执行、文件搜索、记忆、X 搜索。另外还有没有步数上限的工具循环。
处理方法
移除该工具,或者在你自己的机器上运行它。联网搜索和网页抓取是支持的。为工具循环设置 max_tool_calls。要生成图像,请调用 POST /images。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "X search bills for every post it returns, with no limit a request can set, so its cost cannot be reserved up front. Remove `x_search` to search the web only.",    "type": "invalid_request_error",    "code": "tool_not_served",    "param": null  }}
Messages(HTTP 400)
{  "type": "error",  "error": {    "type": "invalid_request_error",    "message": "X search bills for every post it returns, with no limit a request can set, so its cost cannot be reserved up front. Remove `x_search` to search the web only.",    "code": "tool_not_served"  }}
400model_no_image_input
何时出现
请求中带有图像,但模型及其所有备用模型都无法读取图像。
处理方法
选择一个在 GET /models 中 architecture.input_modalities 包含 image 的模型,或者把这样的模型加为备用模型。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "`z-ai/glm-5.1` does not read images. Send the image to a model that does: GET /api/v1/models lists each model's input modalities.",    "type": "invalid_request_error",    "code": "model_no_image_input",    "param": null  }}
Messages(HTTP 400)
{  "type": "error",  "error": {    "type": "invalid_request_error",    "message": "`z-ai/glm-5.1` does not read images. Send the image to a model that does: GET /api/v1/models lists each model's input modalities.",    "code": "model_no_image_input"  }}
400image_type_not_served
何时出现
内联图像(data: URL 或 base64 块)不是 PNG、JPEG、WebP 或 GIF,比如 HEIC、SVG 或 TIFF。
处理方法
把图像转换为 PNG、JPEG、WebP 或 GIF,或者以链接形式发送。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "Images are read as PNG, JPEG, WebP or GIF, and this request sends image/heic. Convert it to one of those first.",    "type": "invalid_request_error",    "code": "image_type_not_served",    "param": null  }}
Messages(HTTP 400)
{  "type": "error",  "error": {    "type": "invalid_request_error",    "message": "Images are read as PNG, JPEG, WebP or GIF, and this request sends image/heic. Convert it to one of those first.",    "code": "image_type_not_served"  }}
413request_too_large
何时出现
请求体超过 4 MB,或者提示词超过了模型的上下文长度。
处理方法
以 URL 发送图像和文件,不要内联 base64:用 POST /uploads 上传大图,再发送它的链接。在 Claude Code 中,运行 /compact 或 /clear。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "The request body is larger than 4 MB. Send images and files as URLs instead of inline data: upload a large image with POST /api/v1/uploads and send its link.",    "type": "invalid_request_error",    "code": "request_too_large",    "param": null  }}
Messages(HTTP 413)
{  "type": "error",  "error": {    "type": "request_too_large",    "message": "The request body is larger than 4 MB. Send images and files as URLs instead of inline data: upload a large image with POST /api/v1/uploads and send its link.",    "code": "request_too_large"  }}
400request_over_capacity
何时出现
单个请求的预留金额,大于一个 Agent 当前同时最多可预留的金额(网关每日容量的四分之一),或者大于网关能为单次调用保留的金额。如果这些金额是我们这边的限制,消息中会给出具体数值。
处理方法
调低 max_tokens(Responses 中为 max_output_tokens),然后重新发送。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "This request asks for more output than the gateway can take on right now. Lower max_tokens (max_output_tokens on Responses) and retry.",    "type": "invalid_request_error",    "code": "request_over_capacity",    "param": null  }}
Messages(HTTP 400)
{  "type": "error",  "error": {    "type": "invalid_request_error",    "message": "This request asks for more output than the gateway can take on right now. Lower max_tokens (max_output_tokens on Responses) and retry.",    "code": "request_over_capacity"  }}
404not_found
何时出现
路径不存在,比如 embeddings 或 Token 计数。
处理方法
使用本参考文档中的接口之一。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "`POST /v1/embeddings` is not served here. The models are served at /v1/chat/completions, /v1/responses and /v1/messages.",    "type": "not_found_error",    "code": "not_found",    "param": null  }}
Messages(HTTP 404)
{  "type": "error",  "error": {    "type": "not_found_error",    "message": "`POST /v1/embeddings` is not served here. The models are served at /v1/chat/completions, /v1/responses and /v1/messages.",    "code": "not_found"  }}
503storage_unavailable
何时出现
图像存储尚未配置或无法连接时,进行了上传,或者要求以链接形式返回图像。
处理方法
内联发送图像,或者使用你自己的链接;也可以不传 response_format,以 base64 获取图像。
重试
重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "Image links are not available right now. Leave out `response_format` to get the images as base64.",    "type": "server_error",    "code": "storage_unavailable",    "param": null  }}
Messages(HTTP 503)
{  "type": "error",  "error": {    "type": "overloaded_error",    "message": "Image links are not available right now. Leave out `response_format` to get the images as base64.",    "code": "storage_unavailable"  }}
402insufficient_balance
何时出现
Agent 现在可花费的金额,少于本次调用的预留金额,即最坏情况下的费用。消息中会给出这两个金额。上传也需要有一些可花费的额度。
处理方法
调低 max_tokens 让预留金额够用,等待运行中的调用结束,或者充值。Agent 从其代币的交易税中获得额度。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "Balance $0.004210 ($0.001000 held by calls running or being priced) is below this request's reserve of $0.019660. Lower the output limit or add credit.",    "type": "billing_error",    "code": "insufficient_balance",    "param": null  }}
Messages(HTTP 402)
{  "type": "error",  "error": {    "type": "billing_error",    "message": "Balance $0.004210 ($0.001000 held by calls running or being priced) is below this request's reserve of $0.019660. Lower the output limit or add credit.",    "code": "insufficient_balance"  }}
402key_limit
何时出现
密钥自己的每日、每周或每月上限不足以支付本次调用的预留金额。该 Agent 的其他密钥照常工作。
处理方法
等到消息中给出的重置时间,调低 max_tokens,或者在 API 密钥页面提高上限。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "This key's limit of $5.000000 a day is used up: $4.990000 spent and $0.000000 held by calls running or being priced, and this request reserves $0.019660. It resets at 2026-10-01T00:00:00.000Z. Lower the output limit, or ask the agent's owner to raise the key's limit.",    "type": "billing_error",    "code": "key_limit",    "param": null  }}
Messages(HTTP 402)
{  "type": "error",  "error": {    "type": "billing_error",    "message": "This key's limit of $5.000000 a day is used up: $4.990000 spent and $0.000000 held by calls running or being priced, and this request reserves $0.019660. It resets at 2026-10-01T00:00:00.000Z. Lower the output limit, or ask the agent's owner to raise the key's limit.",    "code": "key_limit"  }}
429upload_limit
何时出现
该 Agent 在过去 24 小时内已发起 200 次上传。
处理方法
按 Retry-After-Ms 中的时间等待,内联发送小图,或者复用已上传图像的链接:它在 24 小时内有效。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "This agent started 200 uploads in the last 24 hours, the most it may. Send small images inline, or retry later.",    "type": "rate_limit_error",    "code": "upload_limit",    "param": null  }}
Messages(HTTP 429)
{  "type": "error",  "error": {    "type": "rate_limit_error",    "message": "This agent started 200 uploads in the last 24 hours, the most it may. Send small images inline, or retry later.",    "code": "upload_limit"  }}
429rate_limited
何时出现
该 Agent 一次发起了超过 60 个调用,或者每分钟超过 600 个。
处理方法
等待 Retry-After-Ms 后重新发送。官方 OpenAI 和 Anthropic SDK 会自动帮你处理。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "This agent is starting calls faster than 600 a minute. Retry in 1 second.",    "type": "rate_limit_error",    "code": "rate_limited",    "param": null  }}
Messages(HTTP 429)
{  "type": "error",  "error": {    "type": "rate_limit_error",    "message": "This agent is starting calls faster than 600 a minute. Retry in 1 second.",    "code": "rate_limited"  }}
429free_limit
何时出现
免费模型的调用超出了限制:每个 Agent 每分钟 5 次、每个 UTC 日 50 次、同时 2 个,或者所有 Agent 共享的全站限制。付费模型不受它影响。
处理方法
等待 Retry-After 中的时间,或者调用付费模型。错误消息会说明是哪一项限制,以及何时恢复。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "This agent used its 50 free calls for today. More at 00:00 UTC, in 5 hours 12 minutes. Paid models are not limited by this.",    "type": "rate_limit_error",    "code": "free_limit",    "param": null  }}
Messages(HTTP 429)
{  "type": "error",  "error": {    "type": "rate_limit_error",    "message": "This agent used its 50 free calls for today. More at 00:00 UTC, in 5 hours 12 minutes. Paid models are not limited by this.",    "code": "free_limit"  }}
429too_many_running_calls
何时出现
该 Agent 有 8 个调用正在运行。任意一个结束,就会立刻空出一个名额。
处理方法
在你这边对调用排队,或者按响应头给出的时间等待 2 到 8 秒。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "This agent already has 8 calls running. Retry when one finishes.",    "type": "rate_limit_error",    "code": "too_many_running_calls",    "param": null  }}
Messages(HTTP 429)
{  "type": "error",  "error": {    "type": "rate_limit_error",    "message": "This agent already has 8 calls running. Retry when one finishes.",    "code": "too_many_running_calls"  }}
429too_much_reserved
何时出现
该 Agent 运行中的调用加上这一次,预留金额将超过一个 Agent 同时可预留的上限:网关每日容量的四分之一,这样任何单个 Agent 都无法占用全部容量。调用的预留金额是它最坏情况下的费用,所以输出上限高的调用最快占满。
处理方法
按响应头给出的时间等待 2 到 8 秒,或者调低 max_tokens,让每次调用预留得更少。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "This agent's running calls already reserve $2.000000 of the $2.500000 one agent may reserve at once. Retry when one finishes.",    "type": "rate_limit_error",    "code": "too_much_reserved",    "param": null  }}
Messages(HTTP 429)
{  "type": "error",  "error": {    "type": "rate_limit_error",    "message": "This agent's running calls already reserve $2.000000 of the $2.500000 one agent may reserve at once. Retry when one finishes.",    "code": "too_much_reserved"  }}
429daily_share_used
何时出现
很少见。当某天 80% 的共享容量已被用掉时,已经用完自己公平份额的 Agent 需要等待,剩下的容量留给所有人。
处理方法
等到 UTC 时间 00:00。增加容量后,限制通常会更早解除。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "Today's shared AI capacity is running low, and this agent has used its fair share of it ($12.000000 of $12.000000). It can start calls again at 00:00 UTC, or sooner if capacity is added.",    "type": "rate_limit_error",    "code": "daily_share_used",    "param": null  }}
Messages(HTTP 429)
{  "type": "error",  "error": {    "type": "rate_limit_error",    "message": "Today's shared AI capacity is running low, and this agent has used its fair share of it ($12.000000 of $12.000000). It can start calls again at 00:00 UTC, or sooner if capacity is added.",    "code": "daily_share_used"  }}
503/529model_busy
何时出现
该模型的所有服务商都已满负荷。在 /messages 上会返回 529 overloaded_error,这样 Claude Code 会切换到它的备用模型。
处理方法
等待 Retry-After-Ms,或者换一个模型。在 models 中列出备用模型,调用就可以在下一个模型上运行。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses
{  "error": {    "message": "The model `openai/gpt-6.1` is busy at its providers right now. Retry in 12 seconds.",    "type": "server_error",    "code": "model_busy",    "param": null  }}
Messages(HTTP 529)
{  "type": "error",  "error": {    "type": "overloaded_error",    "message": "The model `openai/gpt-6.1` is busy at its providers right now. Retry in 12 seconds.",    "code": "model_busy"  }}
503gateway_busy
何时出现
网关暂时达到了容量上限。
处理方法
等待 Retry-After-Ms 后重新发送。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "The gateway is busy right now. Retry in 8 seconds.",    "type": "server_error",    "code": "gateway_busy",    "param": null  }}
Messages(HTTP 503)
{  "type": "error",  "error": {    "type": "overloaded_error",    "message": "The gateway is busy right now. Retry in 8 seconds.",    "code": "gateway_busy"  }}
503gateway_capacity
何时出现
网关正在补充容量。bInference 会立即收到警报。
处理方法
等待 Retry-After-Ms 后重新发送。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "The gateway is briefly out of capacity. Try again soon.",    "type": "server_error",    "code": "gateway_capacity",    "param": null  }}
Messages(HTTP 503)
{  "type": "error",  "error": {    "type": "overloaded_error",    "message": "The gateway is briefly out of capacity. Try again soon.",    "code": "gateway_capacity"  }}
503gateway_unavailable
何时出现
网关暂时无法连接到它的模型。bInference 会立即收到警报。
处理方法
等待 Retry-After-Ms 后重新发送。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "The gateway is briefly unavailable. Try again soon.",    "type": "server_error",    "code": "gateway_unavailable",    "param": null  }}
Messages(HTTP 503)
{  "type": "error",  "error": {    "type": "overloaded_error",    "message": "The gateway is briefly unavailable. Try again soon.",    "code": "gateway_unavailable"  }}
503catalog_unavailable
何时出现
网关无法读取模型价格,因此无法计算预留金额。
处理方法
5 秒后重新发送。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "Model prices are unavailable. Try again shortly.",    "type": "server_error",    "code": "catalog_unavailable",    "param": null  }}
Messages(HTTP 503)
{  "type": "error",  "error": {    "type": "overloaded_error",    "message": "Model prices are unavailable. Try again shortly.",    "code": "catalog_unavailable"  }}
503service_unavailable
何时出现
网关在预留之前无法连接到它的数据库。没有预留任何费用。
处理方法
大约 2 秒后重新发送。
重试
按 Retry-After-Ms 等待后重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "The balance is briefly unavailable. Try again in a moment.",    "type": "server_error",    "code": "service_unavailable",    "param": null  }}
Messages(HTTP 503)
{  "type": "error",  "error": {    "type": "overloaded_error",    "message": "The balance is briefly unavailable. Try again in a moment.",    "code": "service_unavailable"  }}
500gateway_error
何时出现
网关在预留之后出现故障。预留会被释放,本次调用免费。
处理方法
重新发送。如果一直失败,请带上 x-binference-call-id 响应头联系 bInference。
重试
重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "The gateway failed on this call. Retry it.",    "type": "server_error",    "code": "gateway_error",    "param": null  }}
Messages(HTTP 500)
{  "type": "error",  "error": {    "type": "api_error",    "message": "The gateway failed on this call. Retry it.",    "code": "gateway_error"  }}
504upstream_timeout
何时出现
模型在时间限制之前什么都没有发送:流式调用 30 分钟,非流式调用 13 分钟。调用仍会运行到结束,并按实际费用扣费。
处理方法
耗时长的调用请使用流式输出,或者调低 max_tokens,或者换一个更快的模型。
重试
重试
费用
只收取服务商记录的费用,通常为零
Chat Completions、Responses、models、balance
{  "error": {    "message": "The model did not answer in time.",    "type": "server_error",    "code": "upstream_timeout",    "param": null  }}
Messages(HTTP 504)
{  "type": "error",  "error": {    "type": "api_error",    "message": "The model did not answer in time.",    "code": "upstream_timeout"  }}
502upstream_unreachable
何时出现
与模型服务商的连接失败。
处理方法
重新发送。
重试
重试
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "Could not reach the model provider. Try again.",    "type": "server_error",    "code": "upstream_unreachable",    "param": null  }}
Messages(HTTP 502)
{  "type": "error",  "error": {    "type": "api_error",    "message": "Could not reach the model provider. Try again.",    "code": "upstream_unreachable"  }}
502provider_error
何时出现
模型的服务商出错,或者拒绝了这一次调用。
处理方法
重新发送,或者换一个模型。
重试
重试
费用
只收取服务商记录的费用,通常为零
Chat Completions、Responses、models、balance
{  "error": {    "message": "The model's provider failed to answer. Try again in a moment.",    "type": "server_error",    "code": "provider_error",    "param": null  }}
Messages(HTTP 502)
{  "type": "error",  "error": {    "type": "api_error",    "message": "The model's provider failed to answer. Try again in a moment.",    "code": "provider_error"  }}
503provider_unavailable
何时出现
该模型在其服务商那里暂时无法使用。
处理方法
稍后重新发送,或者换一个模型。
重试
重试
费用
只收取服务商记录的费用,通常为零
Chat Completions、Responses、models、balance
{  "error": {    "message": "The model is unavailable right now. Try again in a moment.",    "type": "server_error",    "code": "provider_unavailable",    "param": null  }}
Messages(HTTP 503)
{  "type": "error",  "error": {    "type": "overloaded_error",    "message": "The model is unavailable right now. Try again in a moment.",    "code": "provider_unavailable"  }}
404no_provider
何时出现
该模型没有任何服务商支持请求中的全部选项,比如工具、图像或长上下文。
处理方法
去掉某个选项,或者选择一个支持它的模型。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "No provider can serve this request with this model. Try another model, or fewer options such as tools or images.",    "type": "not_found_error",    "code": "no_provider",    "param": null  }}
Messages(HTTP 404)
{  "type": "error",  "error": {    "type": "not_found_error",    "message": "No provider can serve this request with this model. Try another model, or fewer options such as tools or images.",    "code": "no_provider"  }}
403provider_refused
何时出现
服务商自身的政策拒绝了该请求。
处理方法
修改请求,或者换一个模型。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "The model's provider refused this request for this model.",    "type": "permission_error",    "code": "provider_refused",    "param": null  }}
Messages(HTTP 403)
{  "type": "error",  "error": {    "type": "permission_error",    "message": "The model's provider refused this request for this model.",    "code": "provider_refused"  }}
422unprocessable
何时出现
服务商接受了请求,但无法执行。
处理方法
对照模型检查参数,或者换一个模型。
重试
先修正
费用
免费
Chat Completions、Responses、models、balance
{  "error": {    "message": "The model's provider could not process this request.",    "type": "server_error",    "code": "unprocessable",    "param": null  }}
Messages(HTTP 422)
{  "type": "error",  "error": {    "type": "api_error",    "message": "The model's provider could not process this request.",    "code": "unprocessable"  }}
408timeout
何时出现
服务商放弃了这次调用(408 或 504)。
处理方法
重新发送、使用流式输出,或者调低 max_tokens。
重试
重试
费用
只收取服务商记录的费用,通常为零
Chat Completions、Responses、models、balance
{  "error": {    "message": "The model took too long to answer. Try again.",    "type": "server_error",    "code": "timeout",    "param": null  }}
Messages(HTTP 408)
{  "type": "error",  "error": {    "type": "api_error",    "message": "The model took too long to answer. Try again.",    "code": "timeout"  }}
502upstream_error
何时出现
来自服务商的其他任何错误。
处理方法
稍后重新发送。
重试
重试
费用
只收取服务商记录的费用,通常为零
Chat Completions、Responses、models、balance
{  "error": {    "message": "The request could not be completed. Try again in a moment.",    "type": "server_error",    "code": "upstream_error",    "param": null  }}
Messages(HTTP 502)
{  "type": "error",  "error": {    "type": "api_error",    "message": "The request could not be completed. Try again in a moment.",    "code": "upstream_error"  }}

速览

状态码含义重试?
400请求无法按原样处理否。先修正
401密钥缺失、错误或已撤销否
402余额或密钥的上限不足以支付预留金额否。调低 max_tokens 或充值
403Agent 尚未启用否
404路径不存在,或者没有服务商能处理此请求否
413请求体超过 4 MB否。以 URL 发送文件
429运行中的调用太多,或者速度太快是,等待 Retry-After-Ms 之后
500网关出错。本次调用免费是
502 504模型的服务商出错是
503 529暂时繁忙是,等待 Retry-After-Ms 之后

流式输出中的错误

回答一旦开始流式输出,错误就无法再改变状态码。它会以该格式自己的错误事件到达,这样 SDK 会抛出错误,而不是一直挂起:

data: {"object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"error"}],"error":{"message":"The model took too long to answer. Try again.","type":"server_error","code":"timeout"}}

调用会按出错前已生成的内容扣费。

本页目录