
# Claude Code

[Claude Code](https://www.anthropic.com/claude-code) is Anthropic's
CLI agent. It expects an Anthropic API endpoint, which LowRouter
exposes via the `/api/v1/anthropic` prefix.

## Configure

Set environment variables before starting Claude Code:

```bash
export ANTHROPIC_BASE_URL=https://lowrouter.ai/api/v1/anthropic
export ANTHROPIC_API_KEY=lr-sk-...
claude
```

Or persist them in your shell profile (`~/.zshrc`, `~/.bashrc`).

## Picking a model

Claude Code uses the model defined in its settings. Edit
`~/.claude/settings.json` to pin a LowRouter-routed Claude model:

```json
{
  "model": "anthropic/claude-sonnet-4-5"
}
```

The model string is the LowRouter ID (`anthropic/claude-sonnet-4-5`),
not Anthropic's short name. The full list of supported Claude models
is on the [model browser](/models) — filter by provider `anthropic`.

## Recommended setup

- **Dedicated key.** Same daily-limit advice as the other agents.
- **EU residency**: pin the key's region to `eu-west` so Claude
  requests are served from EU endpoints. This survives IDE restarts
  and machine swaps without per-session config.
- **Audit usage on the dashboard.** The transaction detail page shows
  token counts and cost per generation, which Claude Code itself does
  not surface in real time.

## Troubleshooting

- **Claude Code can't reach the API**: the base URL must end with
  `/anthropic` (no trailing slash). Claude Code appends `/v1/messages`
  internally.
- **Model "not found"**: confirm the model exists on the
  [model browser](/models). Anthropic adds and deprecates models
  faster than the model browser updates; a 404 usually means the model
  is no longer routable.
- **The agent stalls during streaming**: this is sometimes a
  network-buffering issue between Claude Code and LowRouter. Setting
  `CLAUDE_CODE_STREAM_BUFFER=0` (if the version you run supports it)
  disables the client-side buffer.
