Claude Code with the ORC Gateway
Claude Code is a coding agent that runs in your terminal. By setting a few environment variables, you can send its requests to the ORC gateway instead of Anthropic's API. Claude Code's commands and interface stay the same; only the destination changes. You don't need an Anthropic account or subscription for this.
Time needed: about 5 minutes. Prerequisites: Claude Code installed (installation guide), and an ORC LLM key that passes the key test.
Note
With these settings, Claude Code is driven by ORC's hosted model (qwen-3.8-27B), not by an Anthropic Claude model. Anthropic doesn't support using Claude Code with non-Claude models, so some features may behave differently or not work. For help with this setup, contact ORC rather than Anthropic.
Step 1 · Set the environment variables
macOS / Linux / Hopper (bash or zsh)
export ANTHROPIC_BASE_URL="http://129.174.189.202"
export ANTHROPIC_AUTH_TOKEN="<your-virtual-key>"
export ANTHROPIC_MODEL="qwen-3.8-27B"
# Recommended: route Claude Code's background and helper requests to the same model
export ANTHROPIC_DEFAULT_HAIKU_MODEL="qwen-3.8-27B"
export ANTHROPIC_DEFAULT_SONNET_MODEL="qwen-3.8-27B"
export ANTHROPIC_DEFAULT_OPUS_MODEL="qwen-3.8-27B"
Windows PowerShell
$env:ANTHROPIC_BASE_URL = "http://129.174.189.202"
$env:ANTHROPIC_AUTH_TOKEN = "<your-virtual-key>"
$env:ANTHROPIC_MODEL = "qwen-3.8-27B"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "qwen-3.8-27B"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "qwen-3.8-27B"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "qwen-3.8-27B"
| Variable | What it does |
|---|---|
ANTHROPIC_BASE_URL |
Sends requests to the ORC gateway instead of Anthropic's API. |
ANTHROPIC_AUTH_TOKEN |
Your ORC virtual key, sent as a bearer token. |
ANTHROPIC_MODEL |
The model used for your session. |
ANTHROPIC_DEFAULT_HAIKU_MODEL, ..._SONNET_MODEL, ..._OPUS_MODEL |
Claude Code uses these model aliases for background tasks, subagents, and the /model picker. Pointing all three at the ORC model stops those requests failing with "model not found". |
Step 2 · Run Claude Code and check the connection
Start Claude Code from the same terminal so it inherits the variables:
claude
Then type /status. Check that:
- the Anthropic base URL line shows
http://129.174.189.202, and - the Auth token line names
ANTHROPIC_AUTH_TOKEN.
Send a short prompt. A normal reply confirms the gateway is working.
Tip
If a line names a claude.ai login instead of ANTHROPIC_AUTH_TOKEN, or the base URL line is missing, the variables weren't exported in the shell you launched from. Open a new terminal, export them, and start claude again.
Step 3 · Make it permanent
Pick one of these.
Option A: a Claude Code settings file (recommended). Settings in ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json) apply wherever Claude Code runs, whichever terminal you start it from:
{
"env": {
"ANTHROPIC_BASE_URL": "http://129.174.189.202",
"ANTHROPIC_AUTH_TOKEN": "<your-virtual-key>",
"ANTHROPIC_MODEL": "qwen-3.8-27B",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen-3.8-27B",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen-3.8-27B",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen-3.8-27B"
}
}
Option B: your shell profile. Paste the export lines from Step 1 at the end of the file your shell reads, save, and open a new terminal:
| Shell | File |
|---|---|
| macOS default (zsh) | ~/.zshrc |
| Most Linux shells, including Hopper (bash) | ~/.bashrc |
| PowerShell | the file shown by echo $PROFILE |
Never put your key in a project's .claude/settings.json
That file lives inside the repository and is usually committed and shared. Keep the key in your home-folder settings file or your shell profile only.
Using the Claude Code VS Code extension
The VS Code extension reads its gateway settings from VS Code's own user settings. Open Preferences: Open User Settings (JSON) and add:
"claudeCode.environmentVariables": [
{ "name": "ANTHROPIC_BASE_URL", "value": "http://129.174.189.202" },
{ "name": "ANTHROPIC_AUTH_TOKEN", "value": "<your-virtual-key>" },
{ "name": "ANTHROPIC_MODEL", "value": "qwen-3.8-27B" }
]
Running Claude Code on Hopper
Everything above works the same on a Hopper compute node: install Claude Code in your home directory, put the variables in ~/.bashrc or ~/.claude/settings.json on Hopper, and run claude from inside your project folder. Run it on a compute node in a Slurm allocation (for example through VS Code Remote-SSH), not on a login node.
Troubleshooting
| Problem | Fix |
|---|---|
/status shows no base URL |
The variables didn't reach Claude Code. Export them in the same terminal, or use the settings file. |
| Claude Code asks you to log in | ANTHROPIC_AUTH_TOKEN isn't set in that session. |
| 401 / authentication error | The key is wrong or revoked. Re-run the key test. |
| "Model not found", sometimes during background tasks | Set all three ANTHROPIC_DEFAULT_*_MODEL variables to the ORC model name. |
| Timeouts | Connect to the Mason VPN if you are off campus. |
| You want to go back to your normal Claude login | Remove the variables (unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN ANTHROPIC_MODEL) or the env block, and start claude again. |