Simple tool to extend Claude Code usage with automatic API fallbacks and commit tracking for code review.
- Automatic Fallbacks: When Claude hits rate limits, automatically switches to Gemini → DeepSeek → local models
- Commit Tracking: Tags commits with which model did the work for easy rollback
- Code Review Workflow: Script to review and merge/rollback work from fallback models
pip install -r requirements.txtexport ANTHROPIC_API_KEY="sk-ant-..."
export GOOGLE_API_KEY="..." # Optional: Gemini fallback
export OPENROUTER_API_KEY="..." # Optional: DeepSeek fallback
export DISCORD_WEBHOOK_URL="..." # Optional: notificationslitellm --config litellm_config.yaml --port 8000python monitor.pyIn Claude Code settings or via CLI:
# Point Claude Code at the proxy
export ANTHROPIC_API_BASE="http://localhost:8000"Or in Claude Code web app: Settings → LLM Gateway → http://localhost:8000
- Start the proxy and monitor
- Work in Claude Code as usual
- When rate limits hit, the proxy automatically switches models
- Monitor creates tagged commits for each model switch
When Claude usage returns:
# Review what each model did
python review.py --analyze
# Keep good work from a model
python review.py --accept gemini-flash
# Rollback bad work from a model
python review.py --rollback deepseek-r1Claude Code → LiteLLM Proxy → Anthropic API (T0)
↓ (rate limit)
Google API (T1)
↓ (rate limit)
OpenRouter API (T2)
When a model switches:
- LiteLLM sends webhook to monitor
- Monitor commits current work with tag
model:gemini-flash - Discord notification sent (if configured)
- Work continues on fallback model
Edit litellm_config.yaml to:
- Change model priority order
- Add/remove fallback models
- Adjust rate limit handling
- Configure notifications
Proxy won't start: Check API keys are set correctly
Claude Code not using proxy: Verify ANTHROPIC_API_BASE or LLM Gateway setting
No commits on switch: Check monitor is running and webhook URL in config
Models not falling back: Check LiteLLM logs for errors: litellm --config litellm_config.yaml --debug
- LiteLLM Proxy: Handles API routing and fallbacks
- Monitor: Webhook listener that creates commit tags
- Review Script: Git-based workflow for code review
Total code: ~150 lines Python. No databases, no complex state management.
MIT