Free-LLM Router documentation

Everything you need after the one-minute overview: installing, connecting tools, calling it from code, and fixing the few things that can go wrong.

Install

The installer puts everything in one folder of your home directory and adds a free-llm command. It needs no admin rights. If Node.js 18 or newer is not on your computer, it downloads a private copy from nodejs.org into ~/.free-llm/node, checks its checksum, and uses it for the router only.

Windows

Paste into PowerShell:

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

macOS and Linux

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

npm

If you already have Node.js 18+:

npm install -g github:nejib1/Free-LLM
free-llm

To try it without installing anything: npx github:nejib1/Free-LLM

Docker is covered in Server and Docker. Both install scripts are short and readable: install.sh, install.ps1.

First run

The installer starts it for you; later, type free-llm. The first time, a short guided setup runs: it sends a real question to a free model and shows the answer before asking for anything, then offers to connect the coding tools it finds and to keep the router running in the background. The dashboard opens in your browser, and the router prints two things your tools need:

http://localhost:4000/v1The address (OpenAI-compatible). For Anthropic-style clients, use http://localhost:4000.
fllm-…The router key, created for you. It is not a provider key: it only protects your own router. free-llm config shows it again.

Open http://localhost:4000 for the dashboard: playground, keys, models, live activity and settings. With no key at all the router already answers through a few no-account models, so you can test it at once.

To keep it running after you close the terminal:

free-llm service installStart by itself each time you log in (Windows startup, launchd on macOS, systemd on Linux).
free-llm start --daemonRun in the background until the next reboot. Stop it with free-llm stop.

Free keys

The router has no accounts of its own: it uses the free plans you sign up for. Two or three keys are enough for everyday work, and most need no credit card.

free-llm providers              # the best free providers, with sign-up links
free-llm keys add groq gsk_…     # tested at once, refused keys are not kept
free-llm keys                    # what is saved
free-llm keys test               # check that every key still works

The same can be done in the dashboard, page Free keys. Keys are stored in ~/.free-llm, encrypted with AES-256-GCM, and each one is locked to its provider's address: your Groq key is only ever sent to api.groq.com. You can add several keys for one provider; the router rotates them.

Connect your tools

Coding agents: one command

setup writes the tool's configuration and keeps a backup of the previous one; --remove puts it back. launch starts the tool on free models for this session only, without changing its configuration.

free-llm setup claudeClaude Code. Opus is mapped to the most capable free models, Sonnet to the best coding models, Haiku to the fastest. See the Claude Code guide.
free-llm setup codexCodex CLI (uses the Responses API).
free-llm setup opencodeOpenCode.
free-llm setup aiderAider.
free-llm setup crushCrush.
free-llm launch qwenQwen Code. Also: launch goose, launch crush, and any of the agents above.

Editors and chat apps: a setting to paste

free-llm connect <tool> prints the exact values for your router, and the dashboard page Connect your tools has the same recipes with copy buttons.

ToolHow
Cline, Roo Code, Kilo CodeProvider "OpenAI Compatible", base URL http://localhost:4000/v1, the router key, model auto:coding.
Continueconfig.yaml, for chat and autocomplete.
Zed, JetBrains AIAs an Ollama server or an OpenAI-compatible provider.
Open WebUI, LibreChat, LobeChatAn OpenAI API connection or custom endpoint.
CursorSettings → Models → override the OpenAI base URL. Cursor calls it from its own servers, so the router must be reachable from the internet: see Server and Docker.
Gemini CLIIt only speaks Google's own API. Use Qwen Code, its OpenAI-compatible fork.

Use it from code

Keep the SDK you already use and change two lines: the base URL and the key.

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(base_url="http://localhost:4000/v1", api_key="fllm-…")

reply = client.chat.completions.create(
    model="auto",  # or auto:coding, auto:fast, any model id
    messages=[{"role": "user", "content": "Explain rate limits in one sentence."}],
)
print(reply.choices[0].message.content)
print(reply.model)  # which free model answered

