Claude API Error Handling and Retry — Distinguishing Transient, Permanent, and Format Errors + Exponential Backoff
What errors should I handle, and how, to build a reliable LLM service? I classify errors into transient / permanent / user input / response format categories, and practice through 4 stages: basic try-except wrapper → Exponential backoff → Anthropic SDK built-in retry → JSON response validation.