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

# Claude Code

> Install Claude Code, point it at Triw, and pick a model.

Claude Code is Anthropic's terminal agent. It speaks the Anthropic Messages API, which Triw implements, so it runs against Triw with a base URL and a token.

## Requirements

| Item | Minimum |
| - | - |
| OS | macOS 13+, Windows 10 (1809+), Ubuntu 20.04+, Debian 10+, Alpine 3.19+ |
| Hardware | 4 GB RAM, x64 or ARM64 |
| Shell | Bash, Zsh, PowerShell or CMD |
| Network | outbound HTTPS to `router.triw.io` |

## Install

```bash macOS / Linux / WSL theme={null}
curl -fsSL https://claude.ai/install.sh | bash
```

```powershell Windows (PowerShell) theme={null}
irm https://claude.ai/install.ps1 | iex
```

```batch Windows (CMD) theme={null}
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
```

```bash npm (any OS, Node 18+) theme={null}
npm install -g @anthropic-ai/claude-code
```

```bash theme={null}
claude --version     # confirm the binary is on PATH
```

## Point it at Triw

Claude Code reads two variables: the endpoint and the credential.

```bash macOS / Linux theme={null}
export ANTHROPIC_BASE_URL="https://router.triw.io"
export ANTHROPIC_AUTH_TOKEN="sk-..."      # Triw key
claude
```

```powershell Windows theme={null}
$env:ANTHROPIC_BASE_URL = "https://router.triw.io"
$env:ANTHROPIC_AUTH_TOKEN = "sk-..."
claude
```

Persist it per user so every new shell inherits it:

```json ~/.claude/settings.json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://router.triw.io",
    "ANTHROPIC_AUTH_TOKEN": "sk-..."
  }
}
```

The base URL is the **host only** — do not append `/v1`. Claude Code adds `/v1/messages` itself.

## Choose a model

```bash theme={null}
export ANTHROPIC_MODEL="claude-sonnet-4-5"
```

List what your key may use:

```bash theme={null}
curl https://router.triw.io/v1/models -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN"
```

Inside a session, `/model` switches models and `/status` shows the resolved endpoint and account.

## Verify

```bash theme={null}
claude -p "reply with the single word: ready"
```

Then confirm the request landed: Triw console → **Logs**. A row with your key and model means the routing works.

## Troubleshooting

| Symptom | Cause | Fix |
| - | - | - |
| `401 Invalid API key` | Token empty, quoted, or trailing space | Re-export without quotes; check `echo "${ANTHROPIC_AUTH_TOKEN:0:6}"` |
| Calls still reach `api.anthropic.com` | `ANTHROPIC_BASE_URL` not exported in that shell | Export in the same shell, or use `settings.json` |
| `404` on every request | Base URL includes `/v1` | Use `https://router.triw.io` |
| `model_not_found` | Model not in the key's group | Create a key in a group that includes it |
| Login prompt appears | `ANTHROPIC_API_KEY` set in the environment | Unset it; Triw issues tokens, not Anthropic accounts |

Uninstall: delete `~/.claude` plus the binary reported by `which claude` (native installer) or `npm uninstall -g @anthropic-ai/claude-code`.


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