Everything you need after the one-minute overview: installing, connecting tools, calling it from code, and fixing the few things that can go wrong.
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.
Paste into PowerShell:
irm https://free-llm.com/install.ps1 | iex
curl -fsSL https://free-llm.com/install.sh | sh
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.
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/v1 | The 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 install | Start by itself each time you log in (Windows startup, launchd on macOS, systemd on Linux). |
free-llm start --daemon | Run in the background until the next reboot. Stop it with free-llm stop. |
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.
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 claude | Claude 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 codex | Codex CLI (uses the Responses API). |
free-llm setup opencode | OpenCode. |
free-llm setup aider | Aider. |
free-llm setup crush | Crush. |
free-llm launch qwen | Qwen Code. Also: launch goose, launch crush, and any of the agents above. |
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.
| Tool | How |
|---|---|
Cline, Roo Code, Kilo Code | Provider "OpenAI Compatible", base URL http://localhost:4000/v1, the router key, model auto:coding. |
Continue | config.yaml, for chat and autocomplete. |
Zed, JetBrains AI | As an Ollama server or an OpenAI-compatible provider. |
Open WebUI, LibreChat, LobeChat | An OpenAI API connection or custom endpoint. |
Cursor | Settings → 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 CLI | It only speaks Google's own API. Use Qwen Code, its OpenAI-compatible fork. |
Keep the SDK you already use and change two lines: the base URL and the key.
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 answeredimport 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 http://localhost:4000/v1/chat/completions \
-H "Authorization: Bearer fllm-…" \
-H "Content-Type: application/json" \
-d '{"model": "auto", "messages": [{"role": "user", "content": "Hello"}]}' -iThe response headers say who answered: x-free-llm-provider, x-free-llm-model, x-free-llm-attempts.
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)/v1/chat/completions | OpenAI Chat Completions, streaming included. |
/v1/responses | OpenAI Responses API (used by Codex). |
/v1/messages | Anthropic Messages API (used by Claude Code). |
/v1/embeddings | Embeddings. |
/v1/models | Models 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.
Send one of these as the model name and the router chooses among the 350+ free models it knows:
auto | Best overall for each request. |
auto:coding | Strongest coding models first. For agents. |
auto:fast | Lowest latency first. Chat, autocomplete. |
auto:smart | Most capable models first. |
auto:long | Largest context windows first. |
auto:vision | Models that can read images. |
auto:reasoning | Thinking models first. |
auto:spread | Rotate providers to stretch free quotas. |
auto:fusion | Ask 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.
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).
free-llm | First run: guided setup, then start. |
free-llm start [--port 4000] [--host 127.0.0.1] [--open] [--daemon] | Start the router. |
free-llm stop | Stop a background router. |
free-llm status | Is 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 doctor | Checks the catalog, every key, the router and your tools, and says what to fix. |
free-llm update | Refresh the list of free models now (it also refreshes on its own). |
free-llm upgrade | Install the newest version of the router in place. Keys and settings are kept. |
free-llm service install | Start at login. service uninstall undoes it. |
free-llm proxy set <url> | Send provider calls through an HTTP(S) or SOCKS5 proxy. |
free-llm config | Where files live, address, router key. |
free-llm completion bash | Tab completion (bash, zsh, fish). |
status, models, providers, usage and chain list accept --json for scripts.
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 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
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
Start with free-llm doctor: it tests each part and prints what to fix.
| Message | What to do |
|---|---|
No provider is configured yet | The 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 request | Every 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 key | Your tool is not sending the router key (fllm-…). free-llm config and the dashboard show it. |
Port 4000 is already used | Another program has the port: free-llm start --port 4100. The new port is remembered. |
free-llm: command not found | Open a new terminal so the updated PATH is read. On macOS and Linux the command lives in ~/.local/bin. |
A key is refused | Check 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: 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.
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.
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.
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.
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.
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.
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.
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.