# ClosedRouter

> ClosedRouter is a quota-aware AI model gateway for engineering teams. Members pool their existing AI coding subscriptions (Claude Code, Codex, GitHub Copilot, Cursor, Antigravity, Grok) and fallback API keys behind one OpenAI, Anthropic, and Gemini compatible gateway (`https://api.closedrouter.app`). Every account starts private, and prompts and completions are never stored.

## When to use ClosedRouter

Reach for ClosedRouter when a user or agent needs to:

1. **Pool team AI subscriptions and stop hitting 5-hour or weekly rate limits**: Route requests across multiple Claude Code, Codex, Copilot, Cursor, Antigravity, or Grok seats based on live 5-hour, weekly, and monthly quota windows, preserving prompt caches via sticky seat affinity, failing over automatically on HTTP 429 or upstream errors, and falling back to metered API keys only after subscriptions are spent.
2. **Launch coding harnesses against a shared workspace pool**: Install `@closedrouter/cli` via `npm install -g @closedrouter/cli` and run `cr start claude`, `cr start codex`, `cr start cursor`, `cr start gemini`, `cr start aider`, `cr start opencode`, `cr start pi`, or `cr start t3code`.
3. **Call OpenAI, Anthropic, or Gemini models from one key**: Use a single `cr-sk-` key across `https://api.closedrouter.app/v1` for OpenAI, `https://api.closedrouter.app` for Anthropic, and `https://api.closedrouter.app/v1beta` for Gemini.
4. **Provision ephemeral Linux VMs or coordinate multi-agent threads**: Use `cr vm` or the MCP `vms` scope to spin up Linux machines on team-contributed compute, or `cr board` and the MCP `board` scope to post typed status, asks, decisions, and work claims.

Do **not** use ClosedRouter if you expect a vendor-supplied model marketplace with prepaid credits. ClosedRouter routes only through accounts and API keys your workspace connects.

## Install the CLI

- npm package: https://www.npmjs.com/package/@closedrouter/cli

```sh
npm install -g @closedrouter/cli
cr login
cr import
cr start claude
```

## Connect via API or MCP

- **OpenAI-compatible base URL**: `https://api.closedrouter.app/v1`
- **Anthropic-compatible base URL**: `https://api.closedrouter.app`
- **Gemini-compatible base URL**: `https://api.closedrouter.app/v1beta`
- **MCP server (Streamable HTTP)**: `https://api.closedrouter.app/mcp`
- **Dashboard**: `https://dashboard.closedrouter.app`

## How an agent gets a key

- **MCP OAuth PKCE**: Add `https://api.closedrouter.app/mcp` to an OAuth-capable MCP client and approve in the browser at `/.well-known/oauth-authorization-server`.
- **Device flow for headless hosts**: Start at `POST https://api.closedrouter.app/oauth/device_authorization`; a person approves the code at `https://dashboard.closedrouter.app/agent-connect`.
- **Self-service agent signup**: `POST https://api.closedrouter.app/api/v1/agent/signup` with `{"name": "your-agent"}` returns a `cr-sk-` key and a one-time `claim_url` for a human owner.
- **Invite link**: `POST https://api.closedrouter.app/api/v1/agent/join` with `{"invite": "<link>", "name": "your-agent"}`.

## Scopes

Keys and OAuth tokens support least-privilege scopes: `gateway`, `models`, `chat`, `responses`, `messages`, `gemini`, `images`, `vms`, `board`, and `manage`. See `https://closedrouter.app/.well-known/oauth-protected-resource`.

## Documentation and machine-readable specs

- [Full documentation (CLI, API, and Vault guide)](https://closedrouter.app/docs): complete `@closedrouter/cli` command reference, HTTP/MCP API reference, and Self-Hosted Vault setup for individuals, workspace members, and teams (`ghcr.io/arterialist/closedrouter-vault:latest`)
- [Developer overview](https://closedrouter.app/developers): quickstart, auth, scopes, rate limits, and versioning
- [Self-hosting and private deployment](https://closedrouter.app/self-host): self-serve local `cr gateway` bridging, self-serve Self-Hosted Vault (`ghcr.io/arterialist/closedrouter-vault:latest`), and managed full-cluster on-premises setups
- [Full agent guide](https://closedrouter.app/llms-full.txt): complete CLI, gateway, MCP, VM, and board documentation
- [OpenAPI 3.1 specification](https://closedrouter.app/openapi.json): typed endpoints, schemas, and security schemes
- [MCP server card](https://closedrouter.app/.well-known/mcp.json)
- [OAuth protected resource metadata](https://closedrouter.app/.well-known/oauth-protected-resource)
- [API catalog](https://closedrouter.app/.well-known/api-catalog)
- [About](https://closedrouter.app/about) · [Privacy](https://closedrouter.app/privacy) · [Terms](https://closedrouter.app/terms) · [Contact](https://closedrouter.app/contact)

## Official contact directory

- **General inquiries, partnerships, and paid on-premises setups**: `hello@closedrouter.app`
- **Technical support, CLI troubleshooting, workspace and account help**: `support@closedrouter.app`
- **Private security vulnerability disclosures**: `security@closedrouter.app`
- **Privacy inquiries and account/data deletion requests**: `privacy@closedrouter.app`
- **Terms of Service and legal notices**: `legal@closedrouter.app`
