The anyr CLICLI anyranyr 命令行
Launch Claude Code, opencode or Codex through AnyRouter with one key and automatic failover.Chạy Claude Code, opencode hoặc Codex qua AnyRouter với một key và failover tự động.用一把 Key 通过 AnyRouter 启动 Claude Code、opencode 或 Codex,自动故障转移。
curl -fsSL https://anyrouter.dev/setup.sh | bashanyr login
anyr claudeInstalls anyr and ar into ~/.local/bin. No Node required. Windows is not supported yet.Cài anyr và ar vào ~/.local/bin. Không cần Node. Chưa hỗ trợ Windows.把 anyr 和 ar 装到 ~/.local/bin,不需要 Node。暂不支持 Windows。
$ 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 doesCLI làm được gì它能做什么
Sign in onceĐăng nhập một lần登录一次
anyr login opens your browser and saves the key it gets back.anyr login mở trình duyệt và lưu key nhận về.anyr login 打开浏览器,并保存拿到的 Key。
- Approve in the browser, the terminal carries onDuyệt trong trình duyệt, terminal tự chạy tiếp在浏览器里批准,终端自动继续
- Over SSH it prints the URL with the code in itQua SSH, nó in URL có sẵn mãSSH 下直接打印带验证码的链接
- Then it tells you the next commandSau đó nó chỉ lệnh tiếp theo最后告诉你下一条命令
One launcherMột launcher一个启动器
Run anyr with no arguments to see every agent, its model and its key.Chạy anyr không tham số để thấy mọi agent, model và key của nó.直接运行 anyr,就能看到每个 agent 及其模型和 Key。
- Pick Claude Code, Codex or opencode with the arrow keysChọn Claude Code, Codex hoặc opencode bằng phím mũi tên用方向键选择 Claude Code、Codex 或 opencode
- Model, account and key are set per agentModel, tài khoản và key đặt riêng cho từng agent模型、账号和 Key 按 agent 分别设置
- Type to filter, press Enter to launchGõ để lọc, nhấn Enter để chạy输入即可筛选,回车启动
Switch to a free modelChuyển sang model miễn phí切换到免费模型
The model picker shows price, context and a free tag for every model.Bộ chọn model hiện giá, context và nhãn free cho từng model.模型选择器显示每个模型的价格、上下文和免费标记。
- Search the live catalog as you typeTìm trong catalog trực tiếp khi gõ边输入边搜索实时模型目录
- Price per 1M tokens and context at a glanceThấy ngay giá mỗi 1M token và context每百万 token 价格和上下文一目了然
- The choice sticks to that agentLựa chọn được lưu cho agent đó选择会记在这个 agent 上
Launch Claude CodeChạy Claude Code启动 Claude Code
anyr claude starts the real Claude Code, pointed at AnyRouter.anyr claude chạy Claude Code thật, trỏ về AnyRouter.anyr claude 启动真正的 Claude Code,并指向 AnyRouter。
- --dry-run shows every variable it sets--dry-run hiện mọi biến môi trường nó đặt--dry-run 列出它设置的每个环境变量
- Opus, Sonnet, Haiku and subagents follow your modelOpus, Sonnet, Haiku và subagent theo model bạn chọnOpus、Sonnet、Haiku 和子 agent 都跟随你的模型
- Your key is masked, never printedKey được che, không bao giờ in raKey 会被遮住,绝不打印
Use your coding agent through AnyRouterDùng coding agent của bạn qua AnyRouter让你的 coding agent 走 AnyRouter
- Claude Code
anyr claude --model anyrouter/autoLaunch Claude Code routed through AnyRouter. anyrouter/auto picks from top models and fails over.Chạy Claude Code qua AnyRouter. anyrouter/auto chọn từ các model hàng đầu và tự failover.通过 AnyRouter 启动 Claude Code。anyrouter/auto 从热门模型中选择并自动故障转移。
- opencode
anyr opencode --model anyrouter/freeLaunch opencode routed through AnyRouter. anyrouter/free stays on $0 models.Chạy opencode qua AnyRouter. anyrouter/free chỉ dùng model $0.通过 AnyRouter 启动 opencode。anyrouter/free 只用 $0 模型。
- Codex
anyr codex --model anyrouter/autoLaunch Codex routed through AnyRouter. Same key, same presets.Chạy Codex qua AnyRouter. Cùng key, cùng preset.通过 AnyRouter 启动 Codex。同一把 Key,同样的预设。
How it worksCách hoạt động工作方式
- 01
Log inĐăng nhập登录
anyr login opens your browser. Over SSH it switches to a device code.anyr login mở trình duyệt. Qua SSH, nó chuyển sang device code.anyr login 会打开浏览器;SSH 下自动改用 device code。
- 02
Key savedLưu key保存 Key
The CLI gets a key and saves it locally in ~/.anyrouter/config.yaml.CLI nhận một key và lưu cục bộ trong ~/.anyrouter/config.yaml.CLI 拿到 Key 并保存在本地的 ~/.anyrouter/config.yaml。
- 03
Agent launchedChạy agent启动 agent
anyr claude, anyr opencode or anyr codex starts the real agent pointed at AnyRouter.anyr claude, opencode hoặc codex chạy agent thật, trỏ về AnyRouter.anyr claude、opencode 或 codex 会启动真正的 agent,并指向 AnyRouter。
First time? RunLần đầu? Chạy第一次用?运行 anyr login