Wrapper 脚本(ar_claude)
一条命令下载 wrapper,装到 ~/.local/bin/ar_claude,设可执行,再跑 Claude Code:
export ANYROUTER_API_KEY="sk-ar-..."
curl -sL https://anyrouter.dev/ar_claude.sh | bash -s -- "explain this project"$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"脚本:Unix 在 /ar_claude.sh,Windows 在
查看 PowerShell 脚本装好后选任意目录模型。Opus、Sonnet、Haiku 别名都指向同一个 id:
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"
CLI 启动器
或者用 CLI 一条命令处理登录和配置:
curl -fsSL https://anyrouter.dev/setup.sh | bash
anyr login
anyr claude
anyr claude --model "z-ai/glm-4.7"
anyr claude --dry-run接下来
同一套模式也适用于 Codex、Cursor,以及所有兼容 OpenAI 的 agent。一把 key 覆盖你跑的每个工具。
相关文章
Use OpenCode with AnyRouter — CLI launcher or opencode.json
Point the OpenCode coding agent at AnyRouter in one command, or add a custom Chat Completions provider in opencode.json. One sk-ar- key reaches every catalog model, with unified billing and request logs.
Point Claude Code at a custom base URL
Claude Code reads ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY, so pointing it at AnyRouter takes two environment variables — no plugin, no fork. You get every model in the catalog behind the same key, automatic failover when a provider is rate-limited, and one audit log shared with Codex, Cursor, and every other agent you run.