Claude Code Configuration Guide
This guide shows how to configure Claude Code to call models through the OmniRouters gateway.
1. Install Claude Code
Run the following command in your terminal to install Claude Code globally:
npm install -g @anthropic-ai/claude-codeAfter installation, check whether it is available:
claude --versionIf a version is printed, the installation is working. The displayed version is only a reference; use the actual output on your machine.
2. Core configuration
To route Claude Code through OmniRouters, update the local configuration before starting Claude Code.
Step 1: Update settings.json
Find the configuration file for your operating system.
macOS:
open ~/.claude/settings.jsonLinux:
vim ~/.claude/settings.jsonWindows:
C:\Users\YourUsername\.claude\settings.jsonIf the .claude directory or settings.json file does not exist, create it manually.
Replace the file content with the following configuration, and replace YOUR API TOKEN with your OmniRouters API key:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR API TOKEN",
"ANTHROPIC_BASE_URL": "https://omnirouters.com",
"ANTHROPIC_MODEL": "claude-opus-4.7"
},
"model": "claude-opus-4.7"
}Notes:
ANTHROPIC_BASE_URLshould behttps://omnirouters.comwithout/v1.ANTHROPIC_MODELand the top-levelmodelmust use the same model name.- To change the default model later, update both values and restart Claude Code.
Step 2: Skip onboarding
To avoid the CLI trying to connect to the original provider for verification, update the onboarding state directly.
Open the configuration file on macOS:
open ~/.claude/.claude.jsonLinux:
vim ~/.claude/.claude.jsonWindows path:
C:\Users\YourUsername\.claude\.claude.jsonFind hasCompletedOnboarding and make sure it is set to true. If it is not, update it to:
{
"hasCompletedOnboarding": true
}If the file already contains other settings, only make sure the hasCompletedOnboarding field is true.
3. Start and use Claude Code
Start Claude Code from the terminal:
claudeWhen entering a project directory for the first time, choose:
1 Yes, I trust this folderAfter Claude Code starts, check the current model:
/modelConfirm that the current model is the OmniRouters model configured above, then start using Claude Code normally.
4. Notes and limitations
- Gateway delay: after creating a new token, synchronization may take about 1 minute. If you receive
401, wait and try again. - Rate limits: for high-frequency code completion workloads, contact OmniRouters business support to request adjusted limits for your account.
- Compliance review: if input or output triggers sensitive terms, the request may return a
400error.
