Skip to main content
Claude Code talks to NagaAI through /v1/messages. You can run it on your NagaAI balance with Claude models or any other tool-capable chat model. The setup follows the Claude Code LLM gateway guide.

Before you start

You need a NagaAI API key and Claude Code, installed from the official guide.

Connect Claude Code

1

Add the settings

Put the variables in ~/.claude/settings.json. Values in env of a settings file take precedence over your shell. A project .claude/settings.local.json works too, after you accept the trust prompt for that folder.
ANTHROPIC_AUTH_TOKEN sends the key as Authorization: Bearer. Set all four ANTHROPIC_DEFAULT_*_MODEL variables, because Claude Code’s built-in aliases expand to ids such as claude-opus-5-5, while NagaAI ids use a dot. Any chat model from the catalog that supports tools works in these slots, whoever made it.
2

Start Claude Code

Run claude. With model discovery on, /model lists the Claude models from /v1/models.
3

Check the connection

Run /status to see the base URL and the model in use. The first request also appears in Logs in your dashboard.

Differences through NagaAI

NagaAI drops cache_control, so Claude models get no cache hits and every turn costs the full input price. A long session therefore costs more than on a direct Anthropic account with caching. The count_tokens endpoint returns 404, so Claude Code estimates the context size and /context shows approximate numbers. NagaAI also ignores anthropic-beta headers, which turns off any feature that depends on them.

Troubleshooting

401 invalid_api_key

The key in ANTHROPIC_AUTH_TOKEN is missing or wrong. Copy it again from API Keys, and use an API key rather than a provisioning key.

400 model_not_found

A model slot holds an id that NagaAI doesn’t serve. Check the id against /v1/models, keeping in mind that NagaAI ids use a dot (anthropic/claude-opus-5.5).

402 insufficient_quota

The balance is too low for a paid model. Add credits, or switch the slots to a :free model.