@closedrouter/cli

中文文档
1.1.64发布于 2026/11/09SEE LICENSE IN LICENSEES Module近 30 天下载 2976

ClosedRouter CLI: Onboard and import local AI subscriptions and API keys into your shared token pool

原始使用文档

ClosedRouter CLI

Connect your AI tools and shared computers to your ClosedRouter account.

npm install -g @closedrouter/cli@latest
cr login
cr start

Claude Code launches use a separate runtime with copies of your saved conversations. Start with cr start claude, then use /resume, or pass -- --resume <session-id>. The resumed conversation uses your selected ClosedRouter model. Your original Claude sessions and subscription credentials stay in their own runtime. Conversations continued through ClosedRouter keep their own history. Agent view and detached sessions are disabled for this launch because they can keep running after its gateway relay closes; ordinary subagents and background shell commands remain available.

Claude Code subscription tool handoff

Requests using Anthropic Messages, OpenAI Chat Completions, OpenAI Responses, or Gemini protocol formats can use the Claude Code subscription bridge. The CLI sends requests through Claude Code's structured stream input and detects supported features from the installed CLI. Advertised features include inline images, reasoning effort, JSON Schema output, stop sequences, and caller-run function tools when available. When a request includes function tools, the local gateway exposes only those declared tools to its restricted Claude Code process. The resulting tool calls go back to the API caller, which runs them under its own policies and returns each text or image result to the same waiting Claude Code process. The gateway's built-in shell and file tools and the machine's other MCP servers stay disabled for these requests. Install ClosedRouter CLI 1.1.58+ and Claude Code 2.1.248+ to use caller-run tool handoff.

Harness and provider compatibility

The gateway accepts OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Gemini generateContent requests and translates them to eligible provider routes. Harnesses use these formats:

Gateway formatHarnesses
Anthropic MessagesClaude Code, Claude Desktop; T3 Code with its Claude runtime
OpenAI ResponsesCodex CLI and Desktop, Grok Build; T3 Code with its Codex or Grok runtime
GeminiGemini CLI, Antigravity CLI and Desktop
OpenAI Chat CompletionsCursor Agent Local and Desktop, Aider, OpenCode, Pi, DeepSeek Harness, Grok Bot; T3 Code with its OpenCode or Pi runtime

ClosedRouter-managed Codex profiles disable Codex's provider-hosted web search and subagents. The gateway flattens Codex MCP namespace tools for routing and restores their namespace on tool-call responses, so the harness can still execute those tools locally. Codex's local shell, file, apply_patch, and ordinary function tools remain available; provider-hosted search is unavailable.

Claude Code subscription calls use the local bridge. Caller-provided tools run in the harness's workspace, so file paths should be relative to that workspace; the bridge agent's temporary working directory is separate.

Use cr verify to run a real streamed tool-call and tool-result round trip through the gateway. With no harness argument it checks all four formats. Pass a harness to check only its format, and use --provider or --all-providers to pin checks to provider routes that advertise caller-run tool support:

cr verify --model claude-sonnet-4-6 --all-providers
cr verify claude --model claude-sonnet-4-6 --all-providers

The first command checks each selected provider route across all four formats. The second checks the Anthropic Messages format against each selected provider route. Each matrix cell makes two streamed inference requests and may use provider quota or API credits; start with one model and a specific provider when you want to limit usage. cr verify exercises gateway protocol translation and provider routing; it does not launch the native harness. Claude Code subscriptions use the local Claude bridge; direct Anthropic API keys use the API-key provider. Routes without caller-run tool support remain available for text requests and are labeled in the Models view.

Run cr --help for commands. cr scan discovers supported local accounts, cr import connects accounts, and cr share publishes a computer for authorized viewing or control. Linux sharing supports an existing protected VNC endpoint through cr share --vnc and separate virtual desktops:

Account discovery supports Cursor, Antigravity, Claude Code bridge profiles, Codex, Cockpit Tools, Grok and supported API-key environment variables. For Claude subscriptions, discovery imports only non-secret profile metadata; the live local bridge supplies Claude Code access. Direct Anthropic API keys stay separate. Import requires your ClosedRouter session and lets you select accounts and their sharing settings. Only connect accounts you are authorized to use.

Sharing sends the selected desktop to ClosedRouter over an authenticated connection. Server-issued grants distinguish viewing from keyboard and pointer control, and only one control lease can own a desktop at a time. Start sharing explicitly and revoke grants or stop sharing to end access.

# Debian/Ubuntu: install tigervnc-standalone-server openbox xauth dbus-x11
cr share --virtual-desktop bot-one --name "Bot one"
# In another terminal:
cr desktop run bot-one -- chromium --user-data-dir=/tmp/bot-one-browser
cr share --virtual-desktop bot-two --name "Bot two"

Each virtual desktop appears as a separate computer. Select its computer for the corresponding bot. cr desktop list shows desktops, cr share stop --virtual-desktop bot-one stops publishing, and cr desktop stop bot-one closes its applications. Desktops isolate screen and input; applications share the Linux user's files and permissions.

Node.js 20 or later is required. The package includes native cores for macOS, Linux and Windows on x64 and ARM64. Automatic Mac capture requires macOS 15.2 or later. Proprietary integrations require an authenticated ClosedRouter connection.

Installed clients check npm for updates. The server rejects unsupported CLI versions even when automatic updates are disabled. If an update cannot install, run npm install -g @closedrouter/cli@latest and retry.

Original ClosedRouter code in this release is proprietary; see LICENSE. Third-party dependencies retain their own licenses and notices. Earlier releases distributed under MIT retain their existing grants.

See DISCLOSURE for the CLI's credential discovery, desktop control, background process and code-protection capabilities and their authorized uses.

版本与发布记录

@closedrouter/cli 共发布 62 个版本,首次发布于 2026/09/30;过去 12 个月发布了 62 个版本。

版本发布日期距今
1.1.64latest2026/11/091 天前
1.1.632026/11/081 天前
1.1.622026/11/063 天前
1.1.612026/11/045 天前
1.1.602026/11/045 天前
1.1.572026/11/036 天前

关于 @closedrouter/cli 的常见问题

@closedrouter/cli 是什么?

ClosedRouter CLI: Onboard and import local AI subscriptions and API keys into your shared token pool

如何安装 @closedrouter/cli?

在项目目录运行 npm install @closedrouter/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 cr、closedrouter,可以用 npx cr 直接运行。

@closedrouter/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/closedrouter__cli 是否存在。

@closedrouter/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@closedrouter/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@closedrouter/cli 可以商用吗?

@closedrouter/cli 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@closedrouter/cli 的下载量有多少?

根据 npm 官方下载统计,@closedrouter/cli 在 2026/10/10 – 2026/11/08 这 30 天内被下载 2,976 次,日均约 99 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@closedrouter/cli 还在维护吗?

最新版本 1.1.64 发布于 2026/11/09(1 天前);至今共发布 62 个版本,其中过去 12 个月发布了 62 个;首次发布于 2026/09/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。