Prerequisites
Claude Code is a command-line AI programming assistant from Anthropic that supports direct conversation with AI, code generation, debugging, and more in your terminal. By integrating ByteRouter, you can access multiple AI models including GPT, Claude, and Gemini directly within Claude Code. Before getting started, ensure you have:- ByteRouter API Key Sign in to ByteRouter Console to get your API key
Tip: If you don’t have a ByteRouter account yet, register at ByteRouter first and obtain your API key.
Step 1: Install Claude Code
Choose one of the following installation methods:- macOS / Linux (Recommended)
- Windows
- NPM Installation
Install using the official script:Or install via Homebrew:
If you encounter permission issues, prepend
sudo to the command.Verify Installation
After installation, run the following command to confirm success:1.x.x) is displayed, the installation is successful.
Step 2: Configure ByteRouter API
Three configuration methods are available. Choose the one that suits your workflow.Method 1: Edit settings.json (Recommended)
This is the most stable configuration method and works persistently after one-time setup. 1. Find the configuration directory:- Windows: Press
Win + R, type%userprofile%\.claude - macOS: Press
Command + Shift + G, type~/.claude - Linux: Navigate to
~/.claudedirectory
If the directory doesn’t exist, run
claude once in your terminal and press Ctrl + C to exit. The directory will be created automatically.settings.json file:
After saving, restart Claude Code for changes to take effect.
Method 2: Permanent Environment Variables
Configure at the system level so all terminal windows automatically load the settings.- macOS (zsh)
- macOS / Linux (bash)
- Windows
Method 3: Temporary Environment Variables
Suitable for temporary testing. Configuration will be lost when you close the terminal.- macOS / Linux
- Windows (PowerShell)
- Windows (CMD)
Step 3: Get Started
Verify Configuration
Start Claude Code and send a simple message to confirm configuration:Usage Modes
Claude Code offers two interaction modes:- Interactive Mode: Run
claudeto enter continuous conversation, ideal for complex tasks - Single Command: Run
claude "your question"to get a one-time response and exit, perfect for quick queries
Supported Models
ByteRouter supports various AI models that you can switch between based on your needs. See the Getting Started page for the complete model list.Common Model Examples
Common Commands
Here are frequently used commands and shortcuts in Claude Code:Troubleshooting
Q1: Login selection screen still appears after configuration?
If “Select login method” is displayed, the configuration hasn’t taken effect. Troubleshooting steps:- Using settings.json method: Verify the file path is correct
- Windows:
C:\Users\<username>\.claude\settings.json - macOS / Linux:
~/.claude/settings.json
- Windows:
- Using environment variables: Ensure you started Claude Code in the same terminal window where you set the variables
- Check JSON format: Make sure brackets, commas, and quotes are correct (don’t use Chinese quotes)
Q2: Authentication errors?
Ensure
ANTHROPIC_BASE_URL is set to https://byterouter.ai/v1.
Q3: “Unable to connect” error?
This means Claude Code cannot connect to the API service.- Check your network connection
- Verify
ANTHROPIC_BASE_URLis configured correctly - If using a proxy, ensure it allows access to
byterouter.ai
Q4: How to switch models?
Two options:- In interactive mode: Type
/modelcommand to switch - Modify configuration: Change the
ANTHROPIC_MODELfield insettings.jsonor environment variables, then restart Claude Code
Q5: Slow responses?
- Try switching to a faster model
- Shorten your questions to reduce context length
- Check your local network status
Support & Help
If you encounter any issues:- 📧 Technical Support: [email protected]
Get Started with ByteRouter
Register now and get your API key to start using multiple AI models in Claude Code!