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 format | Harnesses |
|---|---|
| Anthropic Messages | Claude Code, Claude Desktop; T3 Code with its Claude runtime |
| OpenAI Responses | Codex CLI and Desktop, Grok Build; T3 Code with its Codex or Grok runtime |
| Gemini | Gemini CLI, Antigravity CLI and Desktop |
| OpenAI Chat Completions | Cursor 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.