Skip to content
trending

AI Tools

Claude API: Pricing, API Keys and Your First Request

Learn how to get a Claude API key, understand model pricing, reduce costs with prompt caching and batch processing, and send your first request.

By 5 min read
Claude API: Pricing, API Keys and Your First Request

Update (9 Nov 2026): Claude Fable 5.2 and Mythos 5.2 are out - prices, access and benchmarks are in my Claude Fable 5.2 guide.

👁 115 reads

Claude API lets you use Anthropic models in your own code. You pay for tokens rather than a subscription, and choose which model handles each task. You can get an API key in Console in a few minutes, and your first request takes just a few lines of Python. The more complicated part is pricing: five models, prompt caching, batch processing and rate-limit tiers. Here’s how it works, with three cost examples and a comparison with OpenAI and Gemini.

At a glance

The lowest-cost capable option is Claude Haiku 4.5 at $1 per million input tokens and $5 per million output tokens. For most tasks, Sonnet 5 at $2 and $10 is enough. New accounts receive a small pool of free credits for testing; after that, you add funds in advance by card, in US dollars. The API makes sense when you’re building something of your own or processing lots of documents. For everyday conversations, the $20 Pro subscription is cheaper: that amount buys about 2 million Sonnet output tokens through the API, and no more.

What are Claude API and Console?

Console (platform.claude.com) is Anthropic’s developer dashboard. You use it to create an organization, generate API keys, add credits and check usage. The API endpoint, api.anthropic.com, is where your program sends messages and receives responses. It’s separate from claude.ai: a Pro or Max subscription doesn’t include API credits, and API credits don’t include a subscription. API usage is billed commercially, and your data is not used to train models by default.

Claude Code works with either a Pro or Max subscription or an API key. For a cost comparison, see subscription or API.

How to create an account, get a key and add funds

  1. Create an account at platform.claude.com using email or a Google account, then provide an organization name.
  2. In the API Keys tab, click “Create Key,” give the key a name and copy it straight away: Console shows it only once. Store it in an environment variable, never in code you commit to a repository.
  3. Under Billing, add a card and buy credits. Payment is in advance, in USD.
  4. Check your tier under Rate limits.

The tiers are currently called Start, Build, Scale and Custom. New organizations may begin at the Evaluation tier, with lower limits than standard tiers. Limits increase automatically as usage history builds. Monthly spending limits are $500 for Start, $1,000 for Build and $200,000 for Scale. At the Start tier, Sonnet 5 has a limit of 1,000 requests and 2 million input tokens per minute, which is more than enough for a small application.

Claude API pricing

Prices per million tokens, from the official documentation, excluding VAT:

Model Input Output Cache reads
Claude Haiku 4.5 $1 $5 $0.10
Claude Sonnet 5 $2 $10 $0.20
Claude Opus 5.5 $4 $20 $0.20
Claude Opus 5 $5 $25 $0.50
Claude Fable 5.1 $10 $50 $0.25

Three features can lower your bill. Prompt caching: writing to the cache costs 1.25 times the input rate for a five-minute cache, or twice the rate for an hour. Cache reads cost 10% of the input rate, and even less for Opus 5.5 and Fable 5.1. Caching pays off from the first cache hit. Batch API: requests that can wait hours for processing cost 50% less for both input and output. A 1-million-token context window is available at the standard price in models from 4.6 onward. Note that models from 4.7 onward count about 30% more tokens for the same text than Sonnet 4.6 and earlier models. Web search costs an additional $10 per 1,000 searches.

Here are three cost examples based on the pricing table:

  • Website chatbot, with 1,000 conversations a month, each using 3,000 input tokens and 500 output tokens on Sonnet 5: 3 million input tokens ($6) plus 0.5 million output tokens ($5) comes to $11.
  • Processing 500 documents of 20,000 tokens each, with 1,000 output tokens per document on Haiku 4.5: $10 plus $2.50, or $12.50; batch processing brings the cost to about $6.25.
  • Coding agent on Opus 5.5, handling 200 tasks with 100,000 context tokens each (80% from cache) and 5,000 output tokens: $16 for fresh input, $3.20 for cache reads and $20 for output, for a total of about $39.

