Run Claude Code on Free AI Models with OmniRoute (Beginner Setup Guide)
Claude Code is a great terminal coding agent, but the strong models behind it cost money once you’re past your plan’s limits. OmniRoute is an open-source gateway that lets you point Claude Code at a bunch of AI providers that offer real free tiers, so you can keep building without watching a meter the whole time.
This guide walks through the whole setup from scratch, with every command you can copy straight from the page. By the end you’ll have Claude Code running in your terminal, talking to free models through OmniRoute, and switching between them on the fly.
If you’re following along with the video, keep this page open beside it and copy the commands from here as we go.
What OmniRoute actually is
OmniRoute is a free, MIT-licensed AI gateway you run on your own machine. It gives every coding tool one local endpoint that can reach a large catalog of AI providers, including 90+ that have a free tier and a good chunk that are free with no card and no signup. When one provider’s free quota runs low, OmniRoute can automatically fall back to another one, so a session doesn’t just stop dead.
A few things to be clear about, because they matter:
- Nothing here is cracked, pirated, or a “hack.” These are free tiers the providers publish on purpose to get developers trying their models.
- OmniRoute runs locally. Your prompts go from your machine to the provider, not through some middleman cloud.
- The project even flags certain providers with a terms-of-service note so you can decide what you’re comfortable using. In this guide we stick to the clearly-free, no-login providers, which keeps everything simple and above board.
OmniRoute’s dashboard shows a large “free tokens per month” figure. That’s the combined total across all its free-tier providers, re-audited regularly, not one unlimited pipe to a single premium model. Treat it as plenty of free headroom across many models, and you’ll have the right expectation.
What you’ll need
1. Node.js
OmniRoute and Claude Code both run on Node. Install the current LTS (24 is a safe pick) from nodejs.org.
Check it’s installed:
bash
node -v
npm -v
npm ships with Node, so if both print version numbers, you’re set.
2. Git (recommended)
Not strictly required for OmniRoute, but you’ll want it for basically any real coding workflow.
bash
git --version
3. VS Code (optional)
Handy if you’d rather run Claude Code inside an editor. Grab it from code.visualstudio.com.
bash
code --version
If that command isn’t recognized, open VS Code, hit Ctrl + Shift + P (or Cmd + Shift + P on Mac), search for Shell Command: Install ‘code’ command in PATH, and run it. Now code works from your terminal.
4. Claude Code
If you don’t have it yet, install it with npm:
bash
npm install -g @anthropic-ai/claude-code
Verify:
bash
claude --version
A version number means you’re good.
Step 1: Install OmniRoute
Install it globally with npm:
bash
npm install -g omniroute
It usually finishes in a few seconds.
Step 2: Start OmniRoute
Launch it:
bash
omniroute
The server boots on port 20128 and gives you two local addresses:
- Dashboard:
http://localhost:20128 - API endpoint:
http://localhost:20128/v1
Leave this running in its own terminal window. OmniRoute needs to be up whenever you want to use it, so keep this tab open while you work.
Step 3: Add some free, no-login providers
Open the dashboard at http://localhost:20128 in your browser. First time in, it may ask for a password. Use the default shown on screen, then you can change it in settings.
Head to the providers section. This is where you turn on the models you want to use. OmniRoute ships with a couple of keyless free providers already wired into its auto router, so a fresh install responds out of the box. To give yourself more variety, enable a few of the free, no-signup ones, for example:
- OpenCode Free: serves models like DeepSeek V4, no key needed
- Felo: keyless, already part of the default auto setup
- Pollinations: no key needed
- Qoder, Cerebras, Z.AI GLM, SiliconFlow: generous free tiers (some ask for a quick login; skip those if you want a pure no-login setup)
Click into a provider, add it, and use the built-in test button to fire a quick request. If it answers, that model is live. Turn on two or three so OmniRoute has options to fall back on.
Tip: adding providers is a one-time job. Once they’re connected, you don’t touch this again unless you want to add more.
Step 4: Create an API key
In the dashboard, open the API keys section and create a key. Give it any name you like and copy it somewhere handy. You’ll paste it into Claude Code’s config in the next step.
Keep this key private. Don’t commit it to a repo or share it in a screenshot.
Step 5: Point Claude Code at OmniRoute
Claude Code reads its settings from a settings.json file in your .claude folder:
- Windows:
C:\Users\<yourUsername>\.claude\settings.json - macOS / Linux:
~/.claude/settings.json
Find your username with one of these:
bash
# Windows (Command Prompt)
echo %USERNAME%
# Windows (PowerShell)
$env:USERNAME
# macOS / Linux
whoami
If you have the code command set up, you can open the folder in VS Code directly:
bash
code ~/.claude
If settings.json doesn’t exist yet, create it. The name matters, so make sure it’s exactly settings.json.
Now paste in the config below. Use the block that matches your OS.
Windows / macOS / Linux (core config):
json
{
"env": {
"ANTHROPIC_API_KEY": "PASTE_YOUR_OMNIROUTE_KEY_HERE",
"ANTHROPIC_BASE_URL": "http://localhost:20128/v1",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "auto",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "auto",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "auto"
},
"model": "sonnet",
"theme": "dark"
}
What each piece does:
ANTHROPIC_BASE_URLis the important one. It tells Claude Code to talk to your local OmniRoute server instead of connecting out directly.ANTHROPIC_API_KEYis your OmniRoute dashboard key from Step 4.- The three
..._MODELlines are set toauto, which lets OmniRoute pick a working free model for you. For a specific model, open the model list in your OmniRoute dashboard, copy the exact model ID, and paste it in place ofauto(for example a DeepSeek model ID from OpenCode Free). Model names change over time, so grab the current ID from the dashboard rather than guessing. CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICcuts background calls so requests stay on your free providers.
Optional status line (advanced): OmniRoute setups sometimes add a custom statusLine that shows the active model and usage in your terminal. It needs an extra script file, so it’s easy to trip up on. Skip it for now. Everything works without it, and you can add it later once you’re comfortable.
Save the file.
Step 6: Test the connection
Before opening Claude Code, make sure OmniRoute is answering. Run this (swap in your key):
bash
curl http://localhost:20128/v1/models -H "Authorization: Bearer PASTE_YOUR_OMNIROUTE_KEY_HERE"
You should get back a JSON list of available models. That confirms your local endpoint is live.
To test an actual chat response, use the zero-config auto model:
bash
curl http://localhost:20128/v1/chat/completions \
-H "Content-Type: application/json" \
-d "{\"model\":\"auto\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello!\"}]}"
A reply means routing is working end to end.
Step 7: Run Claude Code and switch models
Open a terminal in whatever project folder you want to work in and start Claude Code:
bash
claude
The first time in a folder, it’ll ask permission to read and run files there. Approve it for folders you trust. Claude Code will also detect your custom endpoint and use the OmniRoute key from your config.
To see and change models, type:
/model
You’ll get a list of what’s available through OmniRoute. Pick one and send a quick “hi” to confirm it responds. If a particular model doesn’t answer, switch to another and keep the working one. With a few providers on, something’s always there.
From here, use it like normal. Ask it to build something small to see it in action, like a single-file browser game:
Build a simple snake game in a single HTML file.
It’ll plan, write the file, and you can open it in your browser to play. If your connection is slow, give it a moment to stream the response.
Quick recap of the commands
bash
node -v
npm -v
npm install -g @anthropic-ai/claude-code
claude --version
npm install -g omniroute
omniroute
Then: open http://localhost:20128, add free providers, create a key, paste the config into ~/.claude/settings.json, test with curl, and run claude.
Troubleshooting
codenot recognized: run Shell Command: Install ‘code’ command in PATH from VS Code, then reopen your terminal.- Claude Code ignores your endpoint: double-check
ANTHROPIC_BASE_URLis exactlyhttp://localhost:20128/v1and that OmniRoute is still running in another window. - A model won’t respond: switch models with
/model. Free providers rotate their availability, so pick another and move on. - Config not loading: confirm the file is named
settings.json(notsetting.json) and sits in the.claudefolder for your user.
Wrapping up
Stick to the no-login free providers and you’re using models the way their makers intended, on your own machine. The OmniRoute dashboard shows live usage per provider and a bigger provider list you can add to any time.
If you hit a snag, drop a comment on the video and I’ll help you sort it out.