OpusGate

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.

Fastest setup — one command

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.

Windows (PowerShell)
PowerShell
irm https://opusgate.dev/install.ps1 | iex
macOS / Linux
Bash
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.

Required values — everything else is optional
ANTHROPIC_BASE_URL = https://api.opusgate.devno /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.

macOS / Linux
Bash
curl -fsSL https://claude.ai/install.sh | bash
claude --version
Windows (PowerShell)
PowerShell
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.

claude.ai returns 403 in your region?
The claude.ai installers are geo-blocked in some countries. Use the one-command installer at the top of this page instead — it downloads the same official binary from a distribution mirror that isn't blocked (with checksum verification). npm also works everywhere.

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.

macOS / Linux~/.claude/settings.jsonWindows%USERPROFILE%\.claude\settings.json
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

Connection
JSON
"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.

Model slot overrides
JSON
"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.

Privacy switches (optional)

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:

PowerShell
$env:OPUSGATE_KEY = "sk-og-..."; irm https://opusgate.dev/install.ps1 | iex
Bash
curl -fsSL https://opusgate.dev/install.sh | OPUSGATE_KEY="sk-og-..." bash

5. Run

Bash
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.

macOS / Linux
Bash
export ANTHROPIC_BASE_URL="https://api.opusgate.dev"
export ANTHROPIC_AUTH_TOKEN="sk-og-..."
claude
Windows (PowerShell)
PowerShell
$env:ANTHROPIC_BASE_URL = "https://api.opusgate.dev"
$env:ANTHROPIC_AUTH_TOKEN = "sk-og-..."
claude

7. VS Code extension: one extra step

  1. Install the extension: open in VS Code or via the Marketplace.
  2. Make sure ~/.claude/settings.json from step 2 exists — the extension reads the same file.
  3. In VS Code settings (Ctrl/Cmd + ,) enable Claude Code: Disable Login Prompt so it stops offering an Anthropic sign-in.
  4. Reload the window (Developer: Reload Window).

8. Troubleshooting

Windows: claude is not recognized

Close 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.

Claude Code asks me to log in to Anthropic

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.

401 invalid_api_key

The 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.

402 / requests suddenly failing after working fine

Almost always an empty balance. Top up and retry — no restart needed.

← PreviousOverviewNext →Codex CLI