Skip to content

The anyr CLI

Launch Claude Code, opencode or Codex through AnyRouter with one key and automatic failover.

Install · macOS and Linux
curl -fsSL https://anyrouter.dev/setup.sh | bash
Log in and run
anyr login
anyr claude

Installs anyr and ar into ~/.local/bin. No Node required. Windows is not supported yet.

~/project/my-app
$ anyr login  Opened your browser to approve login.    https://anyrouter.dev/cli/device?code=ABCD-EFGH  Approve in the browser — this terminal continues when you're done. Expires in 10 min.Signed in.  via browser  key sk-ar-v1-7f3c2…9a1dSaved  /Users/you/.anyrouter/config.yamlNext  anyr claude

What it does

  • Sign in once

    anyr login opens your browser and saves the key it gets back.

    • Approve in the browser, the terminal carries on
    • Over SSH it prints the URL with the code in it
    • Then it tells you the next command
  • One launcher

    Run anyr with no arguments to see every agent, its model and its key.

    • Pick Claude Code, Codex or opencode with the arrow keys
    • Model, account and key are set per agent
    • Type to filter, press Enter to launch
  • Switch to a free model

    The model picker shows price, context and a free tag for every model.

    • Search the live catalog as you type
    • Price per 1M tokens and context at a glance
    • The choice sticks to that agent
  • Launch Claude Code

    anyr claude starts the real Claude Code, pointed at AnyRouter.

    • --dry-run shows every variable it sets
    • Opus, Sonnet, Haiku and subagents follow your model
    • Your key is masked, never printed

Use your coding agent through AnyRouter

  • Claude Code
    anyr claude --model anyrouter/auto

    Launch Claude Code routed through AnyRouter. anyrouter/auto picks from top models and fails over.

  • opencode
    anyr opencode --model anyrouter/free

    Launch opencode routed through AnyRouter. anyrouter/free stays on $0 models.

  • Codex
    anyr codex --model anyrouter/auto

    Launch Codex routed through AnyRouter. Same key, same presets.

How it works

  1. 01

    Log in

    anyr login opens your browser. Over SSH it switches to a device code.

  2. 02

    Key saved

    The CLI gets a key and saves it locally in ~/.anyrouter/config.yaml.

  3. 03

    Agent launched

    anyr claude, anyr opencode or anyr codex starts the real agent pointed at AnyRouter.

First time? Run anyr login