cliproxyui
v0.1.0-nightly.47
Published
A self-contained web console that installs, runs and manages CLIProxyAPI
Maintainers
Readme
CPA Console
A self-contained web console for CLIProxyAPI. One command downloads CPA, runs it as a supervised process and gives you a polished UI to manage it. You don't install CPA separately.
- Process management: installs the latest CPA release for your platform (checksum-verified), restarts it if it
crashes or stops answering, and updates it in one click.
/console/healthis there for uptime monitors. - Usage analytics: CPA only keeps per-request usage for a few minutes. The console drains it continuously into SQLite, so you get history by model, credential, client key and provider, with tokens, latency, failures, requests turned away before reaching an account, and what the traffic would have cost at API prices.
- Accounts at a glance: every Claude and Codex account with its 5-hour, weekly and Fable limits, how much of each is left and when it resets, plus each provider's weekly limit and Claude's Fable limit added up across accounts. A reserve (5% by default) turns an account off before its limit runs out and back on when it resets, so people who use the account directly keep some room. Accounts that start billing paid extra usage are held too, and signed-out accounts are taken out of rotation until you sign them in again. A Claude account's panel says whether its once-a-week reset of the 5-hour limit is left and how many Fable resets it has, and lets you use them. Gauges on the Overview picks which limits it shows (for all browsers); account panels still show every limit.
- Smart account order: with fill first, among accounts of the same priority, the one whose weekly limit resets soonest is used first, and accounts close to their reserve stop taking new conversations while ongoing ones keep their prompt cache.
- Wrapped: each month, or all time, as slides to post (tokens, value at API prices, top models, your daily rhythm, streaks, conversations, awards and more), or played full screen as a story.
- Insights: when each pool will reach its reserve at the current pace, which conversations lost their prompt cache and why, and a plain summary of the last 7 days.
- Credentials: Claude, Codex and Gemini (Antigravity) sign-in, file uploads, enable/disable, cooldowns, per-credential traffic and bulk actions.
- API providers & client keys: structured editors instead of raw YAML. Each upstream API key shows its spend at API prices, its rate limits and, once you enter your balance, the credits it has left. It is flagged when the provider says it is out of credits.
- API key fallback: mark a Claude or Codex API key group as a fallback and it only takes traffic while none of that provider's accounts can (all held back, cooling down or signed out). It leaves rotation a minute after an account is back, so conversations move back to the account instead of staying on the billed key.
- Settings: documented forms for routing, retries, networking and logging, plus a YAML editor with diff review.
- Logs: live log tail, CPA process output, and request and error logs.
Preview

