CLI 工具
官方命令行工具 · 一行安装 · 自动写入你的 API Key
cr — Claude Relay CLI
在终端里直接调用、调试、查询用量。支持 macOS · Linux · Windows。
$
curl -sL https://cli.cldapi.com | shmacOS
Homebrew
最推荐,自动升级
brew install cldapi/tap/cr cr auth login cr chat "你好"
Linux
APT / RPM / Binary
Debian / Ubuntu / Fedora 均可
curl -sL https://cli.cldapi.com \ | sh -s -- --prefix ~/.local cr auth login
Windows
Scoop / winget
PowerShell 友好
scoop install cr # 或 winget install ClaudeRelay.CLI
一键登录,自动写入密钥
运行 cr auth login,浏览器会打开这个页面,授权后密钥自动写入 ~/.cr/config.toml。不需要手动复制粘贴。
常用命令
cr chat "解释一下闭包" # 单轮 cr chat -m claude-sonnet-4-6 "写一首诗" # 指定模型 cr chat -f prompt.txt # 从文件读 cat long.md | cr chat # 管道输入 cr repl # 进入交互模式 cr usage --today # 查看今日用量 cr keys list # 列出密钥 cr balance # 查余额
常用选项
-m, --model <id> 模型 -s, --system <text> system prompt -t, --temperature 0.7 采样温度 --max-tokens 2048 最大输出 --stream / --no-stream 流式 --json 输出为 JSON --raw 原始 SSE --profile work 切换配置
为什么选 cr
Zero config
登录即用,不用手动粘贴 key
Stream
SSE 实时输出,⌃C 可打断
Profiles
一台电脑多账号,随时切
Shell helpers
支持 zsh / bash / fish 补全