OmniRoute

OmniRoute Claude Code Guide: Launch, Multi-Model Profiles and VPS

OmniRoute is an open-source (MIT) AI gateway: one local endpoint in front of the model providers you connect. Using OmniRoute with Claude Code means Claude Code sends its requests to that endpoint instead of the default Anthropic API, so you can switch models per project or per profile. This guide covers starting it, per-model profiles, running it on a VPS, and the mistakes that break the connection.

TL;DR: To use OmniRoute with Claude Code, install it with npm install -g omniroute, connect a provider in the dashboard, then run omniroute launch; if you set it up by hand, ANTHROPIC_BASE_URL must be the gateway root with no /v1.

Start · Multi-model profiles · VPS · Revert · Common errors · Official repo

Facts checked 2026-10-16npm latest 3.8.51. Open source (MIT).Unofficial; not affiliated with OmniRoute or Anthropic.

How do I start OmniRoute and launch Claude Code?

1. Install and start OmniRoute

npm install -g omniroute
omniroute

Needs Node.js 22.22.2+ (22.x) or 24–26. The dashboard opens at http://localhost:20128 and the API is at http://localhost:20128/v1.

Optional: skip the native warm-up

OMNIROUTE_SKIP_POSTINSTALL=1 npm install -g omniroute

For CI, headless or slow machines, the README lets you skip the post-install native warm-up (SQLite). The binary copy and repair hook still runs. CI=1 skips it too.

2. Connect a provider

curl http://localhost:20128/v1/models -H "Authorization: Bearer YOUR_OMNIROUTE_KEY"

In the dashboard, open Providers and add a provider with your own API key or account. That provider's prices, quotas and terms still apply. Then copy an API key from Dashboard → Endpoints.

3. Launch Claude Code through OmniRoute

omniroute launch
omniroute run claude --model openai/gpt-5.4

omniroute launch reads the active context, checks the server is healthy, sets the Anthropic variables and starts claude. omniroute run claude does the same with a model you choose.

How do I point Claude Code at OmniRoute by hand?

Prefer to configure Claude Code yourself? Put this in your Claude Code settings.json (the Claude card under Dashboard → CLI Code shows the same block for your instance). Paste your OmniRoute API key over the placeholder, then restart claude: it reads these variables once at startup.

{
  "env": {
    "ANTHROPIC_BASE_URL": "http://localhost:20128",
    "ANTHROPIC_AUTH_TOKEN": "<your OmniRoute API key>",
    "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
  }
}
VariableWhat it does
ANTHROPIC_BASE_URLGateway root. Claude Code adds /v1/messages itself, so do not add /v1.
ANTHROPIC_AUTH_TOKENYour OmniRoute API key, sent as a Bearer token. Wins if ANTHROPIC_API_KEY is also set.
ANTHROPIC_MODELForces one model, e.g. glm/glm-5.2. This is what profiles set.
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY1 lists the gateway's claude*/anthropic* models in the /model picker.
CLAUDE_CODE_AUTO_COMPACT_WINDOWWhen auto-compaction fires. Set it below the real context window of non-Claude models.
CLAUDE_CODE_MAX_OUTPUT_TOKENSCaps output tokens per response.

How do I use several models with Claude Code?

Write one profile per model

omniroute setup-claude --dry-run
omniroute setup-claude
omniroute setup-claude --only glm,kimi

setup-claude reads the live /v1/models list and writes ~/.claude/profiles/<name>/settings.json for each model, with names such as glm52, kimi-k27 or deepseek-pro. Each profile is its own CLAUDE_CONFIG_DIR, with separate settings, history and cache. Your API key is never written into a profile.

Launch a profile

omniroute launch --profile kimi-k27
CLAUDE_CONFIG_DIR=~/.claude/profiles/glm52 claude

omniroute launch --profile adds the API key from the active context. Without it, export ANTHROPIC_AUTH_TOKEN yourself and point CLAUDE_CONFIG_DIR at the profile.

Or map Claude Code's tiers to different models

export ANTHROPIC_DEFAULT_OPUS_MODEL="glm/glm-5.2"
export ANTHROPIC_DEFAULT_SONNET_MODEL="kmc/kimi-k2.6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="glm/glm-4.7-flash"

