Skip to content

Claude Setup

Anthropic Claude Setup

Getting Your API Key

  1. Visit Anthropic Console
  2. Create an account or sign in
  3. Navigate to API Keys
  4. Click Create Key
  5. Copy the generated key

Free Tier

  • Limited initial credits for new accounts
  • No ongoing free tier
  • Pay-as-you-go pricing after credits are used

Environment Variables

Terminal window
export ANTHROPIC_API_KEY="your-api-key-here"

Add to your shell profile to persist:

Terminal window
echo 'export ANTHROPIC_API_KEY="your-api-key-here"' >> ~/.bashrc
source ~/.bashrc

Verify Your Setup

Test your API key:

Terminal window
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-3-haiku-20240307","max_tokens":10,"messages":[{"role":"user","content":"Hi"}]}'

A successful response returns a message from Claude. Check your key if you receive an authentication error.