Point Claude Code at any free OpenAI-compatible backend in 30 seconds.
Claude Code reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from the environment. When you set them to a free provider, Claude Code routes API calls through that backend instead of Anthropic's paid API.
export ANTHROPIC_BASE_URL="https://api.groq.com/openai/v1"
export ANTHROPIC_AUTH_TOKEN="gsk_your_groq_api_key"Get your key at console.groq.com/keys. Recommended model: llama-3.3-70b-versatile.
export ANTHROPIC_BASE_URL="https://integrate.api.nvidia.com/v1"
export ANTHROPIC_AUTH_TOKEN="nvapi-your_nvidia_key"Get your key at build.nvidia.com. Recommended model: meta/llama-3.3-70b-instruct, deepseek-ai/deepseek-r1.
export ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1"
export ANTHROPIC_AUTH_TOKEN="sk-or-v1-your_openrouter_key"Get your key at openrouter.ai/keys. Recommended model: deepseek/deepseek-v4-flash:free.
export ANTHROPIC_BASE_URL="https://api.mistral.ai/v1"
export ANTHROPIC_AUTH_TOKEN="your_mistral_key"Get your key at console.mistral.ai/api-keys. Recommended model: codestral-latest for coding tasks.
Add to your shell profile (~/.zshrc or ~/.bashrc):
# Free LLM API backend for Claude Code
export ANTHROPIC_BASE_URL="https://api.groq.com/openai/v1"
export ANTHROPIC_AUTH_TOKEN="gsk_your_key_here"- Claude Code expects tool/capability support that not all free backends implement well. If you hit errors, try a more capable model (Llama 3.3 70B+ or DeepSeek R1).
- The "Claude" model name shown in Claude Code is cosmetic — you're actually using whichever model you configure.
- Free tiers have rate limits. Groq: 14,400 requests/day. NVIDIA NIM: 40 RPM. OpenRouter: 50 requests/day (free tier, up to 1,000 with a one-time $10 topup).
See the full Provider Directory and Quick Reference in the main README for all 33 free providers, or browse free-llm.com.