Use OminiGate in Claude Code
Route Anthropic's official CLI through OminiGate in under a minute — no code changes, just two environment variables.
Claude Code
Overview
Claude Code is Anthropic's AI-powered coding assistant — an agentic tool that reads your codebase, edits files across projects, runs commands, and integrates with your development tools. It runs in the terminal, inside VS Code and JetBrains IDEs, as a desktop app, and on the web, all driven by the same Anthropic Messages API.
Every surface honors the ANTHROPIC_BASE_URL environment variable, so any gateway that exposes an Anthropic-compatible /v1/messages endpoint can replace api.anthropic.com. OminiGate serves exactly that endpoint — Claude Code works out of the box once you point it at us.
- Drop-in replacement — no config file edits, no recompilation.
- Access every Claude model plus third-party models routed through OminiGate.
- One API key, one balance, unified usage dashboard.
Prerequisites
Before you start, make sure Claude Code is installed and you have an OminiGate API key.
1. Install Claude Code
Anthropic's recommended path is the native installer — it auto-updates and doesn't require Node. If you already have Homebrew, WinGet, or npm, use those instead.
# macOS, Linux, WSL
curl -fsSL https://claude.ai/install.sh | bash
# Windows PowerShell
irm https://claude.ai/install.ps1 | iex2. Get an OminiGate API key
API keys start with the sk-omg- prefix. Create one from the dashboard — any active key works with Claude Code.
Open API keys→Configure Claude Code
The official LLM gateway guide calls for only two required values: ANTHROPIC_BASE_URL (the endpoint) and ANTHROPIC_AUTH_TOKEN (the bearer token). You can store them in Claude Code's settings file or export them in your shell — pick whichever fits your workflow.
Claude Code reads env vars before settings.json — if stale ANTHROPIC_BASE_URL or ANTHROPIC_AUTH_TOKEN values linger in your shell, they silently override the config file and you'll debug the wrong layer. Unset them before continuing.
unset ANTHROPIC_API_KEY
unset ANTHROPIC_AUTH_TOKEN
unset ANTHROPIC_BASE_URLIf you previously wrote exports into ~/.zshrc or ~/.bashrc, delete those lines too, then open a new shell.
Option A — settings.json (recommended)
Store the config in Claude Code's own settings file. Doesn't pollute your shell, survives new terminals, and is what the official llm-gateway guide suggests for persistent setups. API_TIMEOUT_MS (in milliseconds) prevents long agentic loops from hitting the default timeout; CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC turns off telemetry.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.ominigate.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-omg-your-api-key",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}Create the file if it doesn't exist. Claude Code reads ~/.claude/settings.json at startup — no restart of other shells needed.
Optional: pin every tier to a specific OminiGate slug
Claude Code internally picks between Opus / Sonnet / Haiku based on task complexity. By default those pickers resolve to Anthropic's native names, which OminiGate doesn't recognize. Add the three DEFAULT_*_MODEL overrides if you want all three tiers to route to OminiGate slugs automatically — otherwise pick a model per session with /model.
"ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-4.6",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-sonnet-4.6",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-4.5"Option B — Export for the current shell
Quickest ad-hoc path. Variables live only in the current terminal, so your default Claude Code setup elsewhere stays untouched.
export ANTHROPIC_BASE_URL="https://api.ominigate.ai"
export ANTHROPIC_AUTH_TOKEN="sk-omg-your-api-key"
claudeIf you want this across every new shell, add the same two exports to ~/.zshrc or ~/.bashrc.
Verify the setup
1. Check the TUI state
Start claude in any directory, then from inside the TUI run /status and /model. These confirm Claude Code picked up your config — they're the quickest way to tell whether env vars or settings.json actually took effect.
/status # expect ANTHROPIC_BASE_URL pointing at api.ominigate.ai
/model # expect an anthropic/... slug2. Run a real task
Either pass --model at launch, or swap models mid-session with /model. No ANTHROPIC_MODEL env var needed.
# One-shot with an explicit model
claude --model anthropic/claude-opus-4.6 "Write a hello world in Rust"
# Or inside an existing session
> /model anthropic/claude-sonnet-4.6Charges land in your OminiGate dashboard within seconds. If nothing shows up under Usage, double-check ANTHROPIC_BASE_URL and that the model slug you picked is one OminiGate recognizes.
Recommended models
Claude Code speaks the Anthropic Messages format, so Anthropic models are the most compatible pick. You can also pass any other model that supports the Messages format.
anthropic/claude-opus-4.6Highest-quality reasoning and long-context agentic work. Best for refactors, architecture reviews, and gnarly debugging.
anthropic/claude-sonnet-4.6Balanced intelligence and latency. A strong default for most day-to-day coding sessions.
anthropic/claude-haiku-4.5Fastest and cheapest Claude tier. Great for quick edits, scripts, and short prompts.
Browse the full catalog at /models.
Troubleshooting
I'm logged into Claude Pro and Claude Code keeps hitting api.anthropic.com.
Claude Pro's OAuth session takes precedence over ANTHROPIC_AUTH_TOKEN. Force Claude Code off OAuth by exporting ANTHROPIC_API_KEY="" (explicit empty string, not unset) alongside your other variables, or run /logout inside Claude Code to drop the OAuth credentials. API-key-only users on a non-Pro account never need this.
I get 401 Unauthorized on every request.
Claude Code sends the token as a bearer header. Confirm you used ANTHROPIC_AUTH_TOKEN (not ANTHROPIC_API_KEY) and that your key starts with sk-omg-. Regenerate the key from the dashboard if it was revoked.
Requests fail with "model not found".
Claude Code sends whatever model name you gave it — but if you picked an Anthropic-native slug like claude-opus-4 (no provider prefix), OminiGate won't recognize it. Always use the catalog form, e.g. anthropic/claude-opus-4.6, either via --model at launch or /model in the session.
Next steps
Explore the full API reference or browse more models you can use from Claude Code.