> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trynito.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Code

> Route Claude Code through Nito with environment variables.

The [Nito Plugin](/plugin/get-started/install-claude-code) adds `/nito:` commands alongside Claude Code's own model. Manual routing sends Claude Code's ordinary model requests through the Nito API. Choose the route that matches the session you want.

## Configuration

Claude Code speaks the Anthropic Messages API, and Nito serves it at `POST /v1/messages`. Four environment variables route the session through Nito.

| Variable | Value |
| :- | :- |
| `ANTHROPIC_BASE_URL` | `https://app.trynito.ai`, the host root. Claude Code appends `/v1/messages`. |
| `ANTHROPIC_AUTH_TOKEN` | Your `z_sk_` key, sent as `Authorization: Bearer`. `ANTHROPIC_API_KEY` also works; it sends the key as `x-api-key`, which Nito accepts too. |
| `ANTHROPIC_MODEL` | A catalog ID such as `anthropic/claude-sonnet-5`. Overrides the `model` setting. |
| `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` | `1`. The Messages endpoint rejects pre-release request fields such as `context_management` with `400`, and Claude Code does not retry those. |

```bash wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
export ANTHROPIC_BASE_URL="https://app.trynito.ai"
export ANTHROPIC_AUTH_TOKEN="z_sk_your_key_here"
export ANTHROPIC_MODEL="anthropic/claude-sonnet-5"
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
claude
```

You can keep the non-secret settings in the `env` block of `~/.claude/settings.json` and supply `ANTHROPIC_AUTH_TOKEN` from your shell or secret manager. Keep keys out of a project's `.claude/settings.json`, which can be committed and shared.

```json wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://app.trynito.ai",
    "ANTHROPIC_MODEL": "anthropic/claude-sonnet-5",
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}
```

Start a new Claude Code session after changing these settings. The host root in `ANTHROPIC_BASE_URL` is deliberate: Claude Code appends `/v1/messages`. A `/v1` suffix there produces the wrong path. Choose an `anthropic/...` ID available to your account from the [catalog](/models/all-models). Use a `:confidential` ID only if that exact Claude variant appears in the live catalog.

## Check the route

Ask for a one-sentence reply, then try a small file task that uses Claude Code's client tools. The first request checks model and key access; the second checks the tool loop. A Nito API key is separate from any Claude Code subscription or login.

If you get 401, check the exported `ANTHROPIC_AUTH_TOKEN` in the process that starts Claude Code. For 404, check the base URL and the exact model ID. A 400 mentioning `context_management` or experimental beta fields points to `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` being absent from the launched process.

## What This Route Supports

Nito serves `/v1/messages` and `/v1/messages/count_tokens` with text, image, and document blocks, client tools, thinking controls, and Anthropic web-search tool definitions, which map to Nito's web search.

Rejected on this route: other Anthropic server-side tools, `context_management`, `mcp_servers`, computer-use tools, and the Chat Completions model feature suffixes. Previous `thinking` blocks in history are accepted and dropped. Claude Code's manual provider route is for Claude model IDs; use the [Nito Plugin](/plugin/get-started/what-the-plugin-is) to call other models inside Claude Code.

## Related

<CardGroup cols={3}>
  <Card title="Anthropic SDK Drop-in" icon="code" href="/api/get-started/quickstart-anthropic-sdk">
    The Messages endpoint from code.
  </Card>

  <Card title="Messages Endpoint" icon="book" href="/api/api-reference/endpoints/messages/createanthropicmessage">
    Fields and limits.
  </Card>

  <Card title="Codex" icon="terminal" href="/api/sdks/editor-integrations/codex">
    Manual routing through the Responses endpoint.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.