Overview
To use Claude models (Claude 4.6 Opus, Claude 4.5 Sonnet, etc.) with AgentClaw, you need an API key from Anthropic.
Step 1: Create Anthropic Account
- Go to console.anthropic.com
- Click "Sign Up"
- Enter your email and create password
- Verify your email address
- Complete organization setup
Step 2: Add Credits
Anthropic uses a prepaid credit system:
- In the console, go to "Billing"
- Click "Add Credits"
- Enter amount ($10 minimum recommended)
- Add payment method
- Complete purchase
Note: Credits don't expire. Enable auto-reload to avoid interruptions.
Step 3: Create API Key
- Navigate to "API Keys" in the console
- Click "Create Key"
- Give your key a name (e.g., "AgentClaw Bot")
- Click "Create Key"
- Important: Copy the key immediately - you won't see it again!
Step 4: Add Key to AgentClaw
- Go to your AgentClaw instance configuration
- Add environment variable:
- Name:
ANTHROPIC_API_KEY - Value: Paste your key (starts with
sk-ant-)
- Name:
- Optionally set model:
AI_MODEL=claude-4.5-sonnet - Save and restart instance
Available Claude Models
- claude-4.6-opus: Most capable, best for complex reasoning (~$0.015/$0.075 per 1K tokens)
- claude-4.5-sonnet: Balanced performance and cost (~$0.003/$0.015 per 1K tokens)
- claude-4.5-haiku: Fast and cost-effective (~$0.00025/$0.00125 per 1K tokens)
Check anthropic.com/pricing for current rates.
Managing Credits and Usage
Monitoring Usage
- Go to "Usage" in Anthropic Console
- View credit balance and daily usage
- See breakdown by model
- Export usage reports
Auto-Reload
Prevent service interruptions:
- Go to "Billing"
- Enable "Auto-reload"
- Set threshold (e.g., reload when balance < $10)
- Set reload amount
Budget Alerts
- Set up email notifications for low balance
- Monitor daily to avoid surprises
Best Practices
- Start small: Begin with $10-20 to test
- Enable auto-reload: Prevents service interruption
- Use different keys for different projects: Easier tracking
- Never commit keys to code: Keep them secure
- Rotate keys periodically: Every few months for security
- Monitor daily: Check usage regularly
Revoking Keys
If a key is compromised:
- Go to "API Keys" in console
- Find the compromised key
- Click "Delete"
- Create a new key
- Update AgentClaw configuration
- Restart instance
Troubleshooting
"Invalid API key" Error
- Verify key starts with
sk-ant- - Check for extra spaces
- Ensure key hasn't been deleted in console
"Insufficient credits" Error
- Check balance in Anthropic Console
- Add more credits
- Enable auto-reload
Rate Limiting
- Anthropic has tier-based rate limits
- Higher usage = higher tier automatically
- OpenClaw handles retries automatically
Free Credits
New Anthropic accounts may receive promotional credits. Check your billing page for available credits.
Next Steps
- Compare with OpenAI vs Anthropic
- Learn about switching between providers
- Read about environment variables
- See adding API keys securely