Skip to content
NewNexus 2.0 is here, and it’s open source. Read the launch post

Guides

Claude Code through Nexus Gateway

Set up Claude Code so every model call goes through Nexus Gateway on your organization's key, metered and recorded.

View as Markdown

Read this first

  • This is the Gateway route. Every call goes through Nexus Gateway on your organization's Anthropic key: reserved, metered, checked against your organization's policy and attributed to you. Nexus credit never pays for it. Your own Claude plan is not used.
  • Plain nexus claude, with no route flag, runs on your own Claude plan instead, unless you saved another route. Every command below names --api.
  • Every call reserves the most it could cost before it is sent, and Claude Code asks for its model's full output limit. On a large model one call can reserve more than a small monthly limit has left, and Gateway refuses it with 402 before it runs. Name a smaller model with --model, or ask an owner or admin about your limit.

Set up and run

  1. Install the nexus CLI. It needs Node.js 22.6 or later and curl. If the installer says its folder is not on your PATH, add the line it prints to your shell's profile, then open a new terminal.

    curl -fsSL https://api.nexus.inc/install.sh | bash
  2. Install Claude Code. Nexus never installs it for you. If claude is not found afterwards, add ~/.local/bin to your PATH.

    curl -fsSL https://claude.ai/install.sh | bash
  3. Sign in to Nexus and approve the code in Nexus UI. The code expires after ten minutes.

    nexus auth login
  4. Owner or admin. If nexus keys list shows no Anthropic key, add the organization's key, once. Without a key, Gateway refuses the call with 403.

    nexus keys add anthropic <key>
  5. Run one prompt through Gateway, on a small model so even a $1 monthly limit covers the call.

    nexus claude --api --model claude-haiku-5-5 -p "Reply with the single word pong"

Check it worked

The call shows in your spend under agents › claude, and the session in Nexus UI.

nexus spend

What Nexus changes for the run

For each run with --api, Nexus points Claude Code at your Gateway's /v1/anthropic with your Nexus sign-in as ANTHROPIC_AUTH_TOKEN, and changes no file. It removes ANTHROPIC_API_KEY, CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX, CLAUDE_CODE_USE_FOUNDRY from Claude Code's environment, so its calls can only go through Nexus.

How it is tested

  • One prompt through Gateway by the steps above, recorded in nexus spend
RunDateClaude CodenexusFirst callSteps skippedResult
claude-code-2026-10-26-12026-10-262.1.3100.12.0+7d18f422m 03sprovider_keypass
claude-code-2026-10-27-12026-10-272.1.3120.14.0+69e1c091m 50sprovider_keypass

Each run is a record in eng/factory/kit/recipes/runs/, with its steps' times, the call and what got in the way.