# Run Claude Code on AnyRouter: wrapper script or CLI

> Route Claude Code through AnyRouter in two ways: a wrapper that installs itself and maps Opus, Sonnet, and Haiku to one catalog model (override with --model), or the anyr CLI launcher. One key, unified billing, audit logs.

- Date: August 5, 2026
- Category: guides
- HTML: https://anyrouter.dev/blog/claude-code-anyrouter

## Wrapper script (ar_claude)

One command downloads the wrapper, installs it to `~/.local/bin/ar_claude`, marks it executable, and runs Claude Code:

### macOS / Linux

```bash
export ANYROUTER_API_KEY="sk-ar-..."
curl -sL https://anyrouter.dev/ar_claude.sh | bash -s -- "explain this project"
```

### Windows

```powershell
$env:ANYROUTER_API_KEY = "sk-ar-..."
irm https://anyrouter.dev/ar_claude.ps1 -OutFile "$env:USERPROFILE\.local\bin\ar_claude.ps1"
& "$env:USERPROFILE\.local\bin\ar_claude.ps1" "explain this project"
```

Scripts: Unix at /ar_claude.sh, Windows at

[View PowerShell script](https://anyrouter.dev/ar_claude.ps1)

After install, pick any catalog model. Opus, Sonnet, and Haiku aliases all point at that same id:

```bash
export ANYROUTER_API_KEY="sk-ar-..."
ar_claude --model poolside/laguna-s-2.1 "Explain the architecture of this project"
ar_claude --model z-ai/glm-4.7 "Review this PR"
```

![ar_claude wrapper script running in a terminal](https://cdn.anyrouter.dev/screenshots/ar_claude-wrapper-demo.jpeg)

_Running ar_claude in the terminal. Every Claude Code request routes through AnyRouter._

## CLI launcher

Alternatively, the CLI handles login and config in one command:

```bash
curl -fsSL https://anyrouter.dev/cli.sh | bash
anyr login
anyr claude
anyr claude --model "z-ai/glm-4.7"
anyr claude --dry-run
```

Full reference at [anyrouter.dev/docs/cli/claude-code](https://anyrouter.dev/docs/cli/claude-code).

## Where to go from here

The same patterns work for Codex, Cursor, and every OpenAI-compatible agent. One key covers every tool you run.

More at [anyrouter.dev/docs](https://anyrouter.dev/docs).