JavaScript

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "http://localhost:4000/v1", apiKey: "fllm-…" });

const stream = await client.chat.completions.create({
  model: "auto:fast",
  stream: true,
  messages: [{ role: "user", content: "Explain rate limits in one sentence." }],
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");

curl

curl http://localhost:4000/v1/chat/completions \
  -H "Authorization: Bearer fllm-…" \
  -H "Content-Type: application/json" \
  -d '{"model": "auto", "messages": [{"role": "user", "content": "Hello"}]}' -i

The response headers say who answered: x-free-llm-provider, x-free-llm-model, x-free-llm-attempts.

Anthropic SDK

import anthropic

client = anthropic.Anthropic(base_url="http://localhost:4000", api_key="fllm-…")

msg = client.messages.create(
    model="auto:smart",
    max_tokens=500,
    messages=[{"role": "user", "content": "Explain rate limits in one sentence."}],
)
print(msg.content[0].text)

Endpoints

/v1/chat/completionsOpenAI Chat Completions, streaming included.
/v1/responsesOpenAI Responses API (used by Codex).
/v1/messagesAnthropic Messages API (used by Claude Code).
/v1/embeddingsEmbeddings.
/v1/modelsModels you can use. ?ready=1 keeps only those that can answer right now; each model lists its capabilities and context length.

An Ollama-compatible API and an MCP server (free models as a tool for MCP clients) are served on the same port.

Model names

Send one of these as the model name and the router chooses among the 350+ free models it knows:

autoBest overall for each request.
auto:codingStrongest coding models first. For agents.
auto:fastLowest latency first. Chat, autocomplete.
auto:smartMost capable models first.
auto:longLargest context windows first.
auto:visionModels that can read images.
auto:reasoningThinking models first.
auto:spreadRotate providers to stretch free quotas.
auto:fusionAsk three different models and merge the answers into one.

You can also send a model id (deepseek-v4-flash) or provider/model (groq-cloud/openai/gpt-oss-120b). It is tried first, then another free model takes over if it is busy, unless you turn the fallback off in Settings.

Your own fallback order

free-llm chain add mycode groq-cloud/openai/gpt-oss-120b cerebras/gpt-oss-120b
free-llm chain list

Then use chain:mycode as the model. Models are tried strictly in that order, then normal routing takes over (add --no-fallback to never go beyond the chain).

Commands

free-llmFirst run: guided setup, then start.
free-llm start [--port 4000] [--host 127.0.0.1] [--open] [--daemon]Start the router.
free-llm stopStop a background router.
free-llm statusIs it running, models ready, usage today.
free-llm providers [--all]Best free providers, with sign-up links.
free-llm keys add <provider> <key>Add a key. Also: keys, keys remove, keys test.
free-llm setup <agent> [--remove]claude, codex, opencode, aider, crush, all.
free-llm launch <agent>Run an agent on free models for this session.
free-llm connect [tool]Copy-paste settings for editors, chat apps and SDKs.
free-llm chat "question"Quick question from the terminal.
free-llm models [--ready]Models you can use (right now, with --ready).
free-llm usage [--days 7]Tokens per provider and model, against each free daily limit.
free-llm doctorChecks the catalog, every key, the router and your tools, and says what to fix.
free-llm updateRefresh the list of free models now (it also refreshes on its own).
free-llm upgradeInstall the newest version of the router in place. Keys and settings are kept.
free-llm service installStart at login. service uninstall undoes it.
free-llm proxy set <url>Send provider calls through an HTTP(S) or SOCKS5 proxy.
free-llm configWhere files live, address, router key.
free-llm completion bashTab completion (bash, zsh, fish).

status, models, providers, usage and chain list accept --json for scripts.

Server and Docker

By default the router listens on 127.0.0.1 only. To share it with a team, a home network, or Cursor:

free-llm start --host 0.0.0.0

Every request then needs the router key, so keep it private and put the machine behind a firewall or a reverse proxy with HTTPS.

Docker

docker build -t free-llm https://github.com/nejib1/Free-LLM.git
docker run -d --name free-llm -p 4000:4000 -v free-llm:/data free-llm
docker logs free-llm   # shows your router key

Router on a remote machine, dashboard on yours

If the router runs on a server over SSH and listens on localhost, forward the port from your own computer, then open http://localhost:4000:

ssh -L 4000:localhost:4000 user@your-server

Troubleshooting

Start with free-llm doctor: it tests each part and prints what to fix.

MessageWhat to do
No provider is configured yetThe router has no key and no no-account provider is available. Add a key in the dashboard (Free keys) or with free-llm keys add.
All free models failed for this requestEvery provider you added is busy or out of quota right now. The message lists why each one was skipped. Wait a minute, or add one more free key.
Missing or wrong API keyYour tool is not sending the router key (fllm-…). free-llm config and the dashboard show it.
Port 4000 is already usedAnother program has the port: free-llm start --port 4100. The new port is remembered.
free-llm: command not foundOpen a new terminal so the updated PATH is read. On macOS and Linux the command lives in ~/.local/bin.
A key is refusedCheck for a missing character or create a new key at the provider. Some providers also ask to accept their terms or verify a phone number before the key works.

Still stuck? Open an issue on GitHub with the output of free-llm doctor (it never prints your keys in full).

Update and uninstall

Update: free-llm upgrade installs the newest version in place (on versions before 1.5, run the install command again). Keys and settings in ~/.free-llm are kept, and a router running in the background is restarted. The dashboard, free-llm status and free-llm doctor tell you when a newer version is out. The list of free models needs no update: it refreshes by itself every few hours. What changed in each version is in the changelog.

Uninstall: put your tools back first, then delete the folder.

free-llm setup all --remove
free-llm service uninstall
rm -rf ~/.free-llm ~/.local/bin/free-llm

On Windows, delete the folder %USERPROFILE%\.free-llm after the first two commands.

Questions

Which tools work with it?

Anything that speaks the OpenAI or Anthropic API: Claude Code, Codex CLI, OpenCode, Aider, Qwen Code, Goose, Crush, Cursor, Cline, Roo Code, Kilo Code, Continue, Zed, JetBrains AI Assistant, Open WebUI, LibreChat, LobeChat, the OpenAI and Anthropic SDKs, LangChain, LlamaIndex, the Vercel AI SDK and MCP clients.

How does it stay up to date?

The list of free providers and models comes live from free-llm.com, where every free tier is checked against official sources. The router refreshes it automatically every few hours, so a new free model reaches every user the same day.

Does free-llm.com see my prompts or my keys?

No. Your requests go directly from your computer to the AI provider that answers them. The router only downloads the public list of free models from free-llm.com; that download says which router version, operating system family and Node.js version is asking, with no identifier, and nothing about your keys or requests.

How do I update or uninstall it?

Run "free-llm upgrade" (or the install command again): your keys and settings in ~/.free-llm are kept. The list of free models updates by itself, without reinstalling. To uninstall, delete the ~/.free-llm folder and the free-llm command; "free-llm setup claude --remove" first puts your tools back the way they were.

Can I run it on a server for my team?

Yes: start it with "free-llm start --host 0.0.0.0" or use the Docker image. Every request then needs the router key. This is also the way to use it with Cursor, which calls custom endpoints from its own servers and cannot reach a router on localhost.

If I ask for a precise model, do I always get it?

It is tried first, but it is a preference, not a guarantee: if that model is busy or down, another free model answers so your app keeps working. The response headers and the dashboard show which model really answered. If you prefer an error to a substitute, turn off the fallback option in Settings.

Is it allowed by the providers?

The router only uses your own keys, at your request, like any client app would. Each free plan has its own terms (personal use, rate limits, data use), so read the terms of the providers you sign up for.

The basics (is it free, is it safe, do I need keys) are answered on the router page.