https://api.yelu.ai; Claude Code appends /v1/messages itself.
Use a model returned by
GET /v1/models. The commands below use claude-sonnet-4-6, which is supported by the Yelu gateway but may need to be enabled for your key.Configuration at a glance
Do not add
/v1 to ANTHROPIC_BASE_URL. Doing so would produce an invalid /v1/v1/messages path.
macOS
1. Install Claude Code
The native installer is the recommended installation method:macOS
macOS
2. Configure the current terminal
Copy a key from the Yelu Console, then run:macOS
3. Persist non-secret settings
Add the following lines to~/.zshrc:
~/.zshrc
macOS
YELU_API_KEY from your secret manager at login and set ANTHROPIC_AUTH_TOKEN="$YELU_API_KEY". Do not commit keys to a repository or store them in a shared shell profile.
Windows
Native PowerShell
Install without opening PowerShell as Administrator:Windows PowerShell
Windows PowerShell
Windows PowerShell
%USERPROFILE%\.claude\settings.json:
Claude settings
WSL 2
Use WSL 2 when the repository and toolchain live in Linux or when you need Claude Code sandboxing. Install and configure Claude Code inside the WSL terminal, not in PowerShell:WSL 2
~/.bashrc or ~/.zshrc inside the Linux distribution. Windows user environment variables are not a reliable substitute for WSL shell variables.
Optional settings file
Claude Code reads~/.claude/settings.json on macOS and %USERPROFILE%\.claude\settings.json on Windows. This safe global configuration persists the URL and model discovery without storing a key:
Claude settings
.claude/settings.local.json for project-local secrets and ensure it is ignored by Git. Never put a key in the shared .claude/settings.json inside a repository.
Verify the gateway
Test the API before starting Claude Code:Terminal
/status inside Claude Code. Anthropic base URL should show https://api.yelu.ai, and the credential source should be ANTHROPIC_AUTH_TOKEN. Run /model to select another model exposed by your Yelu account.
Update and diagnose
Terminal