Step 1: Create an Anthropic Account

Navigate to console.anthropic.com and click "Sign up" or "Continue with Google". You can register with email or Google SSO. Anthropic does not currently offer Microsoft or Apple sign-in.
During signup, you'll:
- Verify your email through a confirmation link
- Provide basic information about yourself or your organization
- Describe your intended use case for the Claude API
- Accept Anthropic's usage policy
Step 2: Access the Anthropic Console

API access is self-serve. Once you've verified your email, you can generate keys immediately. There's no manual approval queue for standard developer accounts.
The console is where you'll manage:
- API key generation and rotation
- Usage and cost monitoring
- Billing and payment settings
- Workspaces and team access
- Rate limits and tier upgrades
Step 3: Where to Find Your Anthropic API Key

In the left sidebar of the console, click Settings → API keys (or go directly to console.anthropic.com/settings/keys).
The API keys page shows:
- All existing keys with creation dates and last-used timestamps
- The workspace each key belongs to
- Permissions and scopes (read-only, full access, etc.)
- Buttons to create, rotate, or revoke keys
Step 4: Create a New Claude API Key

Click "Create Key" and configure:
- Name: descriptive, like "Production API", "Staging", or "Local Dev". You'll thank yourself later when you're auditing usage.
- Workspace: if you're in multiple workspaces, pick the right one. Keys are scoped to a single workspace.
- Permissions: choose between full access or read-only depending on what the key needs to do.
Step 5: Copy and Save Your Anthropic API Key
The key is shown once. Anthropic does not store the secret value. Close the dialog without copying and you'll need to revoke and regenerate.
Claude API keys start with sk-ant- followed by a long alphanumeric string. The fastest way to use it is to set it as an environment variable:
export ANTHROPIC_API_KEY="sk-ant-..."
For longer-term storage:
- Use
.envfiles in development (and add.envto.gitignore) - Use a secrets manager in production (AWS Secrets Manager, HashiCorp Vault, GCP Secret Manager, Azure Key Vault)
- Never commit keys to Git, even in private repos
- Never paste keys into Slack, email, or shared docs
Step 6: Set Up Billing
You need a payment method on file before requests will succeed.
- In the console, go to Settings → Billing
- Add a credit or debit card. Enterprise accounts can request invoice billing through their account team.
- Configure spend controls:
- Set a monthly budget cap
- Add usage alerts at 50%, 75%, and 90% thresholds
- Review the Claude pricing page for per-million-token rates
As of May 2026, Claude Opus 4.7 sits at $5/$25 per million input/output tokens, Sonnet 4.6 at $3/$15, and Haiku 4.5 at $1/$5. Batch processing is 50% off across the board, and prompt caching cuts cached input cost by 90%.
Step 7: Test Your Claude API Key
With your key set as an environment variable, run a single curl request:
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-4-6",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, Claude!"}
]
}'
Two things that trip people up coming from OpenAI:
- The header is
x-api-key, notAuthorization: Bearer. Anthropic uses a custom header. - The
anthropic-versionheader is required on every request.
A successful response returns Claude's reply in JSON. The full reference is in the Claude API documentation.
Is the Claude API Free?
No. Like the OpenAI API, the key itself is free to generate but using it costs per token. New accounts sometimes get a small one-time credit allocation. There is no free tier in the ongoing sense.
If you want to try Claude without paying for API access, the Claude web app at claude.ai has a free tier with daily message limits. The web app is a separate product from the API and does not give you programmatic access.
Which Claude Model Should You Use?
The current production lineup as of May 2026:
- Claude Opus 4.7 (April 2026, current flagship): the most capable model. Strong at long-running coding, agentic tasks, and complex reasoning. Use it when quality matters more than cost.
- Claude Sonnet 4.6 (February 2026): the daily driver for most teams. Roughly 40% cheaper than Opus, fast, and competitive on most tasks. Default to this unless you have a specific reason not to.
- Claude Haiku 4.5 (October 2025): cheap and fast. Good for high-volume pipelines, classification, simple extraction. Note: Haiku has limited prompt injection protection. Don't use it for agentic workflows that process untrusted input.
All three support the 200K context window by default. Opus 4.7 and Sonnet 4.6 support 1M tokens at flat rates with no surcharge.
In the API, you reference models by their model string (e.g. claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5). Check the models overview page for the current list.
Anthropic API Key Format
Claude API keys all start with the prefix sk-ant- followed by alphanumeric characters and dashes. If your key doesn't match that pattern, it's either malformed or from another provider. Project-scoped keys may have additional sub-prefixes like sk-ant-api03-.
Security Best Practices
A leaked Anthropic API key on a public repo can drain a budget overnight. The basics:
- Rotate keys quarterly, not just when you suspect a leak
- Use a different key per environment. Dev, staging, and prod should never share a key
- Restrict permissions. Read-only keys for monitoring tools, full-access keys only where required
- Monitor usage daily through the console
- Set a hard monthly budget cap so a runaway loop can't bankrupt you
Migrating from OpenAI to Claude
If you're switching providers:
| OpenAI | Anthropic | Gemini | Grok | Perplexity | |
|---|---|---|---|---|---|
| Auth header | Authorization: Bearer | x-api-key | x-goog-api-key | Authorization: Bearer | Authorization: Bearer |
| Endpoint | api.openai.com/v1/responses | api.anthropic.com/v1/messages | generativelanguage.googleapis.com/v1beta/... | api.x.ai/v1/chat/completions | api.perplexity.ai/chat/completions |
| Request shape | messages array | messages + system | contents with parts | messages (OpenAI-compatible) | messages (OpenAI-compatible) |
| Env var | OPENAI_API_KEY | ANTHROPIC_API_KEY | GEMINI_API_KEY | XAI_API_KEY | PERPLEXITY_API_KEY |
| Key format | sk-... | sk-ant-... | AIza... | xai-... | pplx-... |
| Built-in web search? | no | no | no | optional via tools | yes (Sonar) |
| Citations included? | no | no | no | optional | yes (Sonar) |
| OpenAI SDK works? | ✓ | ✗ | ✗ | ✓ | ✓ |
The official Anthropic SDKs (Python, TypeScript, Java, Go) read ANTHROPIC_API_KEY automatically, so you don't pass the key in code.
Troubleshooting Common Errors
401 authentication_error: invalid x-api-key — The key is wrong, expired, or revoked. Check the header name (x-api-key, not Authorization), check for trailing whitespace, and regenerate at console.anthropic.com/settings/keys if needed.
400 invalid_request_error: model: ... — The model string is wrong or your account doesn't have access. New flagship models often roll out to higher tiers first. Check available models in your console.
429 rate_limit_error — You're sending requests faster than your tier allows. Implement exponential backoff. Tier upgrades happen automatically based on spend history.
529 overloaded_error — Anthropic's servers are temporarily over capacity. Retry with backoff. Not your fault.
400 invalid_request_error: max_tokens — max_tokens is required on every request. OpenAI lets you skip it; Anthropic doesn't.
FAQ
Where do I find my Anthropic API key? At console.anthropic.com/settings/keys. Existing keys are listed there, but the secret value is only shown once at creation. If you've lost a key, revoke it and create a new one.
How do I get an Anthropic API key for the first time?
Sign up at console.anthropic.com, verify your email, complete the profile questions, then go to Settings → API keys → Create Key. Copy the sk-ant-... string immediately. The flow is self-serve and takes about three minutes.
Is the Claude API key free? The key is free to generate. Using it is not. You need a payment method on file. The free tier is on the claude.ai web app, not the API.
What's the difference between the Claude API and Claude.ai? The API is for developers building applications. claude.ai is the chat interface for end users. They share the same underlying models but use separate accounts, separate billing, and separate rate limits.
Can I use a Claude API key with Amazon Bedrock or Google Vertex AI? No. Bedrock and Vertex use AWS / Google Cloud authentication, not Anthropic API keys. The Claude models are the same, but the auth flow is different. Useful if you already have AWS or GCP procurement set up.
Do I need a separate key for Claude Code? No. Claude Code uses your Anthropic account. You can either authenticate it with your API key or sign in with your Anthropic account directly. Usage rolls up to the same billing.
What does an Anthropic API key look like?
A string starting with sk-ant- followed by alphanumeric characters. Don't share it. If you see one in a public repo, that's a leak.
How do I set the ANTHROPIC_API_KEY environment variable in Python?
export ANTHROPIC_API_KEY="sk-ant-..."
Then in Python:
from anthropic import Anthropic
client = Anthropic() # picks up the env var automatically
Next Steps
With your key working, the Anthropic docs are the source of truth for what to build:
If you're integrating Claude across multiple SaaS tools (CRM, accounting, HRIS, file storage), look at how unified APIs reduce per-vendor integration work.
Ready to get started?
Scale your integration strategy and deliver the integrations your customers need in record time.








