12. Errors and rate limits

7 cards

Review this deck
All cards in this deck

Errors not to retry

400, 401, 403, 404, 413: request or configuration errors that must be fixed.

Errors to retry with backoff

429, 500, 529, network errors; the SDK retries 2 times by default.

SDK timeout

10 minutes by default; Python uses seconds, TypeScript uses milliseconds.

What rate limits measure

RPM, ITPM, OTPM per organization and usage tier; token bucket algorithm.

Cache and ITPM

On most models, tokens read from cache do not count toward ITPM; only `input_tokens` and `cache_creation_input_tokens` count.

429 spend cap

`error_code` is `enforced_spend_limit_reached`, with no `retry-after`; retrying is useless until the limit is reopened or the tier raised.

Log for every production request

Request ID, model and effort, `stop_reason`, `usage` including cache, latency, retry count.

12. Errors and rate limits – Flashcards – Claude | Học Dev