Before you start
You need:- Claude Code installed. See the Claude Code docs if you don’t have it yet.
- A Consus API key. Get one from your Consus admin.
Step 1 (recommended): Set up an isolated Consus profile
If you use Claude Code for anything else (personal account or another organization) we recommend setting up an isolated Consus Gateway profile. This keeps your Consus credentials and settings fully isolated. Add this alias to your shell profile (~/.zshrc or ~/.bashrc):
source ~/.zshrc (or source ~/.bashrc) to pick up the alias.
Run it once to bootstrap the profile, then exit with Ctrl+C:
~/.claude-gateway/settings.json, which you’ll edit in the next step.
The rest of this guide uses claude-gateway and ~/.claude-gateway/ throughout. If you skip this step, substitute claude and ~/.claude/.
Step 2: Configure your gateway settings
Open~/.claude-gateway/settings.json and replace its contents with one of the configurations below — the one that matches your data classification. The two are identical except for the model IDs.
Option A — ITAR
Use this when handling ITAR / export-controlled data. Every call is served by a Claude model with ITAR authorization on AWS GovCloud Bedrock: Claude Opus 5 for the heaviest work (with Claude Opus 4.8 still available), Claude Sonnet 5 for standard calls, and Claude Sonnet 4.5 for background calls. Claude Haiku 5.5 (claude-haiku-5-5:itar) is available but does not yet support structured outputs through Consus, so a Sonnet still fills the background slot (see the note below). Opus 4.8 is authorized for ITAR only, so it uses the standalone :itar ID (no compliance level); Opus 5’s ITAR traffic likewise uses :itar (its FedRAMP-level ids are served from Vertex AI — see Option B); Sonnet 5 and Sonnet 4.5 are authorized at IL5 and ITAR, so they carry :il5+itar. Claude Opus 5.5 (claude-opus-5-5:itar) is also available here, routed like Opus 5, and it is the default Opus in Option B. Claude Sonnet 5.5 (claude-sonnet-5-5:itar) is available too; it is authorized at FedRAMP High and ITAR but not at a DoD impact level, so it has no :il5+itar id — Sonnet 5 stays the default Sonnet for IL5 + ITAR work.
Why Sonnet 4.5 in the background slot. Claude Code uses its background model
(
ANTHROPIC_DEFAULT_HAIKU_MODEL) for internal tasks like session-title generation, and
those calls request structured outputs
via output_config.format. Consus does not yet support that parameter on Claude Sonnet 5,
so those calls return 400 invalid_request_error. Claude Code does not surface the
failure — your session looks healthy while background tasks silently stop working.
Sonnet 4.5 supports structured outputs today and carries the same IL5 + ITAR
authorization, so it is the correct choice for this slot. Sonnet 5 remains fully
supported for conversation, which never uses this parameter.model,
availableModels, ANTHROPIC_DEFAULT_OPUS_MODEL, and ANTHROPIC_DEFAULT_SONNET_MODEL to
claude-sonnet-5:il5+itar — but leave ANTHROPIC_DEFAULT_HAIKU_MODEL on
claude-sonnet-4-5:il5+itar for the reason above.
Option B — FedRAMP High
Use this for FedRAMP High (non-ITAR) workloads. Same structure as Option A — only the model IDs change to carry the:fedramp-high level, which gives you Claude Opus 5.5 as the default Opus and Claude Opus 5 (both served from Vertex AI), Opus 4.8, Sonnet 5.5, Sonnet 5, Haiku 5.5, and Haiku 4.5 (which keeps the background slot, since Haiku 5.5 does not yet support structured outputs through Consus).
apiKeyHelper reads your key from the CONSUS_API_KEY environment variable, so export it in your shell before launching Claude Code:
~/.zshrc or ~/.bashrc to make it persist across sessions.
Conflicting shell variables: If
ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN are exported in your shell, they take precedence over apiKeyHelper and will route Claude Code around the gateway. Unset them with unset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN and remove any export lines for them from ~/.zshrc or ~/.bashrc.Previous login: If you previously logged in to Claude Code against api.anthropic.com, run /logout inside a Claude Code session to clear cached credentials before the gateway configuration takes effect.No traffic to Anthropic. Pointing Claude Code at the gateway routes your model calls through Consus, but by default Claude Code still makes its own background calls to Anthropic. These calls carry usage analytics, update checks, the plugin marketplace, and the hostname of every site the WebFetch tool visits. They do not include your prompts, code, or API key. Three settings in each configuration above (
skipWebFetchPreflight, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, and CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL) turn all of that off. With all three set, we measured zero connections to Anthropic on Claude Code 2.1.300. All three are needed, because each one covers traffic the others don’t. See Keep Claude Code off Anthropic’s network to enforce this across your organization.Step 3: Start your session
Step 4: Verify
Inside the Claude Code session, run/status:
Auth token shows anything other than apiKeyHelper (for example ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN), one of those environment variables is still set in your shell — see the Conflicting shell variables note in Step 2.
Then ask Claude Code to do something real:
What gets served
Every request from Claude Code — coding turns, background Haiku-class calls, tool use — is served by the model you configure in Step 2. With Option A that’s Claude Opus 4.8 (heavy work) and Claude Sonnet 4.5 (standard and background), both with ITAR authorization; with Option B it’s Claude Opus 4.8 / Sonnet 4.6 at FedRAMP High. The gateway routes each request to whichever government-authorized provider hosts that model at the requested compliance level (AWS GovCloud Bedrock, GCP Assured Workloads Vertex AI); the compliance boundary is enforced at the gateway architecture level. The response headerx-consus-served-model confirms the model that served each successful request (e.g. claude-sonnet-4-5).
What each setting does
apiKeyHelper
: A shell command Claude Code runs to obtain the API key. echo <key> is the simplest form — Claude Code reads the key off stdout and sends it as the x-api-key header on every request.
skipWebFetchPreflight
: Stops Claude Code from asking api.anthropic.com whether each domain is safe before the WebFetch tool fetches it. Without this, Anthropic receives the hostname of every site Claude Code fetches for you.
model and availableModels
: Pin Claude Code’s client-side model selection to the model and compliance level you want served. Must include a :level suffix.
env.ANTHROPIC_BASE_URL
: Routes Claude Code’s requests to the gateway (https://api.consus.io) instead of api.anthropic.com. The gateway exposes the same Anthropic Messages API surface.
env.ANTHROPIC_DEFAULT_OPUS_MODEL, env.ANTHROPIC_DEFAULT_SONNET_MODEL, and env.ANTHROPIC_DEFAULT_HAIKU_MODEL
: Override Claude Code’s default model IDs for its Opus, Sonnet, and background (Haiku-class) tiers. Each must be a full model:level ID; set them to the model you want serving that class of call. Option A only needs the Sonnet and Haiku tiers; Option B adds the Opus tier.
env.CLAUDE_CODE_MAX_CONTEXT_TOKENS
: Tells Claude Code the real context window behind the gateway’s model IDs. Claude Code doesn’t recognize model:level IDs, so without this it assumes a conservative 200K window and auto-compacts your session long before it needs to — the status line shows …/200k even though Claude Opus 5 and Claude Sonnet 5 are served with their full 1,000,000-token window. Setting 1000000 fixes the display and lets sessions grow to the model’s true limit. Note the [1m] model-ID suffix from Anthropic’s docs does not work with gateway model IDs — use this variable instead. The value is global (not per-model): with it set, a conversation driven past a smaller model’s window (e.g. long sessions pinned to the background-tier model) is no longer pre-compacted and will return a 400 context-window error — run /compact and continue.
env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC
: Turns off Claude Code’s usage analytics, error reporting, auto-update checks, MCP server directory lookups, and startup feature-flag calls to Anthropic. It also disables the /bug and /feedback commands and automatic updates. To update, run claude update yourself; that command contacts Anthropic’s download server only when you run it.
env.CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL
: Stops Claude Code from automatically downloading Anthropic’s official plugin marketplace. CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC does not cover this download. If the download server is blocked, Claude Code falls back to cloning the marketplace from GitHub over SSH, which bypasses HTTP proxies.
Keep Claude Code off Anthropic’s network
The three settings above stop Claude Code from contacting Anthropic, but a user can remove them from their own settings file. To enforce them for everyone in your organization:-
Use managed settings. Put
skipWebFetchPreflightand the twoenvvariables in amanaged-settings.jsonfile. Claude Code applies it on top of every user’s settings, and users can’t override it. The file goes in:- macOS:
/Library/Application Support/ClaudeCode/managed-settings.json - Linux:
/etc/claude-code/managed-settings.json - Windows:
C:\Program Files\ClaudeCode\managed-settings.json
~/.claude-gateway/settings.json) or managed settings. Don’t rely on a project’s.claude/settings.jsonfor them. - macOS:
-
Optionally, block at your network edge as a backstop. Block
*.anthropic.com,*.claude.ai,*.claude.com,*.sentry.io, and*.datadoghq.comat your firewall or proxy. Use this in addition to the settings, not instead of them: withoutCLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL, Claude Code responds to the block by cloning the marketplace from github.com over SSH.
claude update still contact Anthropic, but only when a user runs them. We tested Claude Code 2.1.300. Future Claude Code releases can add new endpoints, so the network block is the guarantee that holds across versions.