Complete walkthrough for creating an Anthropic Claude API key in 2026 — console signup, payment method, key creation, security best practices, and your first call in Python and Node.js. The fastest path from zero to a working Claude integration.
Quick Answer
To get a Claude API key in 2026: sign up at console.anthropic.com, add a payment method, click API Keys → Create Key, and copy the value. The key is shown only once. Store it as an environment variable (never in source). New accounts receive $5–$20 in free credits to test.
Step 1: Sign up at console.anthropic.com
Visit console.anthropic.comand sign up with email or Google SSO. The console is separate from claude.ai (the chat product) — make sure you're creating a developer account, not just a Claude.ai login.
Step 2: Add a payment method
Navigate to Plans & Billing. Add a credit card. This is required even to use free credits — Anthropic uses the card to verify identity. Set a monthly spend limit right away (Settings → Billing → Set limit). Recommended: $20–$50 cap during initial development to prevent runaway loops.
Step 3: Create the API key
- Click API Keys in the left nav.
- Click Create Key.
- Name it descriptively — "production", "staging", "dev-laptop".
- Copy the key string the moment it appears. You will not see it again.
- Click Done.
Step 4: Store the key securely
- Local development:
.envfile (gitignored), accessed viaprocess.env.ANTHROPIC_API_KEYoros.environ["ANTHROPIC_API_KEY"]. - Vercel: Project Settings → Environment Variables → Add
ANTHROPIC_API_KEY. - AWS / cloud: AWS Secrets Manager, GCP Secret Manager, or 1Password Secrets Automation.
- Never: hard-code in source, paste into client-side JS, commit to git, or share in Slack/email.
Step 5: Your first API call
Python
# pip install anthropic
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY from env
message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello, Claude. One sentence: what is n8n?"}
],
)
print(message.content[0].text)Node.js / TypeScript
// npm install @anthropic-ai/sdk
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic(); // reads ANTHROPIC_API_KEY from env
const message = await client.messages.create({
model: 'claude-sonnet-4-6',
max_tokens: 1024,
messages: [
{ role: 'user', content: 'Hello, Claude. One sentence: what is n8n?' },
],
});
console.log(message.content[0].text);Key security best practices
- Rotate keys every 90 days.
- Use separate keys per environment (prod / staging / dev).
- Set monthly spend limits in console.
- Enable IP allow-listing on production keys (Settings → Security).
- If a key leaks: revoke immediately via API Keys → ⋯ → Delete. Anthropic also auto-detects keys pushed to public GitHub.
What to build next
With your key working, next review Claude API pricing and cost controls, then learn how API tools fit into the service stack in AI Automations Reimagined.
Adjacent: build your first AI app, Claude vs GPT-4, and the full AI Automation library.