Instead of one ANTHROPIC_MODEL, send each Claude Code tier to a different OmniRoute model. The model ids below are the docs' examples; use ids from your own /v1/models list.

Want non-Claude models in the /model picker? Turn on discovery aliases (off by default): per model or per provider on the provider page, or globally with the EXPOSE_CC_DISCOVERY_ALIASES feature flag. A model like kimi/kimi-k2.6 then shows as claude/kimi/kimi-k2.6, and OmniRoute strips the claude/ prefix before routing.

Profiles can regenerate themselves when the model list changes. This is off by default; turn it on in the CLI Code dashboard or with OMNIROUTE_AUTO_SYNC_CLAUDE_PROFILES=true. It only writes profile files and never touches ~/.claude/settings.json.

How do I run OmniRoute on a VPS for Claude Code?

1. Run the Docker image on the VPS, bound to loopback

docker run -d --name omniroute --restart unless-stopped --stop-timeout 40 \
  -e OMNIROUTE_MEMORY_MB=8192 --memory=10g \
  -p 127.0.0.1:20128:20128 -v omniroute-data:/app/data diegosouzapw/omniroute:latest

:latest follows the newest published stable release; pin a version tag such as :3.8.51 if you want repeatable deploys. The image's 1024 MB heap is for the dashboard and light chat; a coding agent like Claude Code needs about an 8192 MB heap in a container with at least 10 GB of memory.

2. Set your own secrets

openssl rand -hex 32

