Re_Backend/CLAUDE_MODELS.md

135 lines
3.1 KiB
Markdown

# Claude Model Versions - Quick Reference
## ✅ Current Claude Model (November 2025)
### Claude 4 Models (Latest)
- **`claude-sonnet-4-20250514`** ← **DEFAULT & CURRENT**
- Latest Claude Sonnet 4 model
- Released: May 14, 2025
- Best for complex reasoning and conclusion generation
- **This is what your API key supports**
## ⚠️ Deprecated Models (Do NOT Use)
The following Claude 3 models are deprecated and no longer available:
-`claude-3-opus-20240229` - Deprecated
-`claude-3-sonnet-20240229` - Deprecated
-`claude-3-haiku-20240307` - Deprecated
-`claude-3-5-sonnet-20240620` - Deprecated
**These will return 404 errors.**
---
## 🎯 What Happened?
All Claude 3 and 3.5 models have been deprecated and replaced with Claude 4.
**Your API key is current and working perfectly** - it just needs the **current model version**.
---
## 🔧 How to Change the Model
### Option 1: Environment Variable (Recommended)
Add to your `.env` file:
```bash
# Use Claude Sonnet 4 (current default)
CLAUDE_MODEL=claude-sonnet-4-20250514
# This is the ONLY model that currently works
```
### Option 2: Admin Configuration (Future)
The model can also be configured via the admin panel under AI settings.
---
## 🐛 Troubleshooting 404 Errors
If you get a 404 error like:
```
model: claude-3-5-sonnet-20241029
{"type":"error","error":{"type":"not_found_error","message":"model: ..."}
```
**Solutions:**
1. **Check your `.env` file** for `CLAUDE_MODEL` variable
2. **Remove or update** any invalid model version
3. **Restart the backend** server after changing `.env`
4. **Check server logs** on startup to see which model is being used:
```
[AI Service] ✅ Claude provider initialized with model: claude-3-5-sonnet-20240620
```
---
## 📊 Current Default
The system now defaults to:
```
claude-sonnet-4-20250514
```
This is the **current Claude 4 model** (November 2025) and the only one that works with active API keys.
---
## 🔑 API Key Requirements
Make sure you have a valid Anthropic API key in your `.env`:
```bash
CLAUDE_API_KEY=sk-ant-api03-...
# OR
ANTHROPIC_API_KEY=sk-ant-api03-...
```
Get your API key from: https://console.anthropic.com/
---
## 📝 Model Selection Guide
| Use Case | Recommended Model | Notes |
|----------|------------------|-------|
| **All use cases** | **`claude-sonnet-4-20250514`** | **Only model currently available** |
| Older models | ❌ Deprecated | Will return 404 errors |
---
## 🎯 Quick Fix for 404 Errors
If you're getting 404 errors (model not found):
**Your API key likely doesn't have access to Claude 3.5 models.**
### Solution: Use Claude 3 Opus (works with all API keys)
1. **Restart backend** - the default is now Claude 3 Opus:
```bash
npm run dev
```
2. **Check logs** for confirmation:
```
[AI Service] ✅ Claude provider initialized with model: claude-3-opus-20240229
```
3. **Test again** - Should work now! ✅
### Alternative: Try Other Models
If Opus doesn't work, try in your `.env`:
```bash
# Try Sonnet (lighter, faster)
CLAUDE_MODEL=claude-3-sonnet-20240229
# OR try Haiku (fastest)
CLAUDE_MODEL=claude-3-haiku-20240307
```
Then restart backend.