@anyr/cli
v0.2.8
Published
AnyRouter CLI — one key launches Claude Code, Codex, Grok Build, and more through the gateway. `npx @anyr/cli <tool>`
Maintainers
Readme
@anyr/cli
The AnyRouter CLI — one key points your favorite AI coding tools at the gateway. Launch Claude Code, Codex, Grok, opencode, or Poolside through AnyRouter, or export a ready-to-paste config for Cursor, Cline, and Windsurf.
npx @anyr/cli # no arg → animated onboarding TUI
npx @anyr/cli chat # chat with any model right in your terminal
npx @anyr/cli claude # launch Claude Code through the gateway
npx @anyr/cli codex # launch Codex
npx @anyr/cli pool # launch Poolside through the gateway
npx @anyr/cli opencode # launch opencodeThe package installs three bin aliases — use whichever you like:
npx @anyr/cli claude
anyr claude
anyrouter claude
ar claudeFirst run sets you up once (paste an sk-ar- key or log in at
anyrouter.dev/cli/authorize). Config is
saved to ~/.anyrouter/config.yaml (a one-time migration copies any older
~/.config/anyrouter/config.yaml forward).
Targets
Run npx @anyr/cli <target>. There are two kinds:
Built-in targets run inside the CLI and call the gateway directly (no child
process). Pick them from the launcher menu (npx @anyr/cli, then ‹ › on the
Launch row to switch target):
| Target | What |
|--------|------|
| AnyRouter Chat | Streaming chat TUI (also npx @anyr/cli chat) |
| AnyRouter Agent | Autonomous agents + cloud skills (coming soon) |
Spawn targets launch the tool as a child process pointed at the gateway:
| Target | Tool | Command |
|--------|------|---------|
| claude | Claude Code | npx @anyr/cli claude |
| codex | Codex | npx @anyr/cli codex |
| grok | Grok Build | npx @anyr/cli grok |
| pool | Poolside | npx @anyr/cli pool |
| opencode | opencode | npx @anyr/cli opencode |
Editor targets can't be launched from a terminal, so the CLI shows a copy-paste config block (base URL + key) to drop into the editor's settings:
| Target | Editor |
|--------|--------|
| cursor | Cursor |
| cline | Cline |
| windsurf | Windsurf |
Chat in your terminal
npx @anyr/cli chat # pick up your saved key, start chatting
npx @anyr/cli chat --model z-ai/glm-5.2 # start on a specific model
npx @anyr/cli chat --effort high # turn on extended reasoningchat is a streaming REPL built straight on @anyr/sdk (no extra
dependencies). It auto-connects with your saved key — or, on a fresh machine,
runs the same one-time setup as the launchers (paste a key, browser login, or
--device-code for SSH). Features:
- Streaming replies with live reasoning rendering (dimmed, when the model
emits it —
reasoningorreasoning_content). - Switch models mid-chat (
/modelopens a fuzzy picker, or/model <id>). - Tune reasoning with
/effort low|medium|high|xhigh|max|offand toggle the reasoning display with/reasoning. - Automatic context compaction — older turns are summarized as you approach
the model's context window (re-sized when you switch models); force it with
/compact. - Slash commands (Tab-completes):
/help/model/effort/reasoning/system/compact/clear/retry/tokens/models/save/exit. - Controls:
Ctrl-Cstops a streaming reply,Ctrl-Dquits.
How it routes your tools
The CLI never edits a tool's own config files or stores credentials inside
them. For spawn targets it sets the gateway base URL and auth token only in
the environment of the child process it launches — e.g. ANTHROPIC_BASE_URL
for Claude Code, OPENAI_BASE_URL for Codex and opencode, GROK_MODELS_BASE_URL
for Grok. The override lives only for that session; quit the tool and nothing
about your global setup has changed.
Editor targets get the same values rendered as a KEY=VALUE block you paste
into the editor yourself — nothing is written on your behalf.
The TUI
Running with no target opens an animated onboarding flow, then a menu. It's a
raw-ANSI terminal UI with zero runtime dependencies (network calls go through
@anyr/sdk), so it starts fast and adds nothing to your node_modules.
- Animated onboarding — a progressive logo reveal and a braille spinner for
async steps. Honors
NO_COLORand non-TTY terminals: in those it renders plainly with no animation. - Adaptive settings panel — the settings shown change per target. Claude Code and Codex expose model, reasoning effort, and routing preset; Grok exposes model and base URL; editor targets expose base URL and key for the config export. You only see the knobs a given target actually has.
Flags
npx @anyr/cli claude --model auto --effort high -- --resume
npx @anyr/cli claude --model "anthropic/claude-sonnet-4.6"
npx @anyr/cli codex --effort xhigh
npx @anyr/cli claude --dry-run # print child command + env (secrets redacted)Commands
| Command | Description |
|---------|-------------|
| npx @anyr/cli chat | Chat with any model in your terminal (streaming TUI) |
| npx @anyr/cli claude | Launch Claude Code |
| npx @anyr/cli cc | Alias of claude |
| npx @anyr/cli codex | Launch Codex |
| npx @anyr/cli grok | Launch Grok Build |
| npx @anyr/cli pool | Launch Poolside |
| npx @anyr/cli opencode | Launch opencode |
| npx @anyr/cli setup | Save a local profile |
| npx @anyr/cli models | List catalog model ids |
| npx @anyr/cli config | Inspect or switch profiles |
Config
npx @anyr/cli config get # redacted summary
npx @anyr/cli config get --json # redacted config as JSON
npx @anyr/cli config path # config file location
npx @anyr/cli config use work
npx @anyr/cli models # catalog ids for --model
npx @anyr/cli models --json # catalog as { auto, preset, models[] } JSONWhat's new
See CHANGELOG.md for the release history. Highlights:
animated onboarding TUI with NO_COLOR / non-TTY fallbacks, an adaptive
per-target settings panel, nine targets (six spawn + three editor
config-export), runtime-env-only routing (the tool's own config is never
touched), and all gateway calls centralized through @anyr/sdk so the CLI
stays dependency-free.
Deprecated packages
Per-tool launcher packages (@anyr/claude, @anyr/codex, @anyrouterdev/cc,
etc.) are deprecated. They still work via shims that forward to
@anyr/cli <tool> but will be removed in a future release.
Docs: https://anyrouter.dev/docs/cli
