If you want to learn how to set up Claude Code with Nexus, the key is to treat it as an infrastructure integration, not just a normal app install. Claude Code already works on its own, but Nexus Router adds a unified layer for routing, observability, rate limiting, model management, and MCP aggregation that can make the workflow much more governable.

This guide uses Nexus Router’s official Using Nexus with Claude Code documentation and Anthropic’s Claude Code docs as the main references. If your goal is to understand how to set up Claude Code with Nexus in practical terms, the idea is simple: Claude Code talks to Nexus as an Anthropic-compatible proxy, and Nexus can also expose a single MCP endpoint that aggregates your tools.

Why learning how to set up Claude Code with Nexus correctly matters

If you want better results from how to set up Claude Code with Nexus, the main benefit comes from centralising control before the workflow gets messy. A direct Claude Code setup is fine for individual use, but Nexus becomes valuable when you want one place to manage model routing, token controls, telemetry, and tool access.

That matters because advanced AI development workflows often break down at the boundaries. One developer points to Anthropic directly, another uses a different model provider, a third configures MCP tools one by one, and suddenly the stack is fragmented. If you are thinking about how these systems become repeatable operating processes instead of isolated experiments, Progressive Robot’s guide to workflow automation is useful context.

What you need before you start

What you need before you start

Before you set up Claude Code with Nexus, make sure you have the basics ready.

  • Claude Code already installed and working.
  • Nexus Router v0.5.0 or later.
  • An Anthropic API key if you plan to route Anthropic models through Nexus.
  • A local machine where you can run Nexus, usually on `http://localhost:6000`.
  • A terminal session where you can set environment variables.
  • Optional MCP servers if you want Nexus to aggregate tools for Claude Code.

If you are using PowerShell, remember that environment variables use `$env:NAME=”value”` instead of `export NAME=”value”`.

How to set up Claude Code with Nexus step by step

How to set up Claude Code with Nexus step by step

1. Confirm that Claude Code and Nexus are both ready

The first step in how to set up Claude Code with Nexus is making sure you are not debugging two incomplete installs at the same time. Claude Code should already open normally in a project, and Nexus should already be installed on the machine where you want to run it.

If Claude Code is not working yet, fix that first. If Nexus is not installed yet, use the official Nexus install path before you move on to configuration. The cleanest integration is built on two already-working components.

2. Configure Nexus for the Anthropic protocol

The core of how to set up Claude Code with Nexus is enabling the Anthropic protocol endpoint in `nexus.toml`. Nexus supports the Anthropic protocol natively, which is what allows Claude Code to treat it like a compatible upstream service.

Start with a configuration like this:

“`toml
[llm]
enabled = true

[llm.protocols.anthropic]
enabled = true
path = “/llm/anthropic”

[llm.providers.anthropic]
type = “anthropic”
api_key = “{{ env.ANTHROPIC_API_KEY }}”

[llm.providers.anthropic.models.”claude-sonnet-4-20250514″]
[llm.providers.anthropic.models.”claude-3-5-haiku-latest”]
“`

The important part is not the exact model list. It is the structure: enable the LLM layer, enable the Anthropic protocol, configure the provider, and explicitly declare the models you want Claude Code to reach through Nexus.

3. Set your API key and start Nexus

Once `nexus.toml` exists, the next step in how to set up Claude Code with Nexus is providing the credentials and launching the router. The official docs use the Anthropic API key as an environment variable.

For Unix-like shells:

“`bash
export ANTHROPIC_API_KEY=”sk-ant-api03-…”
nexus –config nexus.toml
“`

For PowerShell:

“`powershell
$env:ANTHROPIC_API_KEY = “sk-ant-api03-…”
nexus –config nexus.toml
“`

By default, Nexus listens on `http://localhost:6000`. Leave that terminal running, or run Nexus through your normal service or container workflow if that is how you prefer to manage local infrastructure.

4. Point Claude Code at Nexus instead of Anthropic directly

This is the most important switch in how to set up Claude Code with Nexus. Claude Code needs to be told to send Anthropic-style requests to your Nexus instance, not to the first-party Anthropic endpoint.

Set these environment variables before launching Claude Code:

“`bash
export ANTHROPIC_BASE_URL=”http://localhost:6000/llm/anthropic”
export ANTHROPIC_MODEL=”anthropic/claude-sonnet-4-20250514″
“`

Or in PowerShell:

“`powershell
$env:ANTHROPIC_BASE_URL = “http://localhost:6000/llm/anthropic”
$env:ANTHROPIC_MODEL = “anthropic/claude-sonnet-4-20250514”
“`

Two details matter here:

– `ANTHROPIC_BASE_URL` must point to the Anthropic protocol path on Nexus.
– `ANTHROPIC_MODEL` must use the provider-prefixed format and match a model you actually configured in `nexus.toml`.

After that, you can launch Claude Code normally:

“`bash
claude
“`

5. Test the LLM proxy before you add more moving parts

If you want a reliable result from how to set up Claude Code with Nexus, do not jump straight into MCP and advanced routing before you validate the proxy itself. First confirm that Nexus is healthy and that Claude Code can see the configured models.

Useful checks include:

“`bash
curl http://localhost:6000/health
curl http://localhost:6000/llm/anthropic/v1/models
“`

Then run a simple Claude Code task such as explaining a function, summarizing a repo, or walking through a bug path. If that works, the LLM proxy part of the integration is already viable.

At this stage, you also get the core benefits of Nexus such as centralised routing, telemetry, cost controls, and the option to swap providers later without changing Claude Code’s working habits.

6. Add Nexus as an MCP server if you want tool aggregation

The more advanced part of how to set up Claude Code with Nexus is using Nexus as an MCP gateway, not just an LLM proxy. This lets Claude Code connect to a single MCP endpoint while Nexus handles downstream MCP servers for you.

First enable MCP in `nexus.toml` and define the servers you want Nexus to aggregate:

“`toml
[mcp]
enabled = true
path = “/mcp”

[mcp.servers.github]
url = “https://api.githubcopilot.com/mcp/”
auth.token = “{{ env.GITHUB_TOKEN }}”

[mcp.servers.filesystem]
cmd = [“npx”, “-y”, “@modelcontextprotocol/server-filesystem”, “/home/YOUR_USERNAME/Desktop”]
“`

Then add Nexus to Claude Code using the normal HTTP MCP path Anthropic documents:

“`bash
claude mcp add –transport http nexus http://localhost:6000/mcp
“`

After that, verify the connection:

“`bash
claude mcp list
claude mcp test nexus
“`

Once the connection works, Claude Code can search for and use the tools Nexus is exposing from all connected MCP servers.

7. Validate behaviour, observability, and scaling details

The last step in how to set up Claude Code with Nexus is making sure the integration behaves the way you expect under real use. This is where Nexus becomes more than a proxy.

Test a few practical workflows:

– Ask Claude Code to use an MCP-backed tool through Nexus.
– Check Nexus logs or telemetry to confirm requests are visible.
– Confirm the selected model is the one you intended to route.
– Verify that errors are debuggable from one control point.

There is also one important Claude Code nuance to remember. Anthropic’s MCP docs note that when `ANTHROPIC_BASE_URL` points to a non-first-party host, deferred MCP tool search is disabled by default unless the proxy forwards the required `tool_reference` blocks. If you rely on large MCP fleets, verify that behaviour deliberately instead of assuming the default experience will stay identical behind a proxy.

Common mistakes to avoid

Most Claude Code plus Nexus setup problems come from a few repeatable mistakes.

  • Forgetting to enable the Anthropic protocol in `nexus.toml`.
  • Using a model name in `ANTHROPIC_MODEL` that is not configured in Nexus.
  • Omitting the provider prefix in `ANTHROPIC_MODEL`.
  • Pointing `ANTHROPIC_BASE_URL` at the Nexus root instead of `/llm/anthropic`.
  • Adding Nexus as an MCP server before confirming the LLM proxy already works.
  • Exposing Nexus to broader networks without proper security controls.
  • Assuming MCP tool search behaviour will be identical behind every proxy.

Avoid those mistakes and the integration becomes much easier to reason about.

Who should use Claude Code with Nexus?

Claude Code with Nexus is a strong fit for teams and advanced solo developers who want more control over AI routing than a direct vendor connection gives them. It is especially useful when you need one or more of these outcomes:

  • Centralised observability for AI usage.

  • Rate limiting and cost control.

  • Multi-provider routing without retraining the team on a new interface.

  • A single MCP endpoint instead of many scattered tool connections.

  • Governance and security layers around model and tool access.

If you only want a simple local Claude Code install, Nexus may be unnecessary overhead. If you are standardising AI development workflows across people, models, and tools, it becomes much more compelling.

Troubleshooting common problems when you learn how to set up Claude Code with Nexus

Troubleshooting common problems when you learn how to set up Claude Code with Nexus

If you are still working out how to set up Claude Code with Nexus, the fastest troubleshooting path is to reduce the integration to one layer at a time.

  • If Claude Code cannot connect at all, check whether Nexus is running and whether `ANTHROPIC_BASE_URL` is correct.

  • If you get a model-not-found error, compare `ANTHROPIC_MODEL` with the exact model names configured in `nexus.toml`.

  • If you get authentication errors, verify that `ANTHROPIC_API_KEY` is set correctly before starting Nexus.

  • If MCP tools do not appear, confirm that `[mcp]` is enabled in Nexus and that `claude mcp list` shows the Nexus server.

  • If you are unsure what Claude Code is actually using, inspect the models endpoint and Nexus logs before changing other settings.

The official Nexus docs also recommend checking these commands:

“`bash
curl http://localhost:6000/health
curl http://localhost:6000/llm/anthropic/v1/models
claude mcp list
claude mcp test nexus
“`

That sequence usually tells you whether the problem is health, model config, or MCP config.

What to do after you set up Claude Code with Nexus

What to do after you set up Claude Code with Nexus

Once you finish how to set up Claude Code with Nexus, the next step is to make the integration useful rather than merely operational.

  • Add only the models you actually plan to use.
  • Turn on telemetry so you can see request volume and failure patterns.
  • Add a small number of MCP servers first instead of aggregating everything at once.
  • Use Nexus for central model naming and routing discipline.
  • Add rate limits and authentication rules before broader team rollout.

That approach gives you a stable gateway instead of a fast-growing pile of AI plumbing.

Quick checklist to confirm your Claude Code with Nexus setup is working

Before you decide that you have fully handled how to set up Claude Code with Nexus, confirm these points:

  • Nexus is running and healthy on `localhost:6000`.
  • The Anthropic protocol is enabled in `nexus.toml`.
  • `ANTHROPIC_BASE_URL` points to `/llm/anthropic`.
  • `ANTHROPIC_MODEL` matches a provider-prefixed model configured in Nexus.
  • Claude Code can complete a simple task through the Nexus proxy.
  • If you enabled MCP, `claude mcp list` and `claude mcp test nexus` both work.

Frequently asked questions

Do I need Nexus to use Claude Code?

No. Claude Code works without Nexus. Nexus is useful when you want routing, observability, policy control, or MCP aggregation around the Claude Code workflow.

Can I use Claude Code with Nexus and a non-Anthropic model?

Yes. The official Nexus docs show that you can configure other providers, such as OpenAI, behind the Anthropic-compatible endpoint and then point Claude Code at a provider-prefixed model like `openai/gpt-5`.

Is Nexus only useful for MCP?

No. Even without MCP, Nexus can still give you value through unified routing, model management, rate limiting, observability, and cost control.

What is the fastest successful first-use test?

Launch Nexus, set `ANTHROPIC_BASE_URL` and `ANTHROPIC_MODEL`, start Claude Code, and ask it to explain a real file in a real project. Add MCP only after that base flow works.

Final thoughts

If your goal is to learn how to set up Claude Code with Nexus with minimal confusion, the correct order is simple: get Nexus running, enable the Anthropic protocol, point Claude Code at the Nexus endpoint, verify the proxy, then add MCP aggregation only after the core route is stable.

Claude Code with Nexus becomes valuable when you want one place to govern models and tools instead of stitching together separate configurations across developers and workflows. Start small, verify each layer, and expand only after the base path is clearly working.