Coding agents in the terminal

Use Claude Code for free

Claude Code is Anthropic's coding agent for the terminal: it reads your repository, edits files and runs commands.

•Settings taken from the router's own recipes

Quick answer

Install Free-LLM Router, then give Claude Code its address. Where: One command writes the settings into ~/.claude/settings.json. Model: auto:coding.

Why Claude Code and free plans need a go-between

The program is free to install, but it expects Anthropic's paid models. It also speaks the Anthropic Messages format, while almost every free provider speaks the OpenAI format, so pasting a Groq or Gemini address into it does not work. The router sits in between: it accepts Claude Code's requests as they are and answers them with free models.

Option 1: through Free-LLM Router

The router is a small open-source program that runs on your computer. Tools talk to one local address; behind it, 397 free models from 69 providers are available, depending on the free keys you add.

1. Install Free-LLM Router

One line, no admin rights, and no Node.js to set up first: the installer brings a private copy if you have none. The first run sends a real question to a free model and shows the answer before asking you for anything.

Windows (PowerShell)

irm https://free-llm.com/install.ps1 | iex

macOS / Linux

curl -fsSL https://free-llm.com/install.sh | sh

2. Add two or three free keys

Optional to start: guest mode answers with no key, slowly. For real work, add free keys in the dashboard at http://localhost:4000 (Google AI Studio, Groq and OpenRouter need no card). Each key is tested when you paste it. The API keys page shows where to click for each provider.

3. Connect Claude Code

Run free-llm setup claude. It edits ~/.claude/settings.json and keeps a backup of the file as it was. To try it for one session only, use the two environment variables shown below instead.

4. Start claude as usual

Claude Code keeps its three model names. The router maps them: Opus goes to auto:smart, Sonnet to auto:coding and Haiku to auto:fast.

The exact settings

Replace YOUR_ROUTER_KEY with the router key shown on the first screen of the dashboard (or by free-llm config). It is created on your computer at install; there is nothing to sign up for.

# one command (edits ~/.claude/settings.json, backup kept):
free-llm setup claude

# or just for one session:
ANTHROPIC_BASE_URL=http://127.0.0.1:4000 ANTHROPIC_AUTH_TOKEN=YOUR_ROUTER_KEY claude

The same text is printed on your machine, with your real address and key filled in, by free-llm connect and on the dashboard's Connect your tools page.

Good to know

  • To go back to your Anthropic account: free-llm setup claude --remove. The previous settings file is also kept in ~/.free-llm/backups.

What happens when a free plan runs out

Free plans are small: a few requests per minute, a daily cap, sometimes a size limit per request. When a provider answers with a rate limit, an exhausted quota, an error or a timeout, the router sends the same request to the next free model that is up. Claude Code receives a normal answer and never sees the error. The Activity page of the dashboard shows which model answered each request and what was skipped on the way.

Option 2: one free provider, directly

Claude Code needs an endpoint that understands the Anthropic Messages format. Most free providers below only offer the OpenAI format, so they cannot be used directly. Z.AI is the exception worth knowing: it has a native Anthropic-compatible endpoint for its GLM models. The full walkthrough, with and without the router, is in the Claude Code for free guide.

Free OpenAI-compatible providers today
Provider Sign-up Free limits Free models Base URL
Google AI Studio No card 5-30 RPM (varies by model) 8 https://generativelanguage.googleapis.com/v1beta/openai
Groq No card 30 RPM, 1,000 requests/day 6 https://api.groq.com/openai/v1
OpenRouter No card 20 requests/minute 14 https://openrouter.ai/api/v1
NVIDIA NIM Phone check 40 requests/minute 16 https://integrate.api.nvidia.com/v1
Cloudflare Workers AI No card Varies by model 16 https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/v1
Cohere No card 20 requests/minute 10 https://api.cohere.ai/compatibility/v1
Kilo AI Gateway No card 200 requests/hour per IP on free models (works without an account) 11 https://ai-gateway.kilo.ai/api/v1

Live from the Free-LLM directory, December 5, 2026. Limits change often: the provider page has the details and the sources. All free APIs

The trade-off is simple. One provider means one set of limits: when it says "too many requests", you wait. The router keeps several of these plans behind the same address, so the wait becomes a switch.

Claude Code: common questions

Is Claude Code itself free?
The command-line program is free to install. The models it calls by default are not: they need a paid Claude plan or API credits. Pointing it at free models through the router removes that cost.
Why does Claude Code reject my Groq or OpenRouter URL?
It sends Anthropic-format requests to /v1/messages. Groq, OpenRouter and most free providers only answer OpenAI-format requests. The router translates between the two, including tool calls and streaming.
Which free model answers when I pick Sonnet?
Whatever auto:coding resolves to at that moment: the strongest coding model among your free keys that is up and has quota left. Opus maps to auto:smart and Haiku to auto:fast.
How do I undo the change?
Run free-llm setup claude --remove. Your earlier settings.json is also saved in ~/.free-llm/backups.

Other tools on free models