What you get and what you do not get
Claude Code sends each request to an API in Anthropic's format. FreeLLMAPI speaks that format on /v1/messages. It translates each request and sends it to a free model, for example Gemini, GPT-OSS, Qwen or GLM.
- You get: the Claude Code interface, its tools, file edits and agent loop, on free models.
- You do not get: Anthropic's Claude models. No provider gives the Claude models free through an API. Read Is there a free Claude API? for the details.
- Cost: $0 for inference. The free tiers have rate limits. FreeLLMAPI moves to the next provider when one limit stops a request.
Step 1: Install FreeLLMAPI
FreeLLMAPI is open source. It runs on your computer in Docker. Your provider keys stay on your computer.
macOS or Linux
curl -fsSL https://freellmapi.co/install.sh | bashOpen the dashboard at http://localhost:3001. Add at least two free provider keys on the Keys page. Google AI Studio and Groq each give a free key in about one minute. Copy your unified key from the same page.
Step 2: Connect Claude Code
The fastest method is the setup command. It reads your live catalog, makes a backup of ~/.claude/settings.json and adds the gateway settings.
One command
npx freellmapi setup-claude --url http://localhost:3001 --api-key <unified-key>To set it up manually, set two environment variables and start Claude Code:
Manual setup (macOS or Linux)
export ANTHROPIC_BASE_URL=http://localhost:3001
export ANTHROPIC_AUTH_TOKEN=<unified-key>
claudeManual setup (Windows PowerShell)
$env:ANTHROPIC_BASE_URL="http://localhost:3001"
$env:ANTHROPIC_AUTH_TOKEN="<unified-key>"
claudeANTHROPIC_AUTH_TOKEN. Do not use ANTHROPIC_API_KEY. If ANTHROPIC_API_KEY is set, Claude Code sees a conflicting credential and does not start.To make sure that the requests go to the gateway, run npx freellmapi doctor. Each response also has an X-Routed-Via header. This header shows the provider and model that answered.
Step 3: Choose models for agent work
Claude Code sends long prompts. A typical request has a large system prompt, tool definitions and file contents. Use models with tool calling and a large context window. Small free tiers with low tokens per minute fail on these requests.
On the Keys, Anthropic tab, map each Claude family (opus, sonnet, haiku) to auto or to a model. With auto, the router selects a free model for each request. The table shows free models with tool calling and at least 128K context, from today's catalog.
| Model | Free on | Context | Free limits (best offer) | Tools | Vision |
|---|---|---|---|---|---|
| GLM 5.3 | UnoRouter | 1M | 1 req/min 1 req/min per model | Yes | No |
| GLM 5.3 Flash | NVIDIA NIM, UnoRouter | 1M | 40 req/min 40 RPM | Yes | Yes |
| Gemini 3.8 Flash | Google AI Studio | 1M | Recurring provider quota | Yes | Yes |
| Qwen3.8 Flash Next | AMD Radeon Cloud | 262K | Recurring daily account allowance | Yes | No |
| Qwen3.8 Flash | ElectronHub | 1M | $0.25/week shared recurring credit | Yes | Yes |
| Gemini 3.7 Flash | Google AI Studio | 1M | 10 req/min 20 req/day 250,000 tokens/min ~3M | Yes | Yes |
| GPT-5.6 Luna | ElectronHub | 1M | $0.25/week shared recurring credit | Yes | Yes |
| Dots3 Note Preview | Kilo Gateway, OpenRouter | 512K | 20 req/min 50 req/day 50 req/day account-wide (1,000 after a $10 purchase) | Yes | Yes |
| DeepSeek V4 Flash | AMD Radeon Cloud, BazaarLink, ElectronHub | 1M | 10 req/min 50 req/day Shared rate limit | Yes | No |
| Qwen3.8 27B | ElectronHub, Groq, OVH AI Endpoints | 262K | 30 req/min 250 req/day 70,000 tokens/min ~6M | Yes | Yes |
| Gemini 3.6 Flash | Google AI Studio | 1M | 10 req/min 20 req/day 250,000 tokens/min ~3M | Yes | Yes |
| Qwen 3.8 27B | Cloudflare Workers AI | 262K | Shared 10k neurons/day | Yes | Yes |
Showing 12 of 109 matching free models. See all models.
Live data from the FreeLLMAPI catalog (version 2026.11.19, checked 19 November 2026). Free limits change often. The catalog is checked every day.
Rate limits and how failover helps
One Claude Code task can send 20 to 100 requests. A single free tier stops you fast. For example, a free Gemini Flash key allows few requests per day. FreeLLMAPI keeps a count of each key's quota. When a provider sends a 429 error, the router tries the next provider in the pool. Your Claude Code session continues.
- Add keys from four or more providers. More keys give more requests per day.
- Map
haikuto a fast small model. Claude Code uses it for short background tasks. - Keep the context small. Use
/clearbetween tasks to send fewer tokens.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Claude Code asks you to log in | The environment variables are not set in this shell | Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, then start claude again |
| "Conflicting credential" or no start | ANTHROPIC_API_KEY is set | Remove it with unset ANTHROPIC_API_KEY |
| Error 429 on every request | All your provider keys are at their limit | Add keys from more providers on the Keys page |
| Tool calls fail or the agent stops | The model does not support tool calling well | Map the family to a model from the table above |
| Requests are slow | Large prompts on a slow free model | Pin a fast model, for example a Groq or Cerebras model |
Frequently asked questions
Is Claude Code free to use?
The Claude Code program is free to install. It needs a model API to work. With FreeLLMAPI, it uses free provider tiers, so inference costs $0.
Do I get the real Claude models for free?
No. Anthropic does not give a free Claude API. Claude Code runs on other free models, for example Gemini, GPT-OSS, Qwen or GLM, through the Anthropic-format endpoint.
Why use ANTHROPIC_AUTH_TOKEN and not ANTHROPIC_API_KEY?
Claude Code sends ANTHROPIC_AUTH_TOKEN as a Bearer token to your gateway. If ANTHROPIC_API_KEY is set, Claude Code treats it as a first-party credential and refuses to start.
Which free model is best for Claude Code?
Use a model with tool calling and a context window of 128K tokens or more. The table on this page shows the strongest free models that meet both rules today.
Does this work on Windows?
Yes. Set the two variables in PowerShell with $env:ANTHROPIC_BASE_URL and $env:ANTHROPIC_AUTH_TOKEN, then start claude.
Related guides
- Is there a free Claude API?
- Best free coding model APIs
- Use Codex CLI with free models
- Cline, Roo Code and Kilo Code with a free API
- Free LLM API rate limits
Sources
- FreeLLMAPI docs: Anthropic and Claude clients (checked 20 November 2026)
- FreeLLMAPI CLI generators (checked 20 November 2026)
- Claude Code documentation: LLM gateway configuration (checked 20 November 2026)