The VM guide puts JWT_SECRET, INITIAL_PASSWORD, API_KEY_SECRET, STORAGE_ENCRYPTION_KEY and the other secrets in an .env file passed with --env-file. Generate each secret separately. Set REQUIRE_API_KEY=true so every /v1/* request needs a valid key (it is false by default and does not cover GET /v1/models).

3. Put HTTPS in front, close everything else

ufw default deny incoming
ufw allow 22/tcp && ufw allow 80/tcp && ufw allow 443/tcp
ufw enable

Keep port 20128 on 127.0.0.1 and let a reverse proxy (the official guide uses nginx with HTTPS) forward to http://127.0.0.1:20128. Allow only SSH, 80 and 443 in the firewall.

4. Connect from your laptop and launch

npm install -g omniroute
omniroute connect https://omni.example.com --scope write
omniroute setup-claude
omniroute launch

omniroute connect trades the management password for a scoped access token (oma_live_…, admin by default; use --scope read or write to limit it) and saves it as the active context in ~/.omniroute/config.json. After that, omniroute launch and setup-claude target the VPS with no extra flags. Access tokens manage the server; inference API keys (sk-…) are separate.

How do I go back to the official Anthropic API or uninstall OmniRoute?

Go back to Claude Code's normal setup

unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN ANTHROPIC_MODEL
claude

omniroute launch and profiles only set variables for that session or live in their own CLAUDE_CONFIG_DIR. If you added the env block to settings.json by hand, remove ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN and the other OmniRoute entries, then start a new claude session.

Uninstall OmniRoute (npm)

npm uninstall -g omniroute
rm -rf ~/.omniroute

From the official uninstall guide. Removing ~/.omniroute is optional and permanently deletes your provider connections, API keys and usage history.

Check nothing is left

npm list -g omniroute
ls -la ~/.omniroute/
pgrep -f omniroute

Also from the uninstall guide. If a process is still running, stop it with pkill -f omniroute.

Common OmniRoute Claude Code errors

ProblemFix
Claude Code ignores OmniRouteANTHROPIC_BASE_URL ends in /v1, or claude was not restarted. Use the root URL (http://host:20128) and restart; variables are read once at startup.
/model picker is empty or missing modelsNeeds Claude Code v2.1.219+ and CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1. Only claude*/anthropic* ids appear; force any other model with ANTHROPIC_MODEL or turn on discovery aliases.
400 Ambiguous model 'claude-…'Both the Claude Code (cc/) and Claude (claude/) providers are connected, and Claude Code sends bare ids. Pin a prefix, e.g. ANTHROPIC_MODEL=cc/claude-opus-4-8, or set OMNIROUTE_PREFER_CLAUDE_CODE_FOR_UNPREFIXED_CLAUDE_MODELS=true.
Auth errors when launching a profileProfiles hold no key by design. Use omniroute launch --profile <name>, or export ANTHROPIC_AUTH_TOKEN first.
Auto-compaction fires too early on a non-Claude modelClaude Code assumes a 200K window for ids it does not know. Set CLAUDE_CODE_AUTO_COMPACT_WINDOW below the model's real window; generated profiles already do (e.g. 190000).
Profiles share history or settingsInside the session, run echo $CLAUDE_CONFIG_DIR. It should point at ~/.claude/profiles/<name>.
OmniRoute crashes during long Claude Code sessionsThe image's default 1024 MB heap is too small for coding agents. Raise OMNIROUTE_MEMORY_MB (8192 for one agent) and give the container more memory than the heap.
/v1/models is open even with REQUIRE_API_KEYREQUIRE_API_KEY=true only gates the /v1/* proxy requests; GET /v1/models follows the dashboard login setting instead. So a 401 (or 200) on /v1/models tells you nothing about inference: test a real /v1 request.

Base URL or token problems: recheck the settings.json block in Start. Profile or model problems: see multi-model profiles. Remote errors: see VPS. Comparing Claude Code plans first? Read Muse subscription vs Codex vs Claude Code.

More for Claude Code and Codex users

Taste Skill for Claude Code · Muse vs Codex vs Claude Code plans · Codex reset tracker

Theming your coding agent too? Build a Codex/OpenCode/Qwen Code theme from any image →

OmniRoute Claude Code FAQ

What is OmniRoute?

OmniRoute is an open-source (MIT) AI gateway by diegosouzapw. It gives Claude Code, Codex, Cursor, OpenCode, Cline and other tools one endpoint (http://localhost:20128) in front of the providers you connect, with routing and fallback between them.

How do I connect Claude Code to OmniRoute?

Install with npm install -g omniroute, run omniroute, connect a provider in the dashboard, then run omniroute launch. To do it by hand, set ANTHROPIC_BASE_URL to http://localhost:20128 (no /v1) and ANTHROPIC_AUTH_TOKEN to your OmniRoute API key, then restart claude.

Should ANTHROPIC_BASE_URL end with /v1?

No. Claude Code adds /v1/messages itself. Use the gateway root, such as http://localhost:20128. Other tools that use the OpenAI format do use http://localhost:20128/v1.

How do I use several models with Claude Code?

Run omniroute setup-claude to write one profile per model under ~/.claude/profiles/, then start one with omniroute launch --profile <name>. You can also map Claude Code's Opus, Sonnet and Haiku tiers to different models with ANTHROPIC_DEFAULT_*_MODEL.

Can I run OmniRoute on a VPS and use it from my laptop?

Yes. Run the Docker image on the VPS bound to 127.0.0.1 behind an HTTPS reverse proxy, then run omniroute connect <host> on your laptop. After that, omniroute launch and setup-claude use the VPS automatically.

Is OmniRoute free?

The OmniRoute software is open source under the MIT license, and you host it yourself. The models are a separate matter: you connect your own provider accounts or API keys and usage is billed by each provider under its own pricing and terms.

Does OmniRoute make Claude cheaper?

No. OmniRoute routes requests to provider accounts and API keys you connect yourself. You still pay those providers and follow their terms; OmniRoute does not change a provider's prices or limits.

Is codextheme.tools part of OmniRoute?

No. This is an unofficial guide. Commands come from the OmniRoute repo and docs, linked below; check them before you run anything on a server.

Last updated 2026-10-16 (npm latest 3.8.51). We recheck commands against the official docs when OmniRoute ships a new minor version; if a command differs, the official docs win.

Sources (checked 2026-10-16): OmniRoute on GitHub (README) · Claude Code configuration · Remote mode · CLI integrations · VM deployment guide · Self-host guide · Environment reference · Uninstall guide · omniroute on npm

Home · All guides · Codex theme builder