This article covers the most common AI API errors, ordered by error code from low to high, with the cause and handling for each. Before troubleshooting, remember three things:
- Failed requests are not billed;
- Providing a Request ID greatly speeds up support investigation;
- Errors often come from client-side message construction, and may not indicate a platform failure.
| Error | Common cause | One-line handling |
|---|---|---|
| 400 | Invalid message sequence / unsupported parameter | Check the tool_calls chain, reasoning_content replay, and unsupported fields |
| 402 | Insufficient account Balance | Add funds |
| 403 | Permission or WAF block | Change network / add funds / check Key permissions |
| 404 | Incorrect model name | Use the correct Model ID |
| 429 | Capacity overload or Key budget exceeded | Configure fallback + retry; or increase the Key budget |
| 500 | Upstream exception | Retry; if it still fails, report the Request ID |
| 503 | Cluster overload | Change model/retry; see below |
Content block is not a thinking block | Thinking compatibility | Downgrade or change model |
No deployments available | Node cooldown | Retry later |
budget_exceeded | Key budget exceeded | Increase the Key budget limit |
400 is the most common error, and the vast majority are caused by request content.
Error message:
[invalid_request_error] An assistant message with 'tool_calls' must be followed
by tool messages responding to each 'tool_call_id'.
(insufficient tool messages following tool_calls message)
Meaning: You sent an assistant message containing tool_calls, but did not attach a corresponding role=tool message for each tool_call_id afterward.
Correct handling:
messages: [
{ "role": "user", "content": "Please query the status of order 123" },
{ "role": "assistant", "content": null,
"tool_calls": [ { "id": "call_1", "type": "function",
"function": { "name": "get_order", "arguments": "{...}" } } ] },
{ "role": "tool", "tool_call_id": "call_1", "content": "{\"status\":\"shipped\"}" }
]
Troubleshooting order:
Error message:
[invalid_request_error] The reasoning_content in the thinking mode must be passed back to the API.
Handling: Replay the reasoning_content returned in the previous turn unchanged (most SDKs handle this automatically; preserve it when assembling requests manually).
Extra inputs are not permitted — commonly caused by sending fields unsupported by the backend, such as:
tool_stream (unsupported; both true and false return 400)thinking: {"type":"enabled"} (returns 400)reasoning_effort: "minimal" (use none instead)Valid reasoning_effort values: none / low / medium / high / xhigh / max / adaptive
{"code":400,"message":"Bad Request","type":"invalid_request_error"} (for example, model=kimi-k3)
Handling: Check the spelling of the Model ID (a suffix such as glm-5.3[1m] may not be recognized).
Meaning: Insufficient account Balance.
Handling:
Example: The client shows
HTTP 402 Insufficient account Balance, but the backend has a Balance and the limit has not been exceeded — this is often a Key-level budget or billing-definition difference; support must verify it.
Two common causes:
Console operations can also return 403 (such as disabling an API Key); this is a permission/interface issue and requires support handling.
Model call failed. The named model does not exist.
There's an issue with the selected model (glm-5.3[1m]). It may not exist or you may not have access to it.
Handling:
GET /v1/models to check the available list;[1m] yourself.429 has two completely different sources; distinguish them before handling.
budget_exceeded){"error": {"message": "... budget_exceeded ...", "code": 429}}
Characteristics:
max_budget has been reached.Handling: Console → AI → API Management → find the Key → increase the Key-level max budget above the account Balance.
HTTP 429
{"error":{"code":429,"message":"No deployments available"}}
Characteristics:
Handling:
Agent (automatically avoids unhealthy nodes);glm-5.3 / kimi-k2.6);Background: Current 429/503 errors mainly come from backend compute-capacity overload, which is a platform-side capacity issue.
Meaning: Upstream exception.
HTTP 500
{"error":{"message":"upstream error: do request failed"}}
Handling:
Note: If logs show "success" but the client reports an error, use the Request ID and ask support to check the details.
HTTP 503
{"error":{"code":503,"message":"Service Overload"}}
Meaning: Backend deployment overload (capacity issue).
Handling:
GLM-5.3 / Kimi K2.6 has more available compute);When compute is tight during peak hours, some popular models may experience compute shortages, throttling, and 429 errors. Configure fallback and backoff retries.
API Error: Content block is not a thinking block
Background: Some clients (such as Claude Code) parse the model's thinking block in Anthropic format. This error occurs when the platform response is not a thinking block.
Related compatibility issues:
| Symptom | Description |
|---|---|
thinking: {"type":"disabled"} returns 200 but still sends reasoning_content | Thinking is not actually disabled |
Passing tool_stream returns 400 | Field unsupported |
Responses API returns missing field 'summary' | Insufficient response-format compatibility |
| Cannot specify thinking depth / deep thinking continues after disabling it | The current backend is a thinking model; the minimum is only low |
Recommendations:
reasoning_effort: "none" (if rejected, use low);thinking: {"clear_thinking": false} (without type);Symptom: A request consumes far more than expected, or the cost is unusually high.
Common causes (client behavior, not a platform failure):
kimi-k3 submission of approximately 900,000 input tokens is billed by token and costs approximately 1.49 USD.Handling:
max_budget for the Key/model;Appeal: If the charge is genuinely abnormal, provide the Request ID to support for detail verification.
To speed up investigation, include the following in the ticket:
| Item | Description |
|---|---|
| Time | Include the time zone, for example 2026-08-30 21:15 (UTC+8) |
| Request ID | Most important: the long string in the logs |
| Error summary | Keep the HTTP code, necessary error.code / error.message, trace or Request ID, time, model name, and network details only when needed. Remove Authorization, API Key, Token, Cookie, password, private key, login code, and unrelated personal or business data. |
| Model ID | For example, deepseek-v4.1-flash |
| Client | OpenCode / Claude Code / custom program + version |
| Key alias | Helps identify which Key it was |
Do not paste the full Key into a ticket; provide the alias only. If it has been exposed, rebuild it immediately.
AI API Integration GuideModel List, Capabilities, and AvailabilityRate Limits, Concurrency, and Quota RulesBilling and Usage: Token Definitions, Caching, and Billing Appeals