The screenshots show a demo setup with made-up accounts and traffic.
Quick start
Requires Node.js 22.13 or newer.
npx cliproxyuiThe console prints a setup link (and opens it if it can). Open it and pick the proxy port. The management key is pre-generated, so save it, then click Start CLIProxyAPI. CPA is already downloading in the background while you fill in the form.
Clients then connect straight to CPA, e.g. http://<server>:8317/v1, using the client key shown on the Overview page.
The Connect page has ready-to-run setup for Claude Code, Codex and other clients, with the address and key of your choice
filled in, and checks from your browser that both work.
Gemini subscriptions
Gemini subscriptions sign in through CLIProxyAPI's Antigravity provider (Credentials → Add → Antigravity). All of their traffic goes out through CLIProxyAPI as the Antigravity app. The console never sends a request to Google itself, and offers no Gemini CLI or Gemini API key sign-in for subscriptions.
Antigravity accounts show no limits. CLIProxyAPI learns nothing about their quota from their traffic and keeps none,
and the only way to read it, the Antigravity app's own quota call, could only be sent from the console through
CLIProxyAPI's generic api-call, which would not look exactly like the app. So there are no meters, no reserve and no
limits added up for these accounts. When a model runs out, CLIProxyAPI cools it down on that account and moves on, as
long as cooldowns are on (Settings → Routing → Disable cooldowns off, the default, with no provider or credential
turning them off); with cooldowns off it keeps sending to the used-up account.
Signed-out accounts are taken out of rotation like Claude and Codex ones. Smart account order, the run-out forecast and
API key fallback cover Claude and Codex only.
Their traffic shows in Usage like any other account's. Claude models served through Antigravity get their API price; Gemini models have none in the console yet. Clients reach Gemini models at the usual addresses; Connect → Other clients has a Gemini-format request too.
Keep it running
npx cliproxyui service installThis installs a background service that starts at boot: systemd on Linux (a user service, or a system service when
run as root) and launchd on macOS. It installs the latest nightly into the data directory, so it never depends on the
npx cache. service status and service uninstall do what you'd expect; uninstalling keeps your data.
The console restarts CLIProxyAPI when it exits, and also when it is still running but has stopped answering for about a minute. The Overview page says when that happened.
For an uptime monitor such as Uptime Kuma, use GET /console/health (for example http://your-host:8320/console/health).
It needs no key and returns only states, times, counts and the console version, never keys, paths or account names:
200with"status": "ok"when CLIProxyAPI is running and answered its last check (every 15 seconds).503otherwise, withstatussaying why:stopped(stopped from the console),starting,stopping,crashed,unresponsive,not-installedornot-set-up.
usage.stale turns true when request records have not been collected for 10 minutes while CLIProxyAPI runs.
CLIProxyAPI drops records it holds for more than an hour, so act on it before then. In Uptime Kuma, an HTTP(s) monitor
alerts on the status code (set retries to 1, so one slow check doesn't alert); to also alert on stale usage, use an HTTP(s) - Json Query monitor with the query
status = "ok" and usage.stale = false and expected value true.
Updating
The console is a rolling nightly: every merge to main publishes a new build to npm under the default latest tag.
When a newer build exists, the console's sidebar shows Update available.
Running as a service, the dialog updates in one click. The console installs that exact build beside the running one, in
app-next in the data directory, and checks it before switching: it must report the right --version and its Node
engines must accept the Node the service runs with. If the install or a check fails, the console keeps running the
current version and the dialog shows why. Otherwise it moves the new build to app, keeps the old one as app-prev, and
exits so the service manager starts it again on the new build. The console and CLIProxyAPI are down for a few seconds;
the dialog reconnects and reloads the page once the new version answers.
Roll back in the same dialog (open it from the console version in the sidebar) switches back to app-prev and
restarts. A rollback keeps the version it replaced as app-prev, so it can be undone the same way. If the new build
doesn't come up, roll back on the server:
npx cliproxyui service rollback [--data <dir>]To turn off updating from the UI, set CPA_CONSOLE_DISABLE_UPDATE=1 when installing the service
(CPA_CONSOLE_DISABLE_UPDATE=1 npx cliproxyui service install, which writes it into the service) or in the service's
environment. The dialog then shows the command instead, and the update and rollback endpoints refuse.
A foreground run, and a service with in-UI updates turned off, show the exact command instead, including any --data,
--port or --host options the console runs with. For a service, that re-runs service install, which reinstalls the
latest nightly and keeps your data. For a foreground run, stop the console and run the npx command again; npx fetches
the new build.
CLIProxyAPI updates separately, from the Overview page; the binary it replaces is kept as bin/cli-proxy-api.old in
the data directory, so you can stop CPA and move it back if a release misbehaves.
Options
cliproxyui [start] [--port 8320] [--host 0.0.0.0] [--data ~/.cpa-console] [--no-open]
cliproxyui service install|uninstall|status|rollback [same options]| Flag | Env | Default | |
| --- | --- | --- | --- |
| --port | PORT | 8320 | Console port |
| --host | HOST | 0.0.0.0 | Bind address. Use 127.0.0.1 behind a reverse proxy or SSH tunnel |
| --data | CPA_CONSOLE_DATA | ~/.cpa-console | CPA binary, config.yaml, auth files, logs, usage database |
| | TRUST_PROXY | | Set to 1 behind a reverse proxy, so failed-login limits apply per client (from X-Forwarded-For) |
| | USAGE_RETENTION_DAYS | | Days of request and limit history to keep; unset or 0 keeps it forever |
| | GITHUB_TOKEN | | Optional; avoids GitHub API rate limits when checking for CPA releases |
| | CPA_CONSOLE_DISABLE_UPDATE | | Set to 1 to turn off updating the console from its UI (see Updating) |
Security notes
- The setup link contains a one-time token. Until setup is done, anyone with the link can claim the instance, so finish setup right away.
- The console serves plain HTTP. To reach it over the internet, put it behind a TLS-terminating reverse proxy
(Caddy, nginx), with
HOST=127.0.0.1andTRUST_PROXY=1, or use an SSH tunnel. - Five wrong keys from one address lock that address out for 15 minutes.
- The console checks the management key itself before forwarding anything to CPA. CPA's remote management stays disabled, because the console reaches it over localhost.
Development
pnpm install # also builds, via `prepare`
CPA_CONSOLE_DATA=/tmp/cpa-dev pnpm devpnpm dev runs the console server on :8320 in watch mode and Vite on :5173. Open the Vite URL; the setup link
printed by the server works there too if you change its port to 5173.
Stack: Vite, React 19, TanStack Router / Query / Table, shadcn/ui (Radix, Tailwind v4) and Recharts; the server is
Hono on Node, with node:sqlite for usage history. pnpm test runs the tests in test/ with node --test; CI runs
them on every pull request.
License
MIT
