Claude API
7 cheat sheets
Claude API#
The Anthropic Claude API — Python and TypeScript SDKs, streaming, tool use, batch processing, prompt caching, the Files API, and complete agentic-loop patterns.
What’s in this section#
| Page | Topics |
|---|---|
| Python SDK | SDK quickstart, streaming, vision, PDFs, retries, async, recipes |
| TypeScript SDK | Node / Deno / Bun / Workers, typed events, zod-validated tools |
| Streaming | SSE events, async iteration, partial tool input, retry strategies |
| Tool Use | Function calling schema, parallel tools, agentic loops, tool_choice |
| Batch API | 50%-off bulk processing, polling, results, cost math |
| Prompt Caching | cache_control, 5-min and 1-hour TTL, multi-layer breakpoints |
| Files API | Upload PDFs/images/text, reference by file_id, citations |
Sections#
- Python SDK — Full Anthropic Python SDK reference: installation, message API, streaming, images, PDFs, batch, caching, extended thinking, retries, async, FastAPI integration.
- TypeScript SDK —
@anthropic-ai/sdkon Node, Deno, Bun, Cloudflare Workers; types, streaming, tool use, vision, Bedrock and Vertex variants. - Streaming — Server-sent events, async iteration, partial tool input, abort/cancel, retry strategies in Python and TypeScript.
- Tool Use — Define tools, interpret tool-use blocks, build agentic loops, handle errors, parallel tools, forced extraction.
- Batch API — Submit up to 100K requests per batch at 50% cost; poll, retrieve, retry failures, stack with caching.
- Prompt Caching —
cache_control, 5-minute and 1-hour TTLs, breakpoints, cost math, multi-layer patterns. - Files API — Upload PDFs, images, text once and reference by file_id; citations, lifecycle, RAG patterns.
no sheets match the selected filters