Claude Code
Anthropic's official coding agent (CLI + VS Code extension). The one command below sets everything up; prefer to see each step — the full manual walkthrough follows, with troubleshooting at the end.
Grab a key from the Keys page, run the command for your OS, paste the key when asked — done. The script installs Claude Code if it's missing (checksum-verified download of the official binary that works even where claude.ai is geo-blocked), connects it to OpusGate (~/.claude/settings.json, an existing file is backed up to .bak), and never sends your key anywhere except that local file.
irm https://opusgate.dev/install.ps1 | iex
curl -fsSL https://opusgate.dev/install.sh | bash
Then just run claude (on Windows — in a new terminal). Piping scripts from the internet? Right to be careful — read the source first: install.ps1 / install.sh. Prefer to see every step? The manual setup below does exactly the same thing.
Manual setup
Everything the installer does, by hand — install, then permanent config via settings.json, then run.
ANTHROPIC_BASE_URL = https://api.opusgate.dev — no /v1 suffix, Claude Code adds the path itself.ANTHROPIC_AUTH_TOKEN = your sk-og-... key from the Keys page.1. Install Claude Code
Skip if claude --version already works.
curl -fsSL https://claude.ai/install.sh | bash claude --version
irm https://claude.ai/install.ps1 | iex
After the installer finishes, fully close and reopen PowerShell, then check claude --version. Prefer npm? npm install -g @anthropic-ai/claude-code works on all platforms.
2. Recommended: permanent setup via settings.json
Claude Code reads ~/.claude/settings.json on every start — configure once and forget. Both the CLI and the VS Code extension use the same file.
~/.claude/settings.jsonWindows%USERPROFILE%\.claude\settings.json{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"env": {
"ANTHROPIC_BASE_URL": "https://api.opusgate.dev",
"ANTHROPIC_AUTH_TOKEN": "sk-og-...",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4.8",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4.6",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4.5",
"DISABLE_TELEMETRY": "1",
"DISABLE_ERROR_REPORTING": "1"
}
}Already have a settings.json? Merge the env block into it instead of replacing the file.
3. What this config does
"ANTHROPIC_BASE_URL": "https://api.opusgate.dev", "ANTHROPIC_AUTH_TOKEN": "sk-og-..."
Routes every request to OpusGate instead of the official Anthropic endpoint. Use ANTHROPIC_AUTH_TOKEN (sent as a Bearer token), not ANTHROPIC_API_KEY — the token variant is the correct field for a gateway and also stops Claude Code from asking you to log in to Anthropic.
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4.8", "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4.6", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4.5"
Claude Code's /model menu has three fixed slots — Opus, Sonnet, Haiku. These variables re-map each slot to an OpusGate model ID, so the standard picker keeps working. Any ID from the catalog is valid, e.g. pin the Opus slot to claude-opus-4.7 if you prefer it.
DISABLE_TELEMETRY and DISABLE_ERROR_REPORTING stop Claude Code's usage analytics and crash reports to Anthropic. They do not affect functionality — keep or drop as you like.
4. Non-interactive install (CI, scripts)
The one-command installer from the top of this page can also run unattended — pass the key inline instead of typing it at the prompt:
$env:OPUSGATE_KEY = "sk-og-..."; irm https://opusgate.dev/install.ps1 | iex
curl -fsSL https://opusgate.dev/install.sh | OPUSGATE_KEY="sk-og-..." bash
5. Run
claude
That's it — the config is picked up automatically. To verify the connection, ask it anything; the first reply confirms billing against your OpusGate balance (check Transactions). Switch models any time with /model.
6. One-off run without settings.json
For a quick test only — the variables live until you close the terminal.
export ANTHROPIC_BASE_URL="https://api.opusgate.dev" export ANTHROPIC_AUTH_TOKEN="sk-og-..." claude
$env:ANTHROPIC_BASE_URL = "https://api.opusgate.dev" $env:ANTHROPIC_AUTH_TOKEN = "sk-og-..." claude
7. VS Code extension: one extra step
- Install the extension: open in VS Code or via the Marketplace.
- Make sure
~/.claude/settings.jsonfrom step 2 exists — the extension reads the same file. - In VS Code settings (
Ctrl/Cmd + ,) enable Claude Code: Disable Login Prompt so it stops offering an Anthropic sign-in. - Reload the window (
Developer: Reload Window).
8. Troubleshooting
claude is not recognizedClose PowerShell completely and open a new window — PATH updates don't reach already-open terminals. Still failing? Run where.exe claude: if nothing is found, re-run the install script from step 1.
That means it doesn't see your token. Check that the key is set as ANTHROPIC_AUTH_TOKEN (not ANTHROPIC_API_KEY) and that settings.json is valid JSON — a trailing comma silently breaks the whole file. If you previously logged in with an Anthropic account, run /logout once.
invalid_api_keyThe key was mistyped, revoked, or has whitespace around it. Keys are shown once at creation — if in doubt, issue a new one. All error responses are listed on the error codes page.
Almost always an empty balance. Top up and retry — no restart needed.