Claude Code setup

Configure Claude Code with Weave Router

Run npx @weave-os/router --claude to configure Claude Code. The installer manages Claude settings for the selected scope. Check Router status and reopen Claude Code so the new routing configuration takes effect.

Source review

Claude Code · user scope

Install, inspect, reopen

Terminal

Configure the connection

npx @weave-os/router --claude

Inspect connection and account

npx @weave-os/router status --claude
  • Managed file: ~/.claude/settings.json
  • Match scope when checking status
  • Quit and reopen Claude Code

Project setup uses --scope project and the repository’s .claude/settings.json. Follow setup prompts before checking status.

Configuration scope below

At a glance

The Claude Code connection

  1. Claude settings

    The installer patches the selected user or project settings to connect Claude Code to Weave.

  2. Router endpoint

    Your configured endpoint selects a model per action from the available models and credentials.

  3. Provider response

    The model response returns to Claude Code. Check status when changing the connection.

Connection diagram, not a credential map. Hosted and self-hosted endpoints have different credential and account configurations.

How do you install the Claude Code connection?

With Claude Code available and the quickstart prerequisites met, run:

npx @weave-os/router --claude

The explicit --claude flag selects terminal installation for Claude Code. Complete the setup prompts for your endpoint and account, then inspect the result:

npx @weave-os/router status --claude

Quit and reopen Claude Code after setup or an on/off change. Claude Code reads its Router setting when it launches. An already-running session can retain the earlier setting.

What configuration changes?

Choose where the installer manages Claude Code settings:

Scroll horizontally if needed →

ScopeManaged settingsHow to select it
User~/.claude/settings.jsonDefault installation
Project.claude/settings.json in the repositoryAdd --scope project from that repository

For a project installation:

# Run from the repository you want to configure.
npx @weave-os/router --claude --scope project
npx @weave-os/router status --claude --scope project

Use the same scope when inspecting, disabling, or removing an installation. Review the managed settings and keep credentials out of version control. The installer documentation describes the current handling of plan credentials and keys; avoid copying secrets into a hand-written configuration example.

The Router configures a connection for Claude Code. It does not replace the editor, repository permissions, or tool permissions you choose in the client.

How do you check routing and available models?

Use the terminal commands for an explicit client and scope:

npx @weave-os/router status --claude
npx @weave-os/router models --claude

Inside Claude Code, the installed commands include /router-status and /router-models. They inspect the configured Router connection and model roster. Editing enabled models requires credentials with the corresponding permission.

Weave routes each upstream request, or action. A Claude Code interaction can contain many actions, so the routed model can change while the overall task continues. The semantics document defines the distinction between a session, turn, and action.

Can you use a self-hosted endpoint?

The installer supports local deployment and a custom base URL:

npx @weave-os/router --claude --local
npx @weave-os/router --claude --base-url https://router.example.com

The custom URL is an example. Use your actual deployment and follow its provider-key and access requirements. Self-hosted provider-key storage and hosted subscription access are different configurations. Do not infer the credential boundary of one from the other.

Use the Router plans for current hosted offerings and the source repository for self-hosting requirements.

How do you return to direct routing?

For a user-scope installation:

npx @weave-os/router off --claude
# Enable the saved Router connection again:
npx @weave-os/router on --claude

The installed /router-off and /router-on commands expose the same switch inside Claude Code. Quit and reopen the client after changing it. Disabling routing preserves the configuration for reuse.

To remove the installed configuration:

npx @weave-os/router --uninstall --claude

Include --scope project for a project installation. Recheck status and inspect the selected settings after removal.

What if Claude Code still uses the previous connection?

First reopen the client. Then run status for the same scope used during installation and verify the endpoint. A project configuration and a user configuration can differ. Check reported account health before changing provider settings by hand.

If the problem persists, use the current installer documentation and report the command, scope, client version, and redacted status output. Keep keys and tokens out of issue reports.

Check the evidence

Sources

Use these sources to check the definitions, configuration, and scope described above.

Weave Router

Check Claude Code setup scope

Choose user or project configuration and confirm status after reopening the client.

Read the full quickstart