2.5 KiB
2.5 KiB
🤖 Setup Anthropic (Claude) for TradingAgents
Your company VPN blocks OpenAI, but Anthropic (Claude) works perfectly! 🎉
✅ Test Results Summary
- ✅ Anthropic (Claude) - Fully accessible and working
- ❌ Google (Gemini) - Blocked by company proxy
- ❌ OpenRouter - Blocked by Zscaler firewall
- ❌ Ollama - Not installed (local option)
🔑 Step 1: Get Anthropic API Key
- Go to: https://console.anthropic.com/
- Sign up or sign in
- Navigate to "API Keys" section
- Click "Create Key"
- Copy your API key (starts with
sk-ant-...)
📝 Step 2: Update .env File
Replace the placeholder in your .env file:
# Change this line:
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# To your actual key:
ANTHROPIC_API_KEY=sk-ant-your-actual-key-here
🧪 Step 3: Test Your Setup
Run the test script to verify everything works:
./test_ai_providers.py
You should see: ✅ Anthropic (Claude) - FULLY WORKING
🚀 Step 4: Run TradingAgents
Start the TradingAgents CLI:
source venv/bin/activate.fish
python -c "from cli.main import app; app()"
When prompted, select:
- LLM Provider:
Anthropic - Quick-Thinking Model:
Claude Haiku 3.5 - Deep-Thinking Model:
Claude Sonnet 3.5orClaude Sonnet 4
💰 Pricing
Claude is very affordable:
- Haiku 3.5: ~$0.25 per 1M tokens
- Sonnet 3.5: ~$3 per 1M tokens
- Opus 4: ~$15 per 1M tokens
For typical trading analysis: ~$0.10-$0.50 per analysis
🎯 Available Models
Quick-Thinking (Fast):
claude-3-5-haiku-latest- Fast and cost-effectiveclaude-3-5-sonnet-latest- Balanced performance
Deep-Thinking (Advanced):
claude-3-5-sonnet-latest- High-quality analysisclaude-3-7-sonnet-latest- Advanced reasoningclaude-sonnet-4-0- Premium performance
🛠️ Troubleshooting
If you see "Connection Error":
- Check your API key is correctly set in
.env - Restart your terminal/shell
- Re-run the test script
If you see "Invalid API Key":
- Verify the key starts with
sk-ant- - Make sure there are no extra spaces
- Generate a new key if needed
If TradingAgents won't start:
- Make sure virtual environment is activated
- Check that all dependencies are installed
- Run
pip install -e .to reinstall
✨ Success!
Once setup, you'll have:
- ✅ Full TradingAgents functionality
- ✅ High-quality AI analysis from Claude
- ✅ Works around company VPN restrictions
- ✅ Affordable pricing
Ready to analyze some stocks! 📈