
Anthropic API
Direct API access to Claude models for developers
The Anthropic API provides direct access to Claude Opus, Sonnet, and Haiku models with features like tool use, prompt caching, and batching. It offers a 1M token context window and structured outputs.
Last reviewed: · Reviewed from official documentation and product information.
Sources: Official site · Pricing · Docs · Changelog
Updated : Updated the top model to Fable 5.2 at $8/M input tokens.
Requires some technical comfort with API keys, command line, or coding. If you're new to AI, start with a chat-based tool first.
Best for
Pros & cons
Pros
What this won't do
Use cases
Building AI-powered products
Automated content pipelines
Customer support chatbots
Document analysis at scale
Get an API key
Sign up for a Claude Console account on platform.claude.com and create an API key. An API key is a secret password that lets your code use Claude.
Save the key and install
Store the key in an environment variable named ANTHROPIC_API_KEY. Then install the Python library with: pip install anthropic
Send your first message
Write a short script that asks Claude a question, using the model claude-opus-5-5 as the official quickstart does. Run it, and Claude's reply prints as text.
Keep the key out of code
The library reads ANTHROPIC_API_KEY on its own, so you never need to paste the key into your script. Keep it out of any file you share or upload.
Compare alternatives
| Tool | Category | Pricing |
|---|---|---|
| Anthropic API (current) | LLM / Assistant | Pay-per-use from $0.10/M input tokens (Haiku 5.5) |
| ChatGPT | LLM / Assistant | Free / $8 mo Go / $20 mo Plus / from $100 mo Pro |
| Claude | LLM / Assistant | Free / $20 mo |
| Google Gemini | LLM / Assistant | Free / from $4.99 mo (AI Plus) / $19.99 mo AI Pro |
| OpenAI API | LLM / Assistant | Pay-per-use from $0.10/M input tokens |