Skip to main content

Claude API Keys: Getting a Key, Pricing & Usage (2026)

You need an API key to call Claude from code. This guide covers how to get a key, current model pricing (Sonnet 5.5, Haiku 5.5, Opus 5.5), Max/Team API credits, and key security.

ByUpdated
🌐 This article was machine-translated and may contain inaccuracies. Read the Korean original if in doubt.

To call Claude from code, you need an API key. The API is completely separate from claude.ai subscriptions (like Pro) — it's pay-as-you-go, billed per token. This guide covers where and how to get a key, what it costs, and how to keep your key safe. (For the actual first call, see the API getting-started guide.)

🟢 Model references match the current lineup · model notice · Fable subscription
🟢 Model references match the current lineup · Claude Opus 5.5 / Claude Sonnet 5.5 / Claude Haiku 5.5 (higher tier: Claude Fable 5.2). This notice changes only when Anthropic ships a new model.

Fable subscription (updated November 17, 2026): Claude Fable 5.2, released November 9, 2026, is the current Fable model; Fable 5.1 and Fable 5 are now legacy. Plan terms are the same for all three — Max and Ultra plans and premium seats on Team and seat-based Enterprise plans include Fable at up to 50% of the weekly usage limit; Pro plans and standard seats use usage credits (not available on Free). API pricing is $8/M input and $40/M output tokens for Fable 5.2, and $10/$50 for Fable 5.1 and 5. Some cybersecurity and biology requests may be answered by an Opus model due to safety classifiers. See the Fable 5.2 launch news and the Fable 5.2 guide for details.

Update (September 27, 2026): Claude Opus 5.5 was released on September 22, 2026 and is now the current Opus model (API claude-opus-5-5, $4 per million input tokens and $20 per million output tokens, down from Opus 5's $5/$25). Anthropic says it performs at the level of Fable 5.1 on most work and costs 40% less to run than Opus 5 on typical workloads. Opus 5 remains available but is marked legacy in the official model docs. Opus 5 prices and comparisons below reflect the pre-launch state and will be updated. Details: Claude Opus 5.5 complete guide.

Claude API pricing by model (per MTok) Model Input Output Haiku 5.5 (prompts ≤100K) $0.10 $0.50 Sonnet 5.5 $2 $10 Opus 5.5 $4 $20 As of Oct 2026. Haiku 5.5: $0.50/$2.50 for prompts over 100K tokens. Batch API -50%. Prices may change.

Subscription vs API

This trips people up most. Claude Free and Pro subscriptions don't include API usage. The API isn't a monthly subscription — it's pay-as-you-go, billed by the input tokens you send and output tokens you receive. Call nothing and you owe nothing.

Exception — Max and Team (since October 7, 2026): Max gets $100, Ultra $200, and Team up to $500 (pooled by seats) in Claude API credits each month. Link a Console organization under Settings → Billing → API credits on claude.ai in a browser; credits land as Promotional credits and no payment method is required. They refresh each billing cycle, don't roll over, and can't be used for Claude Code or app extra usage (official doc API credits for Max and Team plans, checked October 26, 2026). Note: since October 30, 2026, Max 5x is called Max and Max 20x is called Ultra (same prices; existing subscribers moved automatically). See Max vs Ultra.

How to get an API key

  1. Sign up / log in at platform.claude.com (the developer console). New accounts usually get a small amount of free credit, though the amount and terms can change.
  2. Add a payment method and top up credits. New accounts start on prepaid credits with optional auto-reload; higher-usage accounts can switch to monthly invoicing.
  3. Create a key under API Keys. The key value is often shown only once, so store it somewhere safe immediately.

Pricing by model

Pricing bills input tokens (your prompt/context) and output tokens (Claude's reply) separately, and output is ~5x input across all current models. Current models and prices (official docs, October 26, 2026) are below; Haiku 5.5 is the only one with tiered pricing by prompt length.

  • Haiku 5.5 (from $0.10/$0.50; $0.50/$2.50 for prompts over 100K tokens): cheapest and fastest, released October 7, 2026; great for classification, extraction and high-volume work. Model ID claude-haiku-5-5. Its tokenizer counts the same text as ~30% more tokens than Haiku 4.5, and sampling parameters and prefill return errors.
  • Sonnet 5.5 ($2/$10): the current Sonnet, released September 28, 2026 — same price as Sonnet 5 with cache reads halved to $0.10, and the recommended default for most work. Model ID claude-sonnet-5-5 (Sonnet 5 is claude-sonnet-5, legacy). To turn thinking off, use between_tools instead of disabled.
  • Opus 5.5 ($4/$20): for complex coding, reasoning and long agentic work. Model ID claude-opus-5-5. The top tier above it is Fable 5.2 ($8/$40, released November 9, 2026).
  • Previous generation (Haiku 4.5 $1/$5, Sonnet 5 $2/$10, Opus 5 $5/$25) remains available as legacy. Sonnet 4.5 (claude-sonnet-4-5-20250929) retires on November 30, 2026.

Cutting costs

  • Prompt caching: cache long, repeated prefixes for up to 90% off cached input.
  • Batch API: process non-urgent work in bulk for a flat 50% discount.
  • Use the right model. Sending simple tasks to Opus is a common source of overspend. Combining caching and batch helps a lot.

Rate limits

The API has per-minute request and token limits that increase by tier based on your payment and usage history. Check the limits page in the console for exact numbers. Exceeding a limit returns a 429 error.

Key security — don't skip this

  • Keep keys in environment variables, e.g. export ANTHROPIC_API_KEY="sk-ant-..."
  • Never commit keys to code or Git. A public repo can get a key stolen instantly.
  • Rotate keys periodically; if you suspect exposure, revoke and reissue in the console immediately.
  • Never put keys in front-end (browser) code — call only from your server.
How to protect your API keyNot in codeNo git commits,no frontendUse env vars.env / secretmanagersNever shareNot via chat,screenshots, emailIf leakedRevoke at once,reissue a new keyTreat keys like passwords — a leak lets others run up charges

Next steps

Once you have a key, see the API getting-started guide for the first request/response. For billing or key issues, use the platform.claude.com console and official docs.

Disclaimer: Pricing, free credits, and limit policies change often. The figures here (Haiku 5.5 from $0.10/$0.50, Sonnet 5.5 $2/$10, Opus 5.5 $4/$20, Fable 5.2 $8/$40, batch -50%, Max/Team monthly API credits) reflect Anthropic's official docs as of October 26, 2026 (Fable 5.2 as of November 10); check platform.claude.com for the latest. This site is not affiliated with Anthropic.

See also: Claude Model Comparison Guide

Related: Billing and subscription guide · Usage limits guide · Free plan guide

Was this helpful?

Keep reading