DeepSeek API error codes
What each code means, what to do, and crucially: whether retrying is worth it.
| Code | Meaning | Retry? |
|---|---|---|
| 400 | Invalid request body format — malformed JSON, missing field, wrong type | No |
| 401 | Authentication failed — wrong, missing or deleted API key | No |
| 402 | Insufficient balance | No |
| 422 | Invalid parameters — unknown model, out-of-range temperature, max_tokens too large | No |
| 429 | Rate limit reached — too fast, or concurrency/QPS exceeded | Yes, with backoff |
| 500 | Server error | Yes |
| 503 | Server overloaded | Yes |
429 is your problem, 503 is not
429 means you are sending too much. Flash allows up to 2500 concurrent requests, V4 Pro up to 500. Sharing one key across many instances is the usual cause. Fix it with a global concurrency limit, not by retrying harder.
503 means the service is overloaded. Nothing about your request caused it. Avoiding peak hours (Beijing 09:00–12:00 and 14:00–18:00) meaningfully reduces how often you hit it — which is also the off-peak advice.
Backoff settings that work
delays: 1s, 2s, 4s, 8s, 16s (max 5 attempts) add +/- 20% jitter to avoid synchronised retries retry only on: 429, 500, 503 never retry on: 400, 401, 402, 422
Common 422 causes
- Model name misspelled or an old name that has been retired
max_tokensabove the model's output limit (384K)temperatureoutside 0–2- Invalid role in the messages array