One key for every AI account.
One self-hosted, OpenAI-compatible endpoint for your AI API keys, with fallbacks, prompt caching, and cost estimates by model and client key.
Provimux, by providers.dev, is a self-hosted AI gateway for you or your whole team. Put your Anthropic, OpenAI, Gemini, Vertex, xAI and Meta keys, OpenRouter and any OpenAI-compatible service behind one endpoint that speaks the OpenAI, Claude and Gemini formats, give each person their own client key, and point their tools at it. Several keys can serve one name, tried by priority, so a rate-limited key hands the request to the next. To keep the prompt cache in use, Provimux adds cache markers on OpenRouter, keeps each conversation on one upstream, and forwards the longer cache lifetime on OpenAI API keys. Provimux identifies the answering account and, when it can map the upstream request, the model it sent; the console's Savings page estimates cost by model and client key. Provimux is an open-source (MIT) distribution of CLIProxyAPI by router-for-me, tested against each CLIProxyAPI release.
Provimux · the endpoint (this repository) · provimux-ui · its web console · providers.dev
brew install ngvoicu/tap/provimuxBefore the first start, open $(brew --prefix)/etc/provimux.conf and set two things: management.secret-key, a
secret you choose for the console, and at least one client key of your own under access.api-keys (the file ships
with none, and while the list is empty every request is refused). Then start the service and check that the gateway
accepts your client key:
brew services start provimux
curl -fsS http://127.0.0.1:8317/v1/models -H "Authorization: Bearer <your client key>"The console is at http://127.0.0.1:8317/management.html; sign in with your management key. By default it signs in
only on the server itself: from another machine the page opens but the sign-in is refused, until you set
management.allow-remote: true (For a team). Step by step, Docker, release archives and building
from source: Install.
What you get with your API keys.
- One address for every tool. Anthropic, OpenAI, Gemini, Vertex, xAI and Meta keys, OpenRouter and any
OpenAI-compatible service behind one endpoint that speaks the OpenAI, Claude and Gemini formats. Give a model a
name of your own (
opus) and change what is behind it without touching your tools. - No stalled work when a provider has a bad minute. Put several keys under one name (
opus: your Anthropic key first, then OpenRouter). A key that is rate-limited or cooling down hands the request to the next; an overloaded Anthropic or OpenAI key gets one quick second try first; and once the first key is free, a conversation can go back to it by itself, after a time you set. - Reuse a cached prompt while the provider keeps it. Cache markers and a stable session on OpenRouter, the longer cache lifetime your client asks of OpenAI (for example 12 hours) passed through, and, with session affinity on, each conversation kept on the same key, also across a restart or an upgrade.
- Know what answered, with cost estimates by model and client key. Provimux identifies the answering account and, when it can map the upstream request, the model it sent; your tools can then get that model's published prices and cache lifetimes from providers.dev; Savings gives cost estimates by provider, host, model and client key (a model without a price is counted but left out of the amounts), with OpenRouter's own reported cost where it gives one, and what prompt caching was worth.
- New models without editing the config, and only the ones you want. OpenRouter and other OpenAI-compatible entries can discover new models on refresh. Claude, OpenAI, xAI, Meta and Gemini keys with configured model rows can do this too. Vertex and Interactions keys are excluded. One switch, Serve only my names, serves only the names you chose.
- For a team. One client key per person, removed without touching the others; usage and cost estimates per client key on Savings; a web console to add, fix and turn off keys; and Pi support.
Cache: reuse a cached prompt while the provider keeps it.
- OpenRouter built in. Cache markers added where the client sent none (Claude among them), a 1-hour lifetime kept through translation, one upstream per conversation so the cache keeps being read, and each model's real limits and reasoning levels for an OpenRouter key.
- The longer prompt cache on OpenAI API keys: a client's
prompt_cache_options.ttl(for example"12h") is forwarded instead of removed. - Conversations keep their account across a restart: with session affinity on, a conversation that sends its session id goes back to the key whose cache holds it after an upgrade or a restart.
- An overloaded provider does not cost you your first account. When Anthropic's or OpenAI's own API refuses a request because it is overloaded, Provimux sends it once more to the same key before it moves on down your list.
- Send a conversation back to your first account. With session affinity on, a client sees which key its conversation is bound to and whether a higher-priority one is free again, and releases it so that its next message goes to the first free key.
- A conversation that fell back goes back by itself. Set
routing.session-affinity-return.cold-after, and a conversation that fell back to a lower-priority key goes back at its next message once none of its messages has been routed to an account for that long. Off unless set. - A Codex WebSocket replay that stays a replay: a re-sent conversation is no longer merged into a double transcript billed at about twice the input.
Clarity: you see which key serves which models, which account answered, and cost estimates by model and client key.
- Which account serves each model, and which one answered.
The model list names, per model, the API keys (
apikey) and any logins (oauth) behind it, by priority, and every response says which one answered. - Which model entry answered. An answer names the providers.dev entry of the model the key received when Provimux can map the request it sent, so a tool can know the price and the cache lifetime of what really answered.
- Prices and cache lifetimes for your tools.
GET /v1/models?include=entriesnames, per model and account, the providers.dev entries your answers were and the one Provimux expects, so a tool reads prices and cache lifetimes from providers.dev itself; a client that does not ask gets the list as before. - Savings: daily usage totals kept across restarts, valued at the list price providers.dev publishes for the entry each answer named: cost estimates by provider, host, model and client key (and the cost OpenRouter reported), and what prompt caching was worth.
- Model lists for API keys that keep themselves up to date. A key with its own
models (every OpenAI-compatible entry, such as OpenRouter) also offers the models its service lists, without a
save in the console;
excluded-modelsandfixed-modelskeep it to what you want. - Serve only my names. One switch, off by default: only the names you set (your aliases, and the names you keep) are listed and served; every other name is treated as excluded, and a tool that asks for one is told why.
- The right context and output limits for the models you declare under an API key.
- Its own console pages in provimux-ui: Accounts, Models (every name you can send and the keys behind it, by priority, with the cooldown recorded and its reason) and Savings, read from Provimux's own endpoints.
- Works with Pi, through two extensions that show which key answered.
Then: Install · For a team · The console · Versions and releases · Features in detail · Subscription logins · Requests to providers · Support · Built on CLIProxyAPI · License
By default Provimux reads its settings from config.yaml, keeps its logins in the auth folder ~/.cli-proxy-api, and
listens on port 8317.
macOS (Apple silicon and Intel) and Linux (x64 and Arm), from the tap ngvoicu/homebrew-tap:
brew install ngvoicu/tap/provimuxThe formula needs Homebrew 6.0.12 or newer; an older one stops with that message before installing anything (brew update brings it up to date).
The config is $(brew --prefix)/etc/provimux.conf, created from config.example.yaml on first install, readable by
you alone, and never overwritten. Before the first start, set two things in it:
- The management key,
management.secret-key: a secret you choose. You sign in to the console with it; while it is empty, the management API is off and the console cannot sign in. - At least one client key, under
access.api-keys: the key your tools send. The file ships with none, and while the list is empty every request to the API is refused (401).openssl rand -hex 24makes one. A config from an earlier install may still hold the template's three placeholder keys,your-api-key-1toyour-api-key-3: replace all three, because a single one left keeps the API off ("Example API key detected" in the console).
management:
secret-key: "a-secret-you-choose"
access:
api-keys:
- "a-long-random-key-of-your-own"Start the service and check that the gateway accepts your client key:
brew services start provimux
curl -fsS http://127.0.0.1:8317/v1/models -H "Authorization: Bearer a-long-random-key-of-your-own"{"data":[],"object":"list"} means it does: the list fills once you add a provider key (Your
accounts). curl printing an error 401 means the key is not in access.api-keys, 403 that a
placeholder key is still there. Then open the console on the same machine, http://127.0.0.1:8317/management.html,
and sign in with your management key.
The console is local by default. Until management.allow-remote is true, the management API answers only
requests from the server itself: from another machine, http://<your-server>:8317/management.html opens, but the
sign-in is refused ("remote management disabled"). To manage the server from elsewhere, set
management.allow-remote: true in the config (it applies when the file is saved) and sign in with the same
management key, over HTTPS outside a network you trust (For a team).
The config is yours alone. It holds your provider keys, your client keys and the management key. Homebrew
creates it readable by its owner only (mode 0600), and Provimux keeps it so: at every start and every save it sets
the file back to 0600, with a line in the log when it changed it (and an error that says how to fix it when it
cannot), creates a new auth folder at 0700, and sets the login and state files it writes there to 0600; other files
in that folder keep their modes. A config from an earlier install was readable by every user of the machine (0644) until Provimux next
starts. Check and fix yours now with one command; the line it prints starts with -rw-------:
chmod 600 "$(brew --prefix)/etc/provimux.conf" && ls -l "$(brew --prefix)/etc/provimux.conf"If other people have accounts on that machine, consider replacing the keys the file held. With Docker or a release
archive, the same command on your config.yaml (chmod 600 config.yaml) does it.
linux/amd64 and linux/arm64, ghcr.io/ngvoicu/provimux. The image holds only the template,
/CLIProxyAPI/config.example.yaml; it needs a config.yaml from you, so make one first, in a folder of its own:
mkdir provimux && cd provimux
docker run --rm --entrypoint cat ghcr.io/ngvoicu/provimux:latest /CLIProxyAPI/config.example.yaml > config.yaml
chmod 600 config.yaml
mkdir authsIn config.yaml, set the management key (management.secret-key) and at least one client key of your own under
access.api-keys, as for Homebrew. Then start it and check that it accepts your client key:
docker run -d --name provimux -p 127.0.0.1:8317:8317 \
-v "$PWD/config.yaml:/CLIProxyAPI/config.yaml" \
-v "$PWD/auths:/root/.cli-proxy-api" \
ghcr.io/ngvoicu/provimux:latest
curl -fsS http://127.0.0.1:8317/v1/models -H "Authorization: Bearer <your client key>"Create config.yaml before the first docker run: when the file is missing, Docker mounts an empty folder in its
place and Provimux stops at start. -p 127.0.0.1:8317:8317 publishes the port to this machine only; for other
machines, use -p 8317:8317.
The console in a container. Requests from the host reach the container through Docker's network, so Provimux
counts them as remote: until management.allow-remote: true, the console's sign-in is refused ("remote management
disabled"), in the host's own browser too. Set it in config.yaml to use the console, with a long management key.
The image is built as CLIProxyAPI's is and uses its paths: the config at /CLIProxyAPI/config.yaml, the auth folder
at /root/.cli-proxy-api, logs in /CLIProxyAPI/logs and plugins in /CLIProxyAPI/plugins. Each release is also
tagged with its version (ghcr.io/ngvoicu/provimux:8.1.8-pmx.2).
Compose. The repository's docker-compose.yml runs the same image (ghcr.io/ngvoicu/provimux:latest, or
CLI_PROXY_IMAGE when set) with the same mounts, so make config.yaml and auths as above, beside it, then run
docker compose up -d. It also publishes the callback ports of the subscription logins, and gives a stop 40
seconds (stop_grace_period). docker compose build builds the image from this repository
(.github/provimux/Dockerfile).
The image's default TZ is upstream's Asia/Shanghai, and Savings
keeps its totals per day of that zone: set TZ (e.g. -e TZ=Europe/Bucharest) before the first run, since days
cannot be re-cut later.
Download the archive for your system from Releases:
| System | Archive | Binary |
|---|---|---|
| macOS, Apple silicon | provimux_<version>_darwin_aarch64.tar.gz |
provimux |
| macOS, Intel | provimux_<version>_darwin_amd64.tar.gz |
provimux |
| Windows, x64 | provimux_<version>_windows_amd64.zip |
provimux.exe |
| Windows, Arm | provimux_<version>_windows_aarch64.zip |
provimux.exe |
| Linux, x64 | provimux_<version>_linux_amd64.tar.gz |
provimux |
| Linux, Arm | provimux_<version>_linux_aarch64.tar.gz |
provimux |
| Linux, x64, portable | provimux_<version>_linux_amd64_no-plugin.tar.gz |
provimux |
| Linux, Arm, portable | provimux_<version>_linux_aarch64_no-plugin.tar.gz |
provimux |
| FreeBSD, x64 | provimux_<version>_freebsd_amd64.tar.gz |
provimux |
| FreeBSD, Arm, no plugins | provimux_<version>_freebsd_aarch64_no-plugin.tar.gz |
provimux |
<version> is the Provimux version, for example 8.1.8-pmx.2; checksums.txt in each release lists the SHA-256 of
every archive. The default Linux builds need glibc 2.17 or newer; the Linux _no-plugin builds also run on musl-based
or older systems such as OpenWrt. _no-plugin builds do not support plugins.
An archive holds the binary, config.example.yaml, the READMEs and the license, and no config.yaml: Provimux
stops at start without one. On macOS or Linux, for example the Apple silicon build:
mkdir provimux && cd provimux
curl -fLO https://github.com/ngvoicu/provimux/releases/download/v<version>/provimux_<version>_darwin_aarch64.tar.gz
tar -xzf provimux_<version>_darwin_aarch64.tar.gz
cp config.example.yaml config.yaml
chmod 600 config.yamlIn config.yaml, set the management key (management.secret-key) and at least one client key of your own under
access.api-keys, as for Homebrew. Then start it, and in a second terminal check that it accepts your
client key:
./provimux --config config.yaml
curl -fsS http://127.0.0.1:8317/v1/models -H "Authorization: Bearer <your client key>"{"data":[],"object":"list"} means it works; Ctrl+C stops it. On Windows the same steps use provimux.exe and
copy config.example.yaml config.yaml. The binaries are not notarized: on macOS, an archive downloaded with a browser
is quarantined and Gatekeeper refuses the binary; curl as above does not quarantine it (or run
xattr -d com.apple.quarantine provimux). To run it as a service, use your system's service manager, or
Homebrew, whose service does it for you.
With Go:
git clone https://github.com/ngvoicu/provimux
cd provimux
go build -o provimux ./cmd/server
./provimux --config /path/to/your/config.yamlA fresh checkout has no config.yaml, only config.example.yaml. Pass your config with --config, or copy the
example (cp config.example.yaml config.yaml), edit it, and start with --config config.yaml.
For logins and the configuration reference, CLIProxyAPI's
documentation applies; config.example.yaml in this
repository includes the Provimux options.
To upgrade a Homebrew install, then check that the service answers:
brew update
brew upgrade ngvoicu/tap/provimux
brew services restart provimux
curl -fsS http://127.0.0.1:8317/v1/models -H "Authorization: Bearer <your client key>"The last command prints the model list (JSON) only when the new process is up and accepts your key; an error means
it is not (the service log, $(brew --prefix)/var/log/provimux.log, says why). brew upgrade installs the new
version and leaves the running service on the old one; brew services restart switches. That restart drains: the old process takes no new connections, lets the answers in flight finish (up to 25
seconds, below), then exits, and the new version starts; a client that retries reaches it. Your config, logins and
history stay as they are.
A restart no longer cuts the answers being written. On a stop or restart (brew services restart provimux,
docker stop, a systemd stop, Ctrl+C), Provimux lets the HTTP answers in flight finish for up to 25 seconds and
then exits; with nothing in flight it exits at once. This holds for existing installs too, with nothing to edit:
a shutdown-timeout of 0 no longer means no wait, and one set above 25 still gives its longer wait.
- New connections are refused during the wait; a client that retries reaches the new process.
- Not waited for: a Responses WebSocket turn (Pi and the Codex CLI use these on some routes) and an answer through the AI Studio relay.
- What is still running when the wait ends is cut. A second Ctrl+C does not shorten the wait.
server.restart-drain-seconds, a whole number from 0 to 30, sets the wait, and 0 turns it off. A number above 30
is taken as 30 and one below 0 as 0, with a warning in the log.
server:
restart-drain-seconds: 0The service manager has to allow the wait. The Homebrew service allows 40 seconds from Homebrew 6.0.13; an older
Homebrew leaves launchd's own limit, about 5 seconds on macOS 27. docker stop kills a container after 10
seconds: give it more with docker stop -t 40, docker run --stop-timeout 40, or stop_grace_period: 40s in
Compose.
brew services stop provimux
brew uninstall ngvoicu/tap/provimuxThat removes the program. What it made stays, so that a reinstall finds it:
| What | Where (the defaults) |
|---|---|
| The config: provider keys, client keys, the management key | $(brew --prefix)/etc/provimux.conf |
| The console Provimux downloaded, and the model lists and prices it keeps | $(brew --prefix)/etc/static/, $(brew --prefix)/etc/model-lists/ (beside the config) |
| The service log | $(brew --prefix)/var/log/provimux.log |
Logins (one credential file each), Savings history and the rest of the state (kv.db, kv.db.affinity, kv.db.affinity-key, provimux-answered.v1), and a logs/ folder when there are request or error logs |
the auth folder, oauth.auth-dir in the config: ~/.cli-proxy-api |
To delete what is Provimux's alone (rm -i asks before it removes each file):
rm -i "$(brew --prefix)/etc/provimux.conf" "$(brew --prefix)/var/log/provimux.log"The folders etc/static/ and etc/model-lists/ belong to whatever config sits in $(brew --prefix)/etc: another
gateway with its config there, such as CLIProxyAPI's own formula (cliproxyapi.conf), uses the same static/. Look
first, and delete them by hand only when no other gateway's config is there:
ls "$(brew --prefix)/etc"/*.conf "$(brew --prefix)/etc/static" "$(brew --prefix)/etc/model-lists"Delete the auth folder only when nothing else uses it (next section); otherwise delete only the login files you made through Provimux.
Provimux's default auth folder, ~/.cli-proxy-api, is CLIProxyAPI's default too. When CLIProxyAPI (or another build
of it) runs on the same machine under the same user with its default, both use the folder: each sees the other's
logins, and their state files sit side by side. To tell, list the programs with files open in it (a running gateway
keeps its kv.db open), and look for auth-dir in the other install's config:
lsof +D ~/.cli-proxy-api 2>/dev/null | awk 'NR > 1 { print $1, $2 }' | sort -uAny program there besides provimux shares the folder. To give Provimux one of its own, set it in
provimux.conf, then restart and sign in to your logins again (or, with Provimux stopped, copy the login files you
want to keep into the new folder):
oauth:
auth-dir: "~/.provimux"Provimux creates the new folder readable by you alone. The old folder keeps what Provimux wrote there before.
Add API keys under api-keys in your config: claude (Anthropic), codex (OpenAI), gemini, vertex, xai,
meta, and openai-compatibility for OpenRouter and other OpenAI-compatible services. For a company, use API keys and
cloud accounts (for example Vertex), billed to the company under its own agreement with the provider. Give a key a
priority to set the order in which keys of one model are tried, and models rows with an alias to give models
names of your own.
Logins: see Subscription logins.
Your API keys behind one self-hosted endpoint, a client key per person. For a team, credentials billed to the
company; a subscription login only as its provider's terms allow. Run Provimux on a server the team can
reach, with Homebrew, a release archive or the Docker image each release
publishes (ghcr.io/ngvoicu/provimux), and point everyone's tools at http://<your-server>:8317. It listens on every
interface by default (server.host: ""), and says so in the log at start; server.host: "127.0.0.1" keeps it to the
machine itself.
-
One client key per person, under
access.api-keys. Each person's tools send their key asAuthorization: Bearer <key>. Removing a key from the list shuts out only that person, and removing the last key shuts out everyone: an empty list refuses every request (401). The change applies when the file is saved, without a restart. Savings shows each key by its last 4 characters (for keys of 16 characters or more), so give every key a different ending.access: api-keys: - "replace-with-a-long-random-key-1" - "replace-with-a-long-random-key-2"
-
No client keys, on your own machine only.
access.allow-unauthenticated: trueanswers requests without a client key. Provimux checks it at start against the address it really binds: only a loopback one (127.0.0.1,::1orlocalhost); on any other, the default included, it refuses to start and says why. A reload that changes the setting is logged as needing a restart and changes nothing until then.server: host: "127.0.0.1" access: allow-unauthenticated: true
-
Home mode. A Home node answers requests without a client key, so it starts on a listener other machines can reach only with
home.allow-lan: true(-home-allow-lanwith-home-jwt); on loopback nothing changes. -
The console from other machines. Until
management.allow-remote: true, the management API and the console answer only requests from the server itself. Every request, local or remote, needs the management key,management.secret-key(hashed on startup; while it is empty the management API is off), and five wrong keys from one address block that address for 30 minutes. Give the management key only to whoever runs the server: it can read and change the whole config, every client key included. -
TLS. Client keys and the management key travel with every request, so outside a network you trust, serve HTTPS: either Provimux's own
server.tls(enable: true, withcertandkeyas paths to PEM files), or a reverse proxy in front of it. Behind a reverse proxy on the same machine, every request reaches Provimux from 127.0.0.1 and the console would count it as local: setserver.trusted-proxiesto the proxy's address so that Provimux uses the client's real address.
The curl examples below use $PROVIMUX for the server's address (http://127.0.0.1:8317 on the same machine).
Provimux's web console is provimux-ui, the CLI Proxy API Management Center in the providers.dev look, with Provimux's own pages: Accounts, every API key (and any login) in one list, with its state and its priority (Working means the key is on and Provimux has recorded no cooldown or refusal for it, not that a call to it succeeded: a key nobody has used yet shows Working); Models, every model name you can send, with the keys that serve it in the order Provimux tries them, the cooldowns it recorded and where each list comes from, your own names, and the switch Serve only my names; and Savings, cost estimates by provider, model and client key, and what prompt caching was worth. The original's pages stay one click away, under Advanced settings. Its README describes each page.
Nothing to install: Provimux downloads the latest provimux-ui release by itself, at startup and every 3 hours, and
installs the file only when its size and SHA-256 match what GitHub's release API lists for it; with no SHA-256 there,
it installs nothing. Only when no console is installed yet and GitHub's API cannot be reached does it take the file
from the release's download address instead, checked against the release's checksums.txt. A config that still
names the original console (management.panel-github-repository) gets provimux-ui too. Open
http://127.0.0.1:8317/management.html on the server itself and sign in with your management key
(management.secret-key in your config; while it is empty, the management API is off). From another machine the
page opens, but the sign-in is refused until management.allow-remote: true (For a team). To keep a
console version, turn the updates off with management.disable-auto-update-panel: true.
A Provimux version names the CLIProxyAPI release it is built on: v8.0.79-pmx.1 is CLIProxyAPI 8.0.79 with Provimux
build 1.
Releases are automatic. When CLIProxyAPI publishes a release, a workflow moves Provimux onto it, builds and tests it,
and when the check passes publishes v<base>-pmx.1 on its own: the release archives, the Docker image and the Homebrew
formula. A release that fails a check waits for the owner, and the reason is in an issue.
.github/provimux/SYNC.md describes the whole process, and
.github/provimux/CHANGELOG.md lists Provimux's own changes.
The startup banner and the X-CPA-VERSION response header show the Provimux version, with the CLIProxyAPI release it
is based on. The version sent to providers is CLIProxyAPI's (8.0.79 in this example), so providers see the same
client as with CLIProxyAPI.
What you get. An OpenRouter key works like a built-in provider: prompt caching for models that cache only when asked (Claude among them), one conversation kept on one upstream so its cache keeps being read, and each model's real context window, output limit and reasoning levels.
Why it matters. Through a plain OpenAI-compatible entry, a Claude model on OpenRouter is cached only when the
client itself sends OpenAI chat-format requests with cache_control markers: CLIProxyAPI forwards those as they are.
A Claude-format client's markers are lost when its request is translated, and a client that sends no markers gets
none, so every such request pays for the whole prompt. Every model also gets the same generic limits and the levels
low, medium and high, with max lowered to high.
How to turn it on. Nothing to configure: any openai-compatibility entry whose base URL is on openrouter.ai
gets it.
api-keys:
openai-compatibility:
- name: "openrouter"
base-url: "https://openrouter.ai/api/v1"
keys:
- api-key: "sk-or-v1-..."
models:
- name: "anthropic/claude-opus-5.5"
- name: "openai/gpt-6.1-terra"| Part | What Provimux does |
|---|---|
| Prompt cache | A request without cache markers gets them on the last system message and on the latest user, tool or assistant message that can carry one (text, file parts and assistant prefills). An OpenAI chat-format request that already has markers keeps them where your client put them, as CLIProxyAPI does; Provimux adds none, though for openai/* models it may add mode: "explicit" to the request's prompt_cache_options (next row). A Claude-format request loses its markers in translation, so it gets Provimux's: a marker your client put on an early user message ends up on the last turn instead, and a 1-hour lifetime asked for anywhere in the request is kept. |
| OpenAI cache lifetime | For openai/* models, a client's prompt_cache_options.ttl (for example "12h") is sent the way OpenRouter applies it, with mode: "explicit"; a mode the client sent is kept. |
| Session | An X-Session-Id header, stable for the conversation, so OpenRouter keeps it on one upstream. An X-Session-Id set in the entry's headers in your config wins, then your client's own X-Session-Id, then the one Provimux derives. No X-Session-Id is sent only when all three are absent: no header in your config, no header from your client, and no session Provimux can derive from the conversation. |
| Limits | OpenRouter's public model list is fetched in the background and refreshed; each entry gets its context window and output limit from it. max-context-length in your config still wins. |
| Reasoning levels | The model's own levels (for example low to max), when your config sets no thinking for it. |
| Owner | owned_by is the model's vendor (anthropic for anthropic/claude-opus-5.5), not the entry's name. |
What you get. A client that asks for a longer prompt-cache lifetime on an OpenAI API key gets it:
prompt_cache_options.ttl (for example "12h") is forwarded on Codex API-key credentials. OpenAI's default is 30
minutes on GPT-5.6 and later.
Why it matters. CLIProxyAPI removes prompt_cache_options for every Codex credential. That is required for
ChatGPT logins, which answer 400 to it, but an API key supports it.
How to use it. Send it in a Responses request; nothing to configure.
{ "model": "gpt-6.1-terra", "prompt_cache_options": { "ttl": "12h" }, "input": "…" }Only ttl is carried, and only when the client sends it as a non-empty string and the request arrives in the
Responses format. No default is added. Subscription logins are unchanged.
What you get. The OpenAI-format model list can tell you, for each model, which of your accounts serve it: the
provider, whether it is an API key (apikey) or a login (oauth), its priority, and for an API key the
host it calls. Every response served by an account then says which account answered it.
Why it matters. The same model can be reached through more than one account, and accounts differ in limits, prompt-cache lifetime and price: a Claude API key keeps the prompt cache for five minutes unless the request asks for an hour, and an OpenRouter key bills at OpenRouter's prices. Without this, a client behind the proxy cannot tell which one it is using.
How to use it. Nothing to turn on.
GET /v1/models?include=accountsadds anaccountsarray to every model, highest priority first, so the first entries are the ones Provimux tries first. Without the parameter the list is unchanged. Only this plain OpenAI-format list has it: the Codex-format list (/v1/models?client_version=…) and the Claude-format list carry noaccounts.- Each account has
provider,kind(oauthorapikey) andpriority. An API key with a base URL also hashost, which names the service even when you gave the entry another name (openrouter.aifor an entry calledopenrouter,my-routeror anything else). A credential's own email, file and key fields are left out. The name you chose for an OpenAI-compatible entry is shown: itsproviderisopenai-compatible-<name>, so clients that can read the model list see that name, including an email if you named the entry with one. - A response served by an account (a completion, for example) carries an
X-CPA-AUTH-KINDheader (oauthorapikey), anX-CPA-AUTH-PROVIDERheader (itsprovider, as in the model list) and, for an API key with a base URL, anX-CPA-AUTH-HOSTheader, for the account that answered, next to CLIProxyAPI'sX-CPA-TRACE-ID. The model list itself has no such header. When a request is retried on another account before the answer starts, the header names the one that answered. Browsers can read it, like the trace ID. - On the Codex WebSocket (
/v1/responses), which has response headers only once per connection, each turn'sresponse.createdevent carries"cpa_auth_kind": "oauth"or"apikey", withcpa_auth_providerandcpa_auth_hostbeside it.
PROVIMUX=http://127.0.0.1:8317 # on the same machine; from another machine, use the server's address
curl -s "$PROVIMUX/v1/models?include=accounts" -H "Authorization: Bearer $KEY"Priorities are CLIProxyAPI's: set priority on an API-key entry, or in a login's file, and the higher value is tried
first. For example a Claude API key at 10 and a second Claude API key at 0: the first is tried first, and the
second takes over while the first has a cooldown recorded.
Every answer now says which of your accounts gave it, even when you have two of the same kind, and says nothing about that account. Each account gets a marker: the same on every answer it gives, different from every other account's. Its e-mail, key, file name or the provider's id for it cannot be read from the marker.
It is on, with nothing to edit. models.answered-by: false turns it off; the X-CPA-AUTH-* headers stay as they
are either way.
models:
answered-by: false- A response served by an account carries an
X-Provimux-Accountheader, next toX-CPA-AUTH-KIND. On the Codex WebSocket, each turn'sresponse.createdevent carriesprovimux_accountbesidecpa_auth_kind. An answer that names no account, an error for example, carries neither. GET /v1/models?include=accountsgives each account its marker asaccount, so you can find the row that answered.- A marker is
a.ors.followed by 20 lower-case letters and digits, for examplea.k3v7qz2m5xw4hn6tb2rc. a.means the marker is made from the account as its provider names it: two equala.markers are one account.s.means Provimux does not hold the provider's own name for the account (a Kimi login, an AI Studio connection, a Claude login without an organisation id, for example), so the marker names this one login or key, and two differents.markers may still be one account.- A browser on another site can read the header when the response already lets it read other headers.
- Markers stay the same across restarts and upgrades: the key they are made with is kept in the gateway's store
file (
server.kv-store, on by default). If that file is lost or deleted, every account gets a new marker. With the store turned off, the markers change at every restart. - In Home mode nothing is sent: no header, no WebSocket field and no
accountin the list, whatever the switch.
A tool behind Provimux can know the price and the cache lifetime of what really answered. When Provimux can map the
upstream request, an answer names the providers.dev entry of the model the account received, for example
anthropic/claude-opus-5-5. The tool looks the
entry up and has the figures that apply, without knowing the provider and without guessing from the model's name.
One name can reach your Anthropic key, OpenRouter or another account, and an alias or a rule can change the model on the way. So Provimux reads the entry from the request it sent; it never predicts it.
- On each answer, next to
X-Provimux-Account:X-Provimux-Entry(<provider>/<model>),X-Provimux-Model-Sent(the model id Provimux sent), andX-Provimux-ModelwithX-Provimux-Model-Basis: not-confirmed(the vendor's answer has not confirmed it). On the Responses WebSocket the same values are fields of each turn'sresponse.created(provimux_entry,provimux_model_sent,provimux_model,provimux_model_basis). A turn the gateway itself sends upstream over a WebSocket (a Codex login withwebsockets: true) names the account and no entry. - Before an answer,
GET /v1/models?include=accountsgives each account rowanswered: the entries that account's answers for that model to your key named, newest first, each with the day of the last one, at most four."entry": nullmeans those answers named no entry;[]means none is recorded yet. Another key's answers are not on your rows. It is a record, not a promise: take the answer's ownX-Provimux-Entryas soon as there is one. Provimux keeps it inprovimux-answered.v1in the auth folder, so it survives a restart, and drops an item after 90 days. - No entry is a normal answer: Provimux's own map has no row for where the request went, or Provimux could not be certain which request answered. The account is still named. Show no price rather than a guess. A named entry says where the model would be on providers.dev, not that providers.dev lists it.
- Plugins. Once a plugin serves a provider, that provider's answers name the account and no entry until Provimux restarts. A login a plugin made names no entry either.
- Only in Provimux as shipped. A program built from Provimux's code gets the account marker and nothing more.
Known limits.
- An answer can come without its entry if, while it runs, you load a plugin for its provider and add a login of that provider. The entry is missing, never wrong; the next answer names it.
- A record file Provimux cannot read is replaced at the next answer; what it held is lost.
- Two Provimux on one auth folder share that file: after a restart, each reads the one written last.
How to turn it off. models.answered-by: false turns the entry and answered off with the account marker. In
Home mode nothing is sent.
A tool behind Provimux can know what the account that answered costs and how long its prompt cache lives, without knowing any provider. Provimux tells it which providers.dev entry a model is on each account; the tool reads that entry's price, cache lifetimes and limits from providers.dev itself, as published:
curl -s "$PROVIMUX/v1/models?include=entries" -H "Authorization: Bearer $KEY"- What comes back (contract 2). The list as
include=accountsgives it, plus"contract": 2, and on each row that carries an account:answered(the entries your own key's answers from it named, newest first),expected(the entry Provimux expects for that model on that account where nothing between the route and the wire can change it, elsenull), andadds(what Provimux adds to an ordinary conversation turn, e.g.{"cache.retention": "1h"}on a Claude login; never to a probe, a title helper or a subagent without the 1-hour opt-in). No price, lifetime or limit is passed. - From an answer to its entry. Each answer's
X-Provimux-Entrynames it. Before any answer, take the first account'sanswered, else itsexpected. expectedis never a guess. It isnullwherever the executor still decides the host or the model (Antigravity, Devin, Vertex, Copilot, Meta, Kimi), where a payload rule can reach the model, where the account sets its ownHostor credential header, over an upstream WebSocket, for a pool, for a request that sends no model, and wherever a plugin took part. Reading the list moves no routing.- The model lists use the same entries. The Claude, Gemini, Codex client and Grok Shell lists, and the console's
routes, give a model's window, output limit, levels and kinds of input from the entries its routes name, read by
providers.dev's rules; where none is named, or one account serving the name names none, they say nothing (
null, no level, or left out): no more 200,000 and 64,000 by default, and no value from the bundled catalog, a vendor's list or Home. What is sent upstream is unchanged. - Nothing changes for a client that does not ask. Without
includethe OpenAI-format list is byte for byte what it was. - Contract 1, frozen.
GET /v1/models?include=figures(andGET /v8/management/provimux/figuresfor the console) still give the figures object as it was, unchanged, for two more releases; then it is removed. Tools should move toinclude=entries. - The contract is
openapi.yaml, with example answers beside it.
How to turn it off. models.published-lists: false keeps Provimux from contacting providers.dev at all: no
entries held, no figures (state is off), and no limits in the model lists. models.answered-by: false removes the
entries from answers and rows.
models:
published-lists: falseWhat you get. Provimux adds up every request into daily totals, kept in the local store across restarts, and
values them at public list prices. GET /v8/management/provimux/savings answers, for a range of days: tokens by
bucket (uncached input, cache reads, cache writes with their 5 minute and 1 hour parts, output, reasoning), the cache
hit rate, the estimated cost, the cost without the cache and the worth of prompt caching (the difference, at API list
prices), and the cost an upstream reported (OpenRouter's usage.cost). Breakdowns by day, month, provider, host,
model, client key and account kind (apikey or oauth) come in the same call. The console's Savings page reads it.
Why it matters. It estimates what your requests cost: per provider and host, per model and per client key, at list prices and, on OpenRouter, as OpenRouter reported it; and what prompt caching was worth. Two keys of one provider and host are counted together.
How to use it. Nothing to turn on: recording starts with the management routes (a management key is
configured) and needs the local store (server.kv-store, on by default) to survive a restart. Removing the
management key later hides the endpoint (404) but recording continues: the totals stay in your own local store.
- A request is one usage record: one attempt at one upstream; a retried request counts once per attempt. It counts
under the provider of the account that served it (a Kimi login stays
kimi, also on its Claude Messages route). - A day is the server's local calendar day (
TZ; see Docker). The answer names the zone and the server's today. - Everything under
estimateis an estimate at base list prices (prices.ratessaysbase): the higher rates some models charge above a prompt size (long context) are not applied, so long prompts are valued below what they cost. The prices are providers.dev's, for the entry each answer named (X-Provimux-Entry): the entry's price in effect, a subscription's at the API list price providers.dev publishes for it, a cache write at the price of the lifetime the usage reports (OpenAI's 30 minutes and 12 hours included). A request whose answer named no entry, or whose entry publishes no price for its tokens, is counted, named and left out of the amounts, and the model says why (unpriced_reasons). The saving subtracts the cache-write premium and can be negative. The worth of caching includes subscription requests at list price: there caching saves quota, not money, so it is a worth, not money saved; and the value of subscription requests at API prices is not what the subscription saved. - No extra request: the prices come from the providers.dev entries Provimux already holds (
models.published-lists). OpenRouter's list is no longer downloaded. - A client key appears as an id only this server can compute (an HMAC with a secret in the local store) and, for a key of 16 characters or more, its last 4 characters. No response, log or stored value carries a key, a token, an auth ID, an account email or a base URL beyond its host. Stock CLIProxyAPI answers 404 on the path.
- Rows count a request under the model the account ran: an alias's traffic under the vendor's model, without an
account's prefix.
include=requested_modelsaddsrequested_models: requests and tokens by the name the client sent (an alias, a prefixed name, without a thinking suffix, in the case it was sent), over the whole range, filters aside. It is recorded since the version that added it;requested_models.fromis the first day that has it, and earlier days count only in the rows. Names recorded before the version that kept their case are lower case: a tool that sentB-Coderthen shows asb-coder, which only-my-names (exact names) does not take forB-Coder. Nothing else in the answer changes.
The contract is openapi.yaml, with example answers next to it.
curl -s "$PROVIMUX/v8/management/provimux/savings?period=month&group=kind&group=key" \
-H "Authorization: Bearer $MANAGEMENT_KEY"What you get. An API key with its own models list (every openai-compatibility entry, and Claude, Codex,
xAI, Meta and Gemini keys with rows) keeps that list up to date by itself. The key offers:
- every row of its
modelsinconfig.yaml, exactly as written: name, alias and every setting; - plus every model its service lists that no row already names, under the service's own id;
- minus its
excluded-models.
An openai-compatibility entry with no rows offers its service's whole list. Before, such a list changed only
when you pressed "Get the list from …" in the console and saved; that button stays, and is how a model gets an
alias or its own settings.
Why it matters. Services such as OpenRouter add models every week. An eligible key discovers them after a successful refresh of its list (a failed refresh keeps the last good list), and a model the service retires goes with its next successful list, unless a row of yours names it: rows are never dropped, and the console marks a row the service no longer lists.
Upgrading: what changes. It is on by default, so after you upgrade, each eligible key with rows (Claude, OpenAI,
xAI, Meta and Gemini keys; Vertex and Interactions keys are never asked) starts offering its service's other models
after its first successful refresh. When one of them is a model another of your accounts also serves (an OpenAI key listing
a model another key or a login already serves), requests for it are shared between them at equal priority, and
the key's share is paid per token. The controls:
priorityon the key or the login, as before: the higher one is used first;excluded-modelson the key, with wildcards (gpt-5.5*,x-ai/*,text-embedding-*);openai-compatibilityentries have it too now, and it applies after the refresh, so taking a model out ofmodelsno longer keeps it out:excluded-modelsdoes;fixed-models: trueon the key (or its group underapi-keys:): it offers exactly its rows and its service is never asked. Vertex and Interactions keys accept it and are never asked anyway. Set it with the console or aPUTof the key list; the older per-entryPATCHendpoints do not take it.
openai-compatibility:
- name: openrouter
base-url: https://openrouter.ai/api/v1
excluded-models: ["x-ai/*", "text-embedding-*"]
# fixed-models: true # offer exactly the rows below; never ask OpenRouter for its list
models:
- name: anthropic/claude-opus-5.5
alias: or-opusThe Model lists endpoint below shows, per key, which models it learned from its service (key.learned) apart
from its rows, and which rows its service no longer lists (key.unlisted). The console's Models page shows every
account serving a model, and marks a model a key learned.
- The request is the one the console's button sends, to the host you configured for the key, with that key, its
headers and its proxy:
<base-url>/modelsfor anopenai-compatibilitykey (once more without the key and headers when the service answers 401 or 403, for services whose list is public),/v1/modelsfor Claude (withanthropic-version), Codex, xAI and Meta keys, every page of/v1beta/modelsfor a Gemini key on its own host. A Gemini key on Google's own host already had its list read: it is now added to the rows instead of ignored. Vertex and Interactions keys are not asked. - Eligible keys discover models only after a successful refresh. A refresh runs at startup, every 3 hours, on
POST /v8/management/models/refreshand when a key is added or changed; 30 seconds per fetch; a failure keeps the last good list (or the rows) and is retried after 10 minutes; a list not refreshed for 7 days gives way to the rows. Each key holds its own list, so two keys of one entry can see different models. The disk cache holds a hash of the key, never the key. - Nothing is written to
config.yaml: the models a key learned exist only in memory and in the cache, so a save from the console or a reload never carries them. Requests never wait for a fetch. - A learned model gets what a row with only its name would get: on OpenRouter, OpenRouter's window, output limit and
reasoning efforts; on a Claude, Codex, xAI, Meta or Gemini key, the catalog's values when the catalog has the id.
A model that needs a setting of its own (
use-max-completion-tokens, an alias) needs a row, as before. - A key's list never teaches the shared catalog: a gateway behind a Claude key can list anything.
models.live-lists: falseturns this off for every key and login. A service that lists non-chat models (embeddings, speech) offers them too; hide them withexcluded-models.
What you get. With models.only-my-names.enabled: true, the gateway lists and serves only the names you set; every
other name is treated as an excluded model is: it is not listed to clients, and a request for it is refused. Your
accounts keep registering exactly what they offer; the switch decides what clients see and may ask for. A name you set
is one your config sets, and nothing else:
- the
aliasof amodelsrow of an API key or anopenai-compatibilityentry, when it differs from the row'sname; - the
aliasof anoauth-model-aliasrow; - a name under
models.only-my-names.keep: a model kept under its vendor's name (claude-opus-5-5,devin/claude-opus-4.6,team-a/gpt-5.5). Exact names only; an entry with*, andauto(which clients send for "the first available model"), are ignored, with a warning in the log (a pattern would let tomorrow's models in without your word).
A copy of one of your names under a prefix your config gives a key or provider entry is yours too: with
prefix: crew on an entry and mine yours, crew/mine is served. An alias written in a login's own file is not
one of your names, and a prefix written only in a login's own file is not one the config gives: the status lists such
a name, or such a copy, with the other names, and one click on the console (or the full name under keep) makes it
yours. So what is yours follows from the saved config alone, and a request is answered from the rule of one saved
config and the name it asks for, whatever the accounts are registering at that moment.
Names are compared exactly, as a request is matched to a model: trimmed, and nothing else. keep: [mixed-case] does
not make Mixed-Case yours, and a request must spell the name as you wrote it: with the switch on, MINE is refused
when your name is mine (with the switch off CLIProxyAPI would also try the lower-case spelling). A name with a
thinking suffix is served when its name without it is yours: opus(high) when opus is.
Why it matters. Logins, live lists and keys that learn their service's list offer hundreds of names. With the switch on, your tools see the names you chose and nothing else, and a model a provider adds tomorrow stays out until you name it.
How to use it.
models:
only-my-names:
enabled: true
keep:
- claude-opus-5-5- It is by name, not by route: when a name is yours, every account that answers it serves it, in the same order and pool as before.
- Applied on reload, without a restart: the rule is in force for the next list and the next request from the moment
the reload commits the saved config; no account has to register again.
enabled: false(or removing the key) brings every name back, andkeepstays for the next time. Removing an alias from the config stops serving its name at that reload, even while a login still registers it. With the switch on and no name in the config, nothing is served, and the log says so at every reload. - A refused name gets the same HTTP 400 and
model_not_foundas an unknown model, with a message that says why:model gpt-5.5 is not served: this Provimux serves only the names its owner set (models.only-my-names). Keep it on the console's Models page, or ask for a served name (GET /v1/models).Every refused request gets that message and is counted, whether or not an account offers the name (the check reads the rule and the name, nothing else). - Before turning it on,
GET /v8/management/provimux/namesshows your names (with the ids served through each: its copies under a prefix your config gives, and its spellings with a thinking suffix an account registers) and every other name your accounts offer (what would stop being served), with the accounts behind each; once it is on, also which names tools asked for and were refused (in memory, up to 256 names). It is computed when asked, from the rule in force and what the accounts register, with the same check every list and request passes; itsappliedblock names the config whose rule is in force (its ETag), so a save has taken effect once that ETag is the one the save returned. The console's Models page uses it, with Savings' requests by the name your tools sent (include=requested_models). - The management API and the console never depend on the switch: they are the way back. In Home mode the switch does not apply.
What the switch does not cover, or covers differently.
- Realtime and live (
/v1/realtime…,/v1/live): these routes choose a Codex login without naming a registered model, so with a Codex login they are served whatever the switch says. - A plugin executor reached through a plugin's model router, for one of your names: the plugin decides what it
runs. For a name that is not yours no router is asked on the request routes, and the request is refused with the
setting's message, as is a router's rewrite to a provider or to another model that is not yours. Alpha search
(
/v1/alpha/search) asks its router first, as CLIProxyAPI does, and then checks both the requested name and the router's choice: the router sees the name, nothing is served under it. - The Gemini format (
GET /v1beta/models) names a model by the name it shows a Gemini client (a plugin executor's provider-native name; for an alias spelledmodels/gemini-2.5-pro, the resourcemodels/gemini-2.5-pro, which a Gemini client generates asgemini-2.5-pro). When that name is not yours, the Gemini list leaves the model out and its detail answers 404, as its generation is refused; the other formats list the name you kept. - A Gemini key whose alias is a full resource name (
models/gemini-2.5-pro): keeping the short name (gemini-2.5-pro) lists the resource and answers its detail, but generation under it is refused, because no account registers the short name; CLIProxyAPI routes such an alias the same way with the switch off. Keep the alias's full name, or write the alias withoutmodels/. - A plugin that rewrites the final model list a client receives: what it adds is shown (the switch filters the lists the gateway builds, not what a plugin writes over them); a request for it is still refused.
- The Responses WebSocket (
GET /v1/responses): a prewarm (response.createwithgenerate: false) for a name that is not yours is acknowledged by CLIProxyAPI itself (response.created,response.completed) without asking a provider; the generating request is refused, and CLIProxyAPI then closes the socket without the setting's message. No model is served and nothing reaches a provider. - Speech and video names:
/v1/audio/speechand/v1/ttsturntts-1and the like intogrok-tts, and/openai/v1/videosturnssora-2intogrok-imagine-video, before the switch looks at the name. Keep the fixed name (grok-tts,grok-imagine-video); a refusal, and its count, name it too. Fetching a video by id usesgrok-imagine-video, so it is refused while that name is not yours. - Claude-shaped model lists (
GET /v1/modelswithAnthropic-Version, or Claude Code): CLIProxyAPI shows its own generated Claude-like id for each served name and accepts it; it reaches the model behind your name, so nothing you did not keep is served through it. - An exchange under way when the rule changes (a stream, a WebSocket session's follow-up on its login) finishes under the rule it started with.
- A request for
autoalready under way when the switch is turned on is resolved from the names served after the save: it may be answered by another of your names than a moment before, or, if none is eligible, refused with CLIProxyAPI's own error. - A login being replaced by another: the account count the status shows for a name can be one read behind while the replacement happens; the next read is right.
- A name no account offers: with the switch on it gets the setting's message instead of CLIProxyAPI's
unknown-model words, and takes one of the 256 slots of the refusal count. The machine-readable fields are as before:
HTTP 400,
invalid_request_error,model_not_found,param: model. - Between a save's answer and its reload the previous rule is in force;
GET /provimux/namessays which. - Home mode: the switch does not apply.
- CLIProxyAPI's own management views (the models of an auth file,
registered_modelsofGET /provimux/model-lists) show what each account offers, which with the switch on includes names that are refused.
What you get. Models you declare under an API key (Claude, Codex, Gemini, Vertex, xAI, Meta), for example an alias, report the same context window and output limit as the catalog's model they point to.
Why it matters. Clients size their conversations and compaction from these numbers. Without the catalog's values, Codex-format clients fell back to a generic template and Claude-format clients to made-up defaults:
An alias of claude-opus-5-5 on a Claude API key |
Context window | Output limit |
|---|---|---|
| CLIProxyAPI 8.0.77 (Codex-format model list) | 500,000 | none |
| Provimux | 1,000,000 | 128,000 |
How to turn it on. Nothing to configure. max-context-length on a model still wins.
api-keys:
claude:
- name: claude-key
keys:
- api-key: "sk-ant-..."
models:
- name: "claude-opus-5-5"
alias: "opus"- When several accounts serve one alias, the list reports the smallest limit among them.
[1m]variants keep their 1M window, and thinking suffixes are ignored when looking the model up. - When one of them has no known limit, no shared limit is published: the model lists send
nullrather than a made-up default. - OpenAI-compatible entries have no catalog; OpenRouter entries get their limits from OpenRouter built in.
- When one model name is served by several accounts (aliases on logins, keys and OpenRouter), set
display-nameon each alias row: the list shows the name of the account registered last, so the same name everywhere keeps it stable.
What you get. With session affinity on, a conversation that sends its own session id (Pi, Claude Code, the Codex
CLI, any client that sends a session header or a prompt cache key) goes back after a restart (an upgrade, brew services restart) to the account it was on, so the provider reads its prompt cache instead of writing it again on another
account. CLIProxyAPI keeps session affinity's bindings in memory only: without this, a restart sends about half the
conversations behind a name with two accounts to the other account, whose cache is cold.
It is on whenever session affinity is on. With routing.session-affinity: true there is nothing to set. The
restart that installs this version keeps nothing yet, because the version before it wrote no file: the two files below
appear at its first stop or within 5 minutes, and from then on a restart keeps conversations. It does not apply in
Home mode or with server.kv-store.disabled: true. Whenever it does not apply, for any reason, nothing is written and
Provimux's own files from an earlier run are removed (unless another running Provimux uses the same store). GET /v8/management/provimux/session-affinity-persist says whether it is in effect and, if not, why.
How to turn it off. Set it to false in the configuration, or in the console
(/v8/management/config/routing/session-affinity-persist). Provimux then removes its own files and writes none.
routing:
session-affinity-persist: falseWhat is written, and where. When Provimux is told to stop, and every 5 minutes while it runs, two files beside the
KV store: kv.db.affinity and kv.db.affinity-key (for a store at another path, that path followed by .affinity
and .affinity-key). Nothing is read or written while a request is routed.
- The first file is encrypted with the key in the second: a copy of it alone tells nothing. On macOS and Linux, Provimux creates the key readable by its owner only and checks its owner and mode each time it uses it; it does not inspect access control lists or the permissions of the directory, which already holds the login files under the same protection.
- With both files, one can read the session ids clients sent (an e-mail address a client sends as its session id included), the provider and model names, for a conversation without an id the hash CLIProxyAPI derived from its opening, the times, Provimux's own fixed sample requests (see the limits), and for each account a keyed hash of its vendor identity. No client key, login file name, login e-mail address or conversation content is in them.
- Provimux replaces or removes a file at those two names only when it authenticates with that key. Anything else there, a damaged file of Provimux's included, is left as it is, nothing is restored or written, and the state says so: a damaged snapshot must be removed by hand. A file Provimux had written in full but not yet put in place when its process ended is removed at the next start, unless another running Provimux uses the same store; one cut off midway stays, and can be removed by hand.
What comes back. At the next start, before anything is served, each binding with lifetime left goes back to the
same account, with the lifetime it had, never longer than its last use plus the session-affinity-ttl configured now.
From there on CLIProxyAPI's own rules apply, as if there had been no restart. The file stays until the next write
replaces it, so after a crash routing returns to the last file written. That file is normally at most 5 minutes old;
it is older after a write that failed, after a second crash before any write, or after a run of a version without this
feature; a binding never comes back past its own lifetime.
Which accounts come back. A conversation comes back only to an account Provimux can name the way its provider
names it: an account whose marker in GET /v1/models?include=accounts begins with a. (see
Which account answered; with models.answered-by: false the list shows no marker, and the
rule is the same). That is every API key, and the logins that hold their provider's own id for the account: Claude
(an organisation id and an account id), Codex (a workspace and a user), Copilot, Devin, xAI, a Vertex service account,
Meta and Antigravity. An account whose marker begins with s. starts afresh after a restart: a Kimi login, an AI
Studio connection, a login or key a plugin made, a Claude login without an organisation id or whose profile Anthropic
refused, and any login that lacks the ids its provider's rule reads (more in the
logins reference).
The state counts the bindings left out for want of an identity (left_out_no_account_identity). Two
credentials Provimux takes for the same account (the same base URL and key under two entries, one Vertex service
account used for two projects, one Antigravity account with two projects) both start afresh after a restart.
What does not come back.
- A conversation without an id on a gateway with client keys (
access.api-keys): CLIProxyAPI matches it by its turns, and that matcher is not kept, so it is bound afresh, as a new one is. Without client keys, such a conversation is named by a hash of its opening, and it comes back. - A conversation whose account was not the same vendor account at every check (every 5 seconds) from its last use to the write: a login file replaced by another account's, or unreadable, while Provimux runs has all its bindings left out for the rest of the run, and one replaced while Provimux was stopped gets nothing.
- Which accounts were cooling down after a 429 (unless
routing.cooldown.save-cooldown-status: true), the weighted strategy's credits and the round-robin position. Devin's per-session request counter starts again at 0, as it does when Devin's own client restarts.
Limits.
- After an upgrade, a conversation goes back only when both builds name it the same way: Provimux compares them on fixed sample requests and leaves out what differs (design). A change upstream makes to how it names a conversation that the samples do not cover can send that conversation to another account once after an upgrade, where its cache is cold; it is never an error.
- Two client keys that send the same session id share one account in CLIProxyAPI's memory; a restart keeps that as it was.
- On a disk that does not respond, the write at stop is given up after 1.5 seconds, and it never lands later; a start that cannot read the file within 1.5 seconds goes on without it, and the state says so.
A restart in the middle of an answer. A stop first writes the file, then lets the answers in flight finish, as
Restarts and upgrades says. The write takes milliseconds on a healthy disk and is given up
after 1.5 seconds on one that does not respond; the wait for the answers starts when it is done, up to
server.restart-drain-seconds (25 by default). Neither lengthens the other: the write does not wait for the answers,
and the wait keeps its own length after the write. CLIProxyAPI bounds the whole stop at 30 seconds, so with a wait of
30 the 1.5 seconds of a stalled disk come out of the wait. A conversation whose answer is still being written at the
stop is in the file, because it was bound when its answer started; what that answer changes afterwards is not.
What you get. Sometimes Anthropic or OpenAI refuses a request for a moment because it is overloaded. Anthropic,
for example, answers overloaded_error. Without this, the gateway moves the request straight to the next account by
priority, which can be a key with a higher price or a shorter cache. With session affinity, the conversation can then stay on that account. Now
the gateway waits about a second and sends the request once more to the account it had chosen. If that second try
works, you get your answer from that account, the refusal leaves no pause on it, and the conversation stays where it
was. If the second try fails too, where the conversation goes next is decided by CLIProxyAPI's
session-affinity-rebind-on setting, as without this.
How to use it. Nothing to turn on: it is on by default. To turn it off and keep CLIProxyAPI's own behaviour:
routing:
retry:
same-account-retry: falseWhat gets a second try. Only a refusal from the vendor's own API that says, in a documented error field, that it is overloaded, under a status the vendor documents for it. The vendor must have sent its whole error answer.
| Account | Sent to | The vendor's answer that gets a second try |
|---|---|---|
| Claude (Anthropic API key or subscription login) | api.anthropic.com |
status 529, 503 or 502, with "error": {"type": "overloaded_error"} in the body |
| Codex (OpenAI API key or ChatGPT login) | api.openai.com or chatgpt.com |
status 503, with "type": "service_unavailable_error" and "code": "server_is_overloaded" in the body |
Nothing else gets a second try. That includes:
- a Claude or Codex account with another base address (a gateway, a compatible service);
- every other vendor and account type: Gemini, Vertex, AI Studio, Antigravity, Kimi, xAI, Meta, GitHub Copilot, Devin, and every OpenAI-compatible entry, OpenRouter included;
- any 429, and any other status;
- any answer that names a spend, quota, billing or rate limit;
- a refusal with the header
x-should-retry: false; - a refusal that one of your
request-scoped-errorsrules matches: your rule decides it, as without this; - a plain 502, 503 or 504;
- a connection that was refused, reset or closed, or that timed out;
- anything after the vendor began to answer;
- a request that offers the image-generation tool, however its
tool_choiceis written.
How long it waits. Without a Retry-After header, the wait is between 0.5 and 1 second. A Retry-After of 0 also
means that wait. A Retry-After of 1 or 2 seconds is waited exactly. A longer one means no second try: the request
goes on at once, as it does without this. A stop or restart during the wait lets the second try go and its answer
finish, within the restart wait.
One second try per request. Provimux makes at most one second try for a request sent to it, however many
accounts, rounds (request-retry) or refreshes the request goes through. The answer to that second try is then
handled by CLIProxyAPI like any answer. So it can lead to further calls that would not have happened without it; for
example, a 529, then a 429 on the second try, then a later round that succeeds. The wait before the second try is at
most 2 seconds.
What you see. Each second try writes one line to the log, for example:
same-account retry: status 529 overloaded refusal on provider=claude auth_file=…; called the executor a second time after 812ms: it returned without an error
The answer carries the headers of the account that gave it (X-Provimux-Account, see
Which account answered), and a
show of the conversation's route names that account as bound. If
keep-alive comments before the first token are turned on, the response's headers may already have been sent before
the second try, and then that answer carries no account headers. Savings counts the refused request and the answered
one as two requests; only the answered one has tokens. GET /v8/management/provimux/same-account-retry gives the
value in use, whether your config sets it, and the counts since the start: how often the executor was called a
second time, with and without an error, and how often the client left during the wait.
Limits.
- A fault that arrives after the vendor has begun answering is never retried. That includes an "Overloaded" sent inside a stream that has started, even as its first event. You get it as today.
- Requests that create something when sent are never sent twice: images (and any request that offers the image tool), videos, speech, and Gemini interactions.
- A WebSocket turn is never sent twice.
- A gateway connected to CLIProxyAPI Home does not do this; Home chooses the accounts there.
- Token counting (
count_tokens) does not do this.
What you get. When an account cools down, a conversation moves to the next account that serves the name. With
routing.session-affinity: true it stays there even after the first account is free again. That can mean a second key
with a shorter prompt cache or a higher price. Now a client can see where its conversation is bound
and send it back. Or let the gateway do it:
A conversation that fell back goes back by itself.
How to use it. Two requests of the gateway's own, sent with a client key (access.api-keys) as any model request
is. A gateway without client keys answers not-seen.
POST /v1/provimux/session-route shows where this conversation is bound for a name: the account, since when, and
which account it fell back from. It names the accounts first in line now, says whether an account of a higher
priority than the bound one is free, and if none is, when the first of them is expected free. Call it again whenever
you like: every call answers from the gateway's state at that moment. It changes nothing, sends nothing to a vendor
and ends no cooldown.
POST /v1/provimux/session-route/release removes the binding. Nothing is sent: the conversation's next message is
routed as a new conversation's, to the first free account it may use. Pass the binding the show gave as expect to
release only that binding. The token stays the same through the conversation's messages; once the binding is removed
and made again, on the same account too, it is another, and the release answers 409 with the state now and the new
token, and releases nothing.
PROVIMUX=http://127.0.0.1:8317 # on the same machine; from another machine, use the server's address
curl -s "$PROVIMUX/v1/provimux/session-route" -H "Authorization: Bearer $KEY" \
-H 'X-Session-Affinity: <session id>' -d '{"model":"opus"}'
curl -s "$PROVIMUX/v1/provimux/session-route/release" -H "Authorization: Bearer $KEY" \
-H 'X-Session-Affinity: <session id>' -d '{"model":"opus","expect":"<binding>"}'- Name the conversation the way its messages do. Send the same session header (
X-Session-Affinity,Session-Id,X-Claude-Code-Session-Id, …), or put the body fields your messages carry underidentity, for example{"identity":{"prompt_cache_key":"project-a"}}. - Ask under the name you send. That finds the conversation for a plain name, and for
autoas long as the catalog's first model hasn't changed since. Otherwise, or if a plugin rewrote the name, ask under the model the message was routed to: therouted_modelan earlier answer named, or the plugin's target. - A key sees and releases only conversations the gateway has seen it use since it started (after a restart, from the
conversation's next message). Anything else answers
not-seen: another key's conversation, or one forgotten after its binding expired. A show sent the instant a streamed answer ends can also answer as if that message had not been sent yet. - Each account is shown exactly as in
GET /v1/models?include=accounts, with its marker (Which account answered). An account that list no longer shows appears only as{"listed": false}. - On a Codex WebSocket, close the connection before its next message. A message on the open connection binds the
conversation to the old account again, and closing afterwards does not undo that: release again, then close.
Answers say
websocket_may_hold: truewhen this applies. - Under the default rebind policy, if a message was still running when you released, the conversation was bound again
to the same login before it finished, and that message then fails because of that login, the gateway drops the new
binding too and the next message picks again. With
session-affinity-rebind-on: neverthe new binding stays. - A sub-agent keeps its own binding. With sub-agent inheritance on (the default), a released sub-agent's next message goes back to its parent's account, even if the show named a higher one, and a sub-agent started after a release follows its parent's binding as it is then. With inheritance off, a new sub-agent is routed on its own.
- With
routing.session-affinity: false, in Home mode, or under a plugin scheduler, nothing is bound or kept and both answers say why (affinity).
Known limits.
- A release without
expectat the very instant the gateway forgets your key can remove a binding another key's conversation of the same name now uses. Passexpectto rule it out. - Session ids or names that begin or end with a colon can make two conversations look like one; they may be shown or released together.
- After two rare events an old
expectanswers unexpectedly: after the gateway's binding table was full (65,536 conversations) and the same account was bound again, it still matches; after a binding ended by its lifetime and a show came before it was made again on the same account, it answers409. Show again and use the new token. - If every registration of a model is suspended, the model list shows no account for it, but a show still names the
account the conversation is bound to, and a release names it in
was. - Right after a configuration reload, or a plugin scheduler being added or removed, a conversation may show
not-seenuntil its next message after a show. One turned off just as a message ended may shownot-boundonce turned back on, until its binding's lifetime has passed (session-affinity-ttl, an hour by default).
What you get. When an account cools down, session affinity moves the conversation to the next account by priority, and keeps it there after the first account is free again: a second key with a shorter prompt cache or a higher price. Set a time once, and you no longer send it back by hand. Once no message of the conversation has been routed to an account for that time, its next message goes to the highest-priority account that message may use.
routing:
session-affinity: true
session-affinity-return:
cold-after: "6m"What it promises. It never moves a conversation that had a message routed to an account within cold-after. A
provider refreshes its prompt cache when a request reads it, so set the time to the longest cache lifetime of any
account your conversations can fall to, plus a margin. Two things are not use: a message the gateway refused before
choosing an account (it reached no provider), and an answer while it streams, so the message after an answer that
itself took longer than cold-after can go back.
How it decides. Only at the conversation's own next message, and only if the account it is bound to is below the highest-priority account that message may use right now (also after you add a higher-priority account). Then the binding is dropped and the message is routed as a new conversation's. In any doubt it does nothing. It sends nothing to any provider and changes no account's state.
The time. A duration of at least 1m ("6m", "1h30m"). Anything else is refused with the key named; a write
through the config API then leaves the file as it was. Without the key, or with cold-after: null, it is off, as it is
by default. At or above session-affinity-ttl it does nothing: an unused binding ends by itself first. A change
applies from the next message; each conversation's first message after it is not judged.
Left alone. Sub-agents and forks (they follow their parent), conversations your client does not name with a
session id, messages pinned to one account (a follow-up on an open Codex WebSocket), and a conversation's first
message after a restart. Nothing happens with session affinity off, in Home mode, with a plugin scheduler, or with
session-affinity-rebind-on: never.
Seeing it. GET /v8/management/provimux/session-return (management key) says whether it is in effect and, if
not, why: not-set, not-below-ttl (with the ttl_s it compared with), rebind-never, session-affinity-off,
home-mode or plugin-scheduler. It also counts the conversations sent back since the start; one conversation can
count more than once. A client's POST /v1/provimux/session-route says whether it is in effect, and the time, in its
rule field.
Known limits.
- After a scheduling plugin is switched off while the gateway runs, a conversation it routed in the meantime can go back at its first message.
What you get. On the /v1/responses WebSocket, a client that sends its whole conversation again (without
previous_response_id) gets that conversation answered, not a merged one.
Why it matters. CLIProxyAPI treats such a request as an addition to the previous turn unless it contains assistant or tool items. A client that re-sends its first request unchanged, for example to keep the prompt cache warm, had it merged: previous input, previous output, then the same input again. The model saw the conversation twice and the request was billed at about twice the input.
How to turn it on. Always on. A request with no previous_response_id, the same model as the previous request,
and an input that starts with every input item of the previous request, in order, replaces the transcript. An
incremental request that names no model still appends, and pending tool calls answered by a replay are kept.
What you get. Read-only management endpoints that the Provimux console, provimux-ui, uses for its own pages: for each model, every login and key that registered it with the cooldown recorded on it; and for each login, which list decides its models and the state of its live model list.
Why it matters. The model list for clients names no account by design. The operator needs to see which logins and keys carry a model, which of them have a cooldown recorded and until when, and whether a login's live list is current or failing, without reading the log.
How to use it. Nothing to turn on. They take the management key, like every /v8/management route.
GET /v8/management/provimux/model-routes: per model, its routes in priority order, each withprovider,kind(oauthorapikey),priority, thehostof an API key, the login named as the credentials page names it (name,email,label, only for logins that page lists; otherwiseauth_indexidentifies it), its limits and reasoning levels, and arecorded_cooldown(for the credential or for one model, until when, and a reason code).?model=<id>(repeatable) narrows the list. Whilemodels.only-my-namesapplies, it lists only the names it serves.GET /v8/management/provimux/model-lists: per login, thesourcethat decides its models (live,published,built-inornone), its live list (held,expiredafter 7 days,fetched_at,from_cache, how many models it listed, the last failed fetch as a category with the provider's HTTP status), how many models it serves and how many of them the catalog doesn't have yet.?auth_index=<index>adds that login's models with the source of each value;?view=liveadds each login's list as the provider returned it. Akeysarray has a row per API key whose list refreshes itself or could: whether its service is asked (key.not_asked:fixed,live_lists_off,no_list_endpoint), when its list was refreshed and the last failure, the ids it learned (key.learned), and its rows the service no longer lists (key.unlisted); with?auth_index=every model it serves,learnedor a row, and whether the service lists it (listed).GET /v8/management/provimux/live-lists: the older form of the same state, kept for consoles released beforemodel-lists: per login,source(liveorcatalog), when the list was fetched, how many models it listed and how many the login serves, and the last failed fetch as a category (http_status,credentials,invalid_response,network,other) with the provider's HTTP status. The reason in words stays in the log.GET /v8/management/provimux/names: the state ofmodels.only-my-names: the switch, your names with who set each (aliasorkeep), how many accounts serve each and the ids served through it (its copies under an account's prefix, its spellings with a thinking suffix), thekeepentries it ignores, every other name an account offers with those accounts, the names refused since the switch went on, andapplied(the ETag and generation of the config whose rule is in force;applyingis always false). Every registered name is in exactly one of your names and the others, judged as a request for it would be; each answer is built from one rule.- They report what Provimux has recorded. They do not predict the router: they don't say which route a request would get, whether a route is selectable right now, which route answered last, or when a list is fetched next.
- No response carries an API key, a token, an auth ID, a base URL beyond its host, or any provider error text. Stock CLIProxyAPI answers 404 on these paths.
The contract is openapi.yaml, with example responses next to it.
curl -s "$PROVIMUX/v8/management/provimux/model-routes" -H "Authorization: Bearer $MANAGEMENT_KEY"Provimux works with any client CLIProxyAPI works with. For Pi, two extensions read what which account serves each model reports:
- pi-provimux adds Provimux (or CLIProxyAPI) as a Pi provider,
provimux. Each model's name ends with the keys that serve it, then what it falls back to:Anthropic api, fallback OpenRouter api(apiis an API key). Pi 1.6.0 or newer shows the name on every line of/model, after the id. After each answer, its footer names the service that answered (answered: OpenRouter api), and it hands that model's price and cache lifetimes on to pi-cache-keeper. - pi-cache-keeper keeps the prompt cache warm and compacts from it. Its footer shows the kind of account that answered last.
pi install npm:pi-provimux
pi install npm:pi-cache-keeperTheir READMEs describe the settings.
Provimux can also use a subscription login you own; whether a provider allows that is set by its terms, and you are responsible for following them.
Reference: Logins.
The requests Provimux sends to providers are the same as CLIProxyAPI's, except where a feature above says otherwise:
- for OpenRouter entries: the cache markers, the cache lifetime in explicit mode, and the
X-Session-Idheader; Provimux also reads OpenRouter's public model list; - on OpenAI API keys: a client's
prompt_cache_options.ttl; - on Codex API keys: the client's own
User-AgentandOriginator, not Codex's (CLIProxyAPI sends Codex's unlessdisable-codex-cloakingis set, and OpenAI refuses that on some organizations); a key whose own entry saysdisable-codex-cloaking: falseis still cloaked, and so are Codex logins. Known limit:/v1/alpha/searchon a Codex API key (alpha-search: true) still sends Codex'sOriginator: codex_cli_rs; - on the Codex WebSocket: the transcript of a full replay;
- for Devin: the output limit of each model, when the real limits are in use;
- unless
models.live-lists: false: each Claude, Codex, Meta and Devin login, and each Gemini API key on Google's own host, asks its provider for its model list (at startup and every 3 hours); - unless
models.live-lists: false, or the key saysfixed-models: true: each API key with its own models list asks its service for its model list (at startup, every 3 hours and when the key is added or changed), at the host you configured for that key (Meta's own for a Meta key without one), with that key, its headers and its proxy: the request the console's "Get the list from …" button sends (<base-url>/modelsfor anopenai-compatibilitykey, once more without the key and headers after a 401 or 403;/v1/modelsfor Claude, Codex, xAI and Meta keys;/v1beta/modelsfor a Gemini key on its own host).
CLIProxyAPI itself, and so Provimux, also sends two requests from its start, whether or not you have an xAI or an Antigravity account, that go to neither a model provider nor providers.dev:
- the Grok CLI version check:
GET https://registry.npmjs.org/@xai-official/grok/latest, at startup and every 3 hours, through your configured proxy; xAI requests then carry that Grok CLI version; - the Antigravity version updater:
GETof the latest-release manifest of Google's Antigravity updater (https://antigravity-hub-auto-updater-974169037036.us-central1.run.app/manifest/latest-arm64-mac.yml), at startup and every 3 hours, through your configured proxy; Antigravity requests then carry that client version.
Provimux also sends one request of its own to providers.dev, unless models.published-lists: false (and never in
home mode): at startup, every 6 hours and on POST /v8/management/models/refresh,
GET https://providers.dev/api/v1/listings with a fixed filter (view=full, limit=40 and the same list of
providers for every user), through your configured proxy. It carries a User-Agent of provimux/<version> and the
ETag of the last answer providers.dev gave, and nothing else: no key, no account, no model you use and nothing
about your requests. providers.dev sees what any web server sees, the address the request comes from. The answer
only fills a model's name, window, output limit and modalities where neither the vendor's list nor the catalog
states them.
In the same round and under the same switch, a second request: GET https://providers.dev/api/v1/entries, with
the same fixed list of providers for every user, 200 entries a page, at most 10 pages. It is sent at startup, every
6 hours and on POST /v8/management/models/refresh, through your configured proxy, with the User-Agent
provimux/<version> and each page's ETag. Nothing about your accounts, models or requests is sent. The answer is
kept in model-lists/figures.json, so a start without network has the figures of the last run, with their dates. A
dataset dated more than 24 hours ahead of the gateway's clock is refused.
Provimux is free and stays open source (MIT). For companies that run it, providers.dev offers support plans: Community (free: GitHub issues, best effort) and Team, Business and Priority (paid), listed with prices and terms at provimux.providers.dev/support. A paid plan buys a private channel and a first reply within a stated number of business days: a reply, not a promised fix. Provimux has one maintainer, and we say so: announced holidays pause the clock, there is no 24/7 and no uptime promise for a service you host yourself, and the code stays MIT, so you can always fork it.
Provimux is built on CLIProxyAPI by Router-For.ME, started by Luis Pater. Nearly everything Provimux does is CLIProxyAPI's work: the logins, the providers, the translation between formats and the routing. Its console, provimux-ui, is the CLI Proxy API Management Center, also by router-for-me. Provimux adds the features above on top of each CLIProxyAPI release.
This repository's GitHub Sponsor button goes to the owner's GitHub Sponsors. Sponsorships support Provimux and the owner's other open-source tools. Setup and workshops for teams, with or without Provimux: ngvoicu.dev/consulting.
MIT, like CLIProxyAPI. See LICENSE.
Provimux is not affiliated with or endorsed by Anthropic or OpenAI.



![Pi's /model list with Provimux. Each line shows the model id, its name with where it comes from in parentheses, and [provimux]: "claude-opus-5-5 (Claude Opus 5.5 · Anthropic sub, fallback api)", selected and current; "gpt-6.2-sol (GPT-6.2-Sol · OpenAI sub, fallback api)"; "gpt-6.2-astra (GPT-6.2-Astra · OpenAI sub, fallback api)"; "gpt-6.1-terra (GPT 6.1 Terra · OpenAI sub, fallback api)"; "gpt-6.1-sol (gpt-6.1-sol · OpenAI api)"; "devin/gpt-6-astra (GPT-6 Astra (Devin) · Devin sub)"; "gpt-6-astra (gpt-6-astra · OpenAI api)"; "gpt-6-luna (gpt-6-luna · OpenAI api)"; "devin/gpt-6-luna (GPT-6 Luna (Devin) · Devin sub)"; "aion-labs/aion-2.0 (aion-labs/aion-2.0 · OpenRouter api)". Below the list: "(1/1064)".](/ngvoicu/provimux/raw/main/.github/provimux/media/pi.png)