Your first Claude API request: Python and curl

Set your key in the ANTHROPIC_API_KEY environment variable, install the library with pip install anthropic, then run:

import anthropic

client = anthropic.Anthropic()
message = client.messages.create(
    model="claude-sonnet-5",
    max_tokens=500,
    messages=[{"role": "user", "content": "Translation of the original Polish example prompt: Summarize in three sentences what the GDPR is."}],
)
print(message.content[0].text)
print(message.usage)

The prompt shown in the code is an English translation of the original Polish example, not a newly tested English prompt. The same request in curl:

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-5","max_tokens":500,
       "messages":[{"role":"user","content":"Translation of the original Polish example prompt: Summarize in three sentences what the GDPR is."}]}'

The usage field in the response reports the number of input and output tokens, so you can calculate the cost straight away. Common errors: 401 means the key is invalid; 429 means you’ve exceeded a per-minute limit (the retry-after header tells you how long to wait) or your monthly spending limit; 400 with a message about “specified API usage limits” means you’ve reached your own limit set in Billing. You can see usage by model and key in the Usage tab. To give a model tools, read about building agents with Claude API and MCP.

Claude API vs. OpenAI and Gemini API

Provider and model Input per 1 million tokens Output per 1 million tokens Free tier
Anthropic, Sonnet 5 $2 $10 Small starter credits
Anthropic, Opus 5.5 $4 $20 As above
OpenAI, gpt-6-sol $2 $10 No standing free tier
OpenAI, gpt-6-luna $0.10 $0.50 As above
Google, Gemini 3.1 Pro (up to 200,000 tokens) $2 $12 Free tier with limits
Google, Gemini 3.8 Flash (promotion through the end of 2026) $0.75 $3.75 Free tier with limits

All three providers offer a 50% batch discount and prompt caching. The difference is the free tier: Gemini has an ongoing free tier, with data used to improve products, while Anthropic and OpenAI do not. Our view: when prices are similar, choose based on how well a model performs on your task, not on the price list.

Frequently asked questions

Can you use Claude API for free?

New users get a small pool of free credits for testing. There is no ongoing free tier like the one available with Gemini API.

Does data sent through the API train the model?

No. The API is commercially billed, and customer data is not used for training by default. Standard data retention is 30 days; businesses can negotiate zero retention.

Which model should you start with?

Sonnet 5. It costs five times less than Fable 5.1 and is enough for most text tasks. Choose Haiku 4.5 for classification and large-scale processing, and Opus 5.5 for complex reasoning and long-running agent tasks. See our guide to Claude pricing for more.

Kinetyra

// read next

More on this from QUANTSLANT

Piotr Olszewski

Editor and publisher · Quantslant

I edit and publish Quantslant. AI tools help with research, drafts and translation; choosing topics, running the tests, checking facts and the decision to publish are mine, and so is the responsibility for what appears here.

read nextai toolsInVideo AI Pricing, Credits, Video Models and App (2026)A guide to InVideo AI’s plans, monthly credits, video models and mobile app, with euro prices and approximate USD conversions checked on October 18, 2026.

Most read

  1. 1Best AI Video Generator Apps for Your Phone (2026)
  2. 2Claude Opus 5.5 Motion Graphics: 60s Showreel from One Prompt
  3. 3Wan 2.2 on RTX 4090: timings, VRAM and four test clips
// site map

This page in other languages9

Quantslant in numbers 1,423posts in archive22news from the last 7 days18video models in the observatory
🎬 AI Video Benchmarks: Higgsfield DoP vs OpenAI Sora • Higgsfield vs Runway Gen-3 • AI Video Credit Calculator
× ‹ enlarge ›