Skip to main content

API

Build with the API: tool use and structured outputs

For developers building with the Claude API — from your first request to tool use, structured outputs, and per-model pricing and context windows. Content follows the official docs at platform.claude.com, and pricing/model facts are re-verified on a regular schedule.

Browse

Latest

Claude SDK Error Handling and Retries: APIError Types, max_retries, and Timeout Config

A practical guide to how the Claude API's Python and TypeScript SDKs classify errors into typed exceptions, which failures get retried automatically, and how to customize retry and timeout behavior.

72

Opus vs Sonnet: Opus 5.5 vs Sonnet 5 — Which Claude Model Should You Use?

Claude Opus 5 and Sonnet 5 differ in price, speed, context window, and thinking mode. Here's how to pick the right one in the API or the Claude.ai app.

509

How to Get a Claude Code API Key: Console Setup Guide

A step-by-step guide to generating an API key in the Claude Console and connecting it to Claude Code with an environment variable.

290

Claude API Tool Definitions: Naming and Description Rules Without the Guesswork

A beginner-friendly walkthrough of how to name and describe tools in the Claude API so Claude calls the right one at the right time, based on official documentation.

77

Claude API Pricing by Model — Input/Output Token Rates and How to Cut Costs with Batch and Prompt Caching

Compare Claude API token pricing across Opus 5, Sonnet 5, Haiku 4.5, and Fable 5.1, and learn how Batch API's 50% discount and prompt caching's up to 90% discount can lower your costs.

133

Claude API Payment Failing? Fix Credit Balance & Billing Errors (2026)

Fix Claude API payment and credit errors by error code: 400 balance-too-low, 402 billing, 429 rate limit, plus how to top up and prevent recurrence — based on official docs.

192