Skip to main content

Advanced

Advanced Claude API usage — cost optimization, streaming, handling errors and rate limits, and extended thinking.

4 articles

Claude extended thinking — enabling and handling reasoning via the API

Extended thinking improves answer quality on hard problems. How to enable it via the thinking object, adaptive vs budget_tokens, summarized thinking and billing, when to use it, and pitfalls.

62

Handling Claude API errors and rate limits — 429, 529, and retries

Core to production reliability. The main error codes, 429 (limit) vs 529 (server overload), exponential-backoff retries, and how to hit limits less — per the official docs.

103

Claude API streaming — real-time output with SSE

Don't wait on a blank screen for long answers. Stream with stream:true and the SDKs to show output chunk by chunk — with the event flow and pitfalls.

70

Cutting Claude API Costs: Prompt Caching and the Batch API

Two features that cut Claude API costs: prompt caching and the Batch API. By the official pricing — cache hits at 0.1x (~90% off) and batch at 50% off — plus cache_control breakpoints, custom_id, and how the two discounts stack.

89