A shared pool of subscription accounts with CLIProxyAPI
Material structure
Why you need this
A proxy service on top of the subscriptions solves two problems.
Problem 1 — one account for several people without a ban. The vendor blocks an account that works from several devices and IPs. Through the proxy, all requests come from one server under one authorization: to the vendor it is one client, while any number of people sit behind it, each with their own API key.
Problem 2 — several accounts as one. Subscription limits burn fast. The pool is exposed to clients as one entry point, and the service itself moves requests to a fresh account when the current one runs out of quota.
The service accumulates OAuth authorizations of subscriptions (Claude, OpenAI, Gemini, Kimi, Grok) and API keys of providers such as OpenRouter, accepts requests over an OpenAI-compatible API and the native Anthropic and Gemini protocols, and serves one model list. Installation is in the README, details at help.router-for.me.
What to know before you start
You cannot use Anthropic models from Codex, or OpenAI models from Claude Code, because the OpenAI and Anthropic protocols differ: the proxy translates formats, but tool calling, thinking and caching work differently, and cross-use is unstable. The working combination: Claude Code — Claude models, Codex — OpenAI models, the rest of the pool — from harnesses with an open provider choice.
Clients have to be switched. Claude Code and Codex go to the vendor under your login by default. To route requests through the pool, the client is pointed at the proxy address — the three folds below.
Some account features are lost. Anything bound to the vendor account is unavailable through the pool: artifact sharing, cloud sessions and tasks, history sync across devices. Authorization lives on the proxy server; the client needs only the address and a key.
Where to run it
| Option | For whom | What you get |
|---|---|---|
| Locally on the workstation | one person, several subscriptions | balancing across your own accounts, host: 127.0.0.1 — nothing exposed |
| A separate machine with a public domain | a team, a shared pool | a key for every member from the panel; accounts authorized once; quotas and logs in one place |
The Management Center panel opens at https://<domain>/management.html. In it:
- Auth Files — adding accounts, OAuth login right from the browser;
- AI Providers — API-key providers (OpenRouter and others);
- Config → api-keys — keys for members, one per person or machine, so access is easy to revoke.
The service has no built-in usage statistics — for that, run a separate dashboard such as cpa-usage-keeper.
Switch the clients
Three kinds of setup: Claude Code, Codex, and anything that speaks an OpenAI-compatible API.
Claude Code · CLI and desktop app
Environment variables in ~/.claude/settings.json (shared by the CLI and the desktop app):
{
"env": {
"ANTHROPIC_BASE_URL": "https://<domain>",
"ANTHROPIC_AUTH_TOKEN": "<your-key>",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1",
"API_TIMEOUT_MS": "600000"
}
}ANTHROPIC_AUTH_TOKEN— the key from the panel, replaces the Anthropic login on this machine.CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY— the model list is taken from the proxy.- For a single session — the same variables via
exportbefore runningclaude.
If already signed into Anthropic — /logout, otherwise the client may go direct. Pick Claude models (/model).
Rollback — remove the env block and run /login.
Codex · CLI and desktop app
A provider in ~/.codex/config.toml:
model = "gpt-5.6-sol"
model_provider = "cliproxyapi"
[model_providers.cliproxyapi]
name = "OpenAI"
base_url = "https://<domain>/v1"
wire_api = "responses"
requires_openai_auth = true
experimental_bearer_token = "<your-key>"experimental_bearer_token— the key from the panel; no ChatGPT login orauth.jsonneeded.- Model name — from the proxy's list; pick OpenAI models.
Rollback — remove model_provider and run codex login.
OpenAI-compatible harnesses · OpenCode, Pi, Hermes, OpenClaw and others
Any agent with a "custom OpenAI endpoint" setting:
| Agent | What it is |
|---|---|
| OpenCode | open-source terminal coding agent, providers via opencode.json |
| Pi | minimalist coding agent with extensible tools |
| Hermes Agent | general-purpose agent by Nous Research with memory and skills |
| OpenClaw | personal assistant with channels (Telegram, WhatsApp and more) |
| Cline, Aider, Goose and similar | IDE and terminal agents with an "OpenAI-compatible base URL" field |
Connecting takes two parameters:
export OPENAI_BASE_URL="https://<domain>/v1"
export OPENAI_API_KEY="<your-key>"The harness fetches the model list itself and shows the whole pool under aliases. This is where a mixed pool is most convenient: such a harness is not tied to one vendor's protocol.
An OpenCode example — opencode.json in the project root or in ~/.config/opencode/:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"pool": {
"npm": "@ai-sdk/openai-compatible",
"name": "Team pool",
"options": {
"baseURL": "https://<domain>/v1",
"apiKey": "{env:POOL_API_KEY}"
},
"models": {
"claude-opus-5": { "name": "Claude Opus 5" },
"gpt-5.6-sol": { "name": "GPT 5.6" }
}
}
}
}The model is selected as pool/<name> via /models; the key lives in an environment variable, not in a file in the repository.
For tools with a separate "Anthropic endpoint" field — https://<domain> and the same key.
