Install
Install with PiG
pig install npm:pi-provimuxInstall with Pi
pi install npm:pi-provimuxPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
Pi manifest JSON
The pi field of package.json.
{
"extensions": [
"./extensions/index.ts"
]
}README
Written by the package's publisher, shown as published in version 105.0.7 (README.md). PiG does not review it.
pi-provimux
Provimux's extension for pi. It adds Provimux as a provider in pi, and works the same with plain CLIProxyAPI.
Every model your Provimux or CLIProxyAPI serves appears in pi's /model, under the provider provimux. With
Provimux, each model's name also says which accounts serve it (a subscription login or an API key, and whose), and
other pi extensions learn which one answered. With CLIProxyAPI, those parts stay quiet and everything else works.
pi install npm:pi-provimux
Then, in pi:
/login Provimux
and enter the server's address (for example http://127.0.0.1:8317) and your client key.
pi-provimux is a fork of router-for-me/pi-cliproxyapi-provider, see Credits.
What it does
From the original extension:
- Your models in pi. It reads the model list from
{root}/v1/models?client_version=piand registers each model with its context window, reasoning levels and, when models.dev knows it, its price. - Setup by
/login./login Provimuxasks for the address and the key, checks them, and saves them. - A model cache, so pi starts at once when the server is slow;
/provimux-refreshreloads the list. /fastand/ultrafast: faster service tiers on the models that offer them./pauseand/continue: hold every request to the provider until you continue.- GPT prompt caching kept: a
gpt-request always starts with its base prompt as a developer message, so the prompt cache keeps being read. - Thinking level changes that keep the cache, for models that support them: pi's own, placed as OpenAI documents.
- Elapsed time and tokens per second in pi's footer.
- A fresh Codex WebSocket after compaction, so the server's context matches the compacted one.
Added in pi-provimux:
- Claude Messages format. Claude models go to
/v1/messagesin Claude's own format, automatically where safe. With pi's long cache retention, that brings Anthropic's 1-hour prompt cache. - Where each model comes from, in its name. With Provimux, a model's
name ends with what serves it:
Claude Opus 5.5 · Anthropic sub, fallback api. - Where each model comes from, for other extensions. Over pi's event bus, which accounts may serve each model and, with Provimux, which one answered each response, also over the Codex WebSocket. pi-cache-keeper uses it.
- One package in pi's list. The footer helper loads from the provider, so
pi listshows a single extension.
Install
# from npm
pi install npm:pi-provimux
# or from GitHub
pi install git:github.com/ngvoicu/pi-provimux
# from a local checkout
pi install /absolute/path/to/pi-provimux
# or temporarily for one run
pi -e /absolute/path/to/pi-provimux
The version names the original release it is built on, then a count of its own: 105.0.1 is pi-provimux's first release on the original's 1.5.0 (major × 100 + minor, then patch), 105.0.2 its second, and 105.1.1 would be the first on the original's 1.5.1.
Versions on npm are published from this repository's main by GitHub Actions, with npm provenance. A workflow
follows the original's releases: once a day old, one that merges cleanly and passes every check is merged into main
and released, with no person in between: this is switched on. docs/FOLLOWING.md says how, and
what that accepts.
It needs pi 1.6.0 or newer.
Login-style setup (recommended)
This plugin needs both baseUrl and apiKey. pi's built-in /login only supports multi-field prompts on the account/OAuth path, so Provimux appears under Sign in with an account.
When provimux.json or PROVIMUX_API_KEY already holds a key and no account login is stored, pi also offers Sign in with an API key. Do not use it: it stores only the key, in auth.json, and it does not survive a restart. The next start says Provider is not configured: provimux, and a saved default or a resumed session moves to another provider if you have one. Use Sign in with an account, or put apiKey and baseUrl in provimux.json. If you already used it, remove the provimux entry from auth.json (/logout) and log in with an account.
Which key wins. The extension reads the address and the key from the PROVIMUX_* variables first, then provimux.json, then the login in auth.json (see Resolution order). So a key in provimux.json wins over a key saved by a later /login that does not rewrite the file, as the API-key login does not. The account login writes its address and key into provimux.json as well, so after it the two agree. Change the key or the proxy with an account /login. If you change them in provimux.json or the environment while an account login is stored, the model list follows the new values but requests still carry the stored login's key: run /login again, or remove the provimux entry from auth.json.
Preferred: /login shortcuts
/login Provimux
or, by the provider id:
/login provimux
(pi ignores case, so both name the same provider.) These shortcuts jump straight into the multi-field baseUrl + API key prompts, unless pi also offers the API-key method (above): then it asks which one first, and you choose Sign in with an account.
Menu path
/login
Then choose:
- Sign in with an account (required for multi-field baseUrl + API key prompts)
- Provimux
- Enter:
- base URL — preferred form is host:port, e.g.
http://127.0.0.1:8317 - API key
- base URL — preferred form is host:port, e.g.
Final login validation calls {root}/v1/models?client_version=pi (this always bypasses the model cache and forces a fresh remote query):
- HTTP 200 → login succeeds (empty model list is still OK) and the model cache is rewritten
- non-200 / network error → login fails and you are prompted to re-enter base URL + API key
On success:
- models are registered immediately in the current session (0 models is allowed)
baseUrl/apiKeyare written to~/.pi/agent/provimux.json- pi also stores the returned credential in
~/.pi/agent/auth.json
Re-run /login Provimux or /login provimux anytime to reconfigure. The built-in /logout command only removes credentials saved in auth.json; it does not erase provimux.json. Remove or update that file if you also need to clear the provider configuration.
Non-interactive configuration
You can still configure without /login.
Config file
~/.pi/agent/provimux.json:
{
"baseUrl": "http://127.0.0.1:8317",
"apiKey": "12345",
"fast": false,
"pause": false
}
Optional fields:
| Field | Default | Description |
|---|---|---|
baseUrl | http://127.0.0.1:8317 | Provimux or CLIProxyAPI address |
apiKey | (required unless set via /login or env) | Bearer token / CPA API key |
providerId | provimux | Provider id shown in /model (written here by /login) |
providerName | Provimux | Display name in /login and UI (written here by /login) |
fast | false | Persisted speed preference: false (off), true (Fast), or "ultrafast" (Ultra Fast) |
pause | false | Persisted request-pause preference; provider requests wait until it is cleared |
tps | true | Show the elapsed time footer and TPS summary in the TUI; see Elapsed time and TPS |
answered | true | Show in the footer which route answered the last turn; see Which route answered, in the footer |
claudeMessages | "auto" | When Claude models use Claude's own format: "auto", true (always) or false (never); see Claude Messages format |
Environment overrides
| Variable | Overrides |
|---|---|
PROVIMUX_BASE_URL | baseUrl |
PROVIMUX_API_KEY | apiKey |
PROVIMUX_PROVIDER_ID | providerId |
PROVIMUX_PROVIDER_NAME | providerName |
PROVIMUX_FAST | fast (true / false, also accepts 1, 0, yes, no, on, off) |
PROVIMUX_CLAUDE_MESSAGES | claudeMessages (auto, or the same values as PROVIMUX_FAST) |
Resolution order for connection settings:
- Environment variables
provimux.json/logincredentials inauth.json- Default baseUrl
http://127.0.0.1:8317
At startup, PROVIMUX_FAST overrides the persisted speed preference: a true value selects Fast, and a false value turns both modes off. The variable does not accept ultrafast. If unset, the provider uses fast from provimux.json, or defaults to off.
baseUrl normalization
Preferred form is host:port only:
| Input | Inference baseUrl | Models URL |
|---|---|---|
http://127.0.0.1:8317 | http://127.0.0.1:8317/backend-api/ | http://127.0.0.1:8317/v1/models?client_version=pi |
http://127.0.0.1:8317/backend-api | http://127.0.0.1:8317/backend-api/ | same models URL |
http://127.0.0.1:8317/v1 | http://127.0.0.1:8317/backend-api/ | same models URL |
127.0.0.1:8317 | http://127.0.0.1:8317/backend-api/ | same models URL |
pi then sends inference traffic to {inference}/codex/responses.
Fast and Ultra Fast modes
Both modes are off by default. They request faster processing for supported models and may use more credits or incur higher costs.
| Command | Model status label | Request field |
|---|---|---|
/fast | fast | service_tier: "priority" |
/ultrafast | Ultra Fast | service_tier: "ultrafast" |
The modes are mutually exclusive. Run the active command again to turn it off, or run the other command to switch directly. Each change saves the global preference in ~/.pi/agent/provimux.json and refreshes the provider's model pricing. The saved preference is restored at the next startup unless PROVIMUX_FAST overrides it.
Both modes apply only to models whose CLIProxyAPI catalog entry has a non-empty service_tiers array. The provider ignores additional_speed_tiers. When a mode is effective, pi appends its yellow label to the bottom-right model status without a separate notification. On unsupported models, the commands still update the global preference and warn when enabling a mode, but the request and model status remain unchanged.
Both modes are independent of pi's reasoning level and use experimental.modes.fast.cost from models.dev when available. Otherwise, the registered model uses the standard price; the plugin does not guess prices from -pro or -fast model IDs.
Pausing provider requests
Pause provider requests with:
/pause
Use /continue to clear the pause:
/continue
Both commands persist the pause boolean in ~/.pi/agent/provimux.json. Before every provider request, the extension rereads this setting. When it is true, the request waits asynchronously and checks again every 200 ms until /continue sets it to false. A pause issued during an active run lets that run finish before Elapsed stops; a run that starts while paused excludes its waiting time from Elapsed and TPS.
Model cache
The provider keeps a separate cache file so startup stays fast when CLIProxyAPI is slow or briefly unreachable:
~/.pi/agent/provimux-models.json
The cache stores only model metadata and derived endpoint URLs — the model list, Fast-capable IDs, inferenceBaseUrl, modelsUrl, and a fetchedAt timestamp. It never stores your API key or other credentials.
| Property | Value |
|---|---|
| Cache file | ~/.pi/agent/provimux-models.json |
| Remote query timeout | 60 seconds |
| Scope | tied to the current baseUrl (a different base URL ignores the existing cache) |
Startup / resume behavior
When the provider loads (including session resume):
- If a cache exists for the configured
baseUrl, its models are registered immediately. A remote query to{root}/v1/models?client_version=pithen runs in the background; on success, the cache is rewritten and the registered model list is refreshed. If the query fails, the existing cache remains active. - If no matching cache exists, the remote query runs synchronously. On success, the cache is written and the fetched models are registered. If it fails, startup logs a warning and no models are registered until the proxy responds.
Use /provimux-refresh to force an immediate remote refresh of the model catalog.
Refresh commands
/provimux-refresh— force an immediate remote refresh of the model catalog, rewrite the cache, and update registered models. Use this after adding or removing models on the proxy without restarting pi./login Provimux//login provimux— re-entering credentials always forces a fresh models query and rewrites the cache.
Delete ~/.pi/agent/provimux-models.json to clear the cache manually.
Model mapping
From CPA catalog entry → pi model:
| CPA field | Pi field |
|---|---|
slug | id |
display_name | name, followed by where the model comes from when CLIProxyAPI says |
context_window | contextWindow |
input_modalities | input (text / image) |
supported_reasoning_levels[].effort | thinkingLevelMap + reasoning |
supports_reasoning_effort_updates | compat.supportsMidConvoEffort |
visibility: "hide" | skipped |
Unsupported pi thinking levels are set to null so they are hidden in the UI. A level the model lacks asked on the command line of a one-shot run (pi -p --thinking low, --model provimux/<model>:low, or --models provimux/<model>:low when that pattern selects the model; also --mode json) is refused: nothing is sent, the error names the levels the model has, and pi exits with 1. The flags are read as pi reads them: a suffix that is part of a model's id (--model provimux/local-assistant:high, for a model listed as local-assistant:high) asks for no level. Elsewhere (the level picker, a saved default level, --thinking in an interactive or RPC session) pi moves the level to the nearest one the model has, and the request names that level, never the missing one. When available, prices are matched against canonical model entries in models.dev; cost.tiers[].tier.size becomes pi's inputTokensAbove, including thresholds such as 272000. The legacy context_over_200k field is used only when no explicit tiers are present. Ambiguous reseller prices are not selected arbitrarily and fall back to zero. These are catalog/list prices, not a guarantee of CPA's own markup or billing.
GPT Responses prompt caching
pi builds no top-level instructions: it puts the system prompt, as given, in a leading
{ "role": "developer", "content": "…" } input item, for every model, and the provider sends that as pi built it.
For gpt- model IDs (ignoring case and surrounding whitespace) the provider makes sure the request starts with a base
prompt: when the final body has instructions (an extension's before_provider_request hook set them), their text
becomes the leading developer message instead; when the input does not start with a developer message (no system
prompt, or a hook put another item first), You are a helpful assistant. is put in front as one. Existing input items
stay in order, tools and prompt_cache_key are unchanged, and other models keep their request shape. This applies
to HTTP and WebSocket requests, including pi background streams that use this provider. A changed developer prefix or
model sends the full input instead of a WebSocket continuation delta. To drop or replace the base prompt, a hook
removes or changes that first item.
Cache-preserving thinking level changes
Models whose catalog entry sets supports_reasoning_effort_updates (GPT-6 on CLIProxyAPI) get pi's cache-preserving mid-session thinking level changes, with placement following the OpenAI documentation: the effort of the first turn becomes the fixed request-level reasoning.effort, and each later change is carried by a configuration_update input item placed immediately before the user message it applies to, so switching levels mid-session keeps the prompt prefix — and the upstream prompt cache — intact instead of rewriting it. WebSocket previous_response_id continuation also survives level changes. pi's Codex adapter carries these changes itself; the provider only moves the items to the placement above. pi records the level it sent on each reply, none with thinking off.
The raw models.dev response is cached for 24 hours at ~/.pi/agent/tmp/models-dev-cache.json. A fresh cache avoids the network request; an expired cache is refreshed with a three-second timeout, and stale data is retained if refresh fails. If neither the network nor a previous cache is available, pricing safely falls back to zero. A small explicit alias table covers known CLIProxyAPI variants such as gemini-pro-agent → gemini-3.1-pro-preview; unknown variants are not guessed.
Claude Messages format
Claude models can be sent in Claude's own format to CLIProxyAPI's /v1/messages, using pi's built-in Anthropic client,
instead of the Codex Responses format every other model uses. This happens automatically; nothing needs configuring.
- Which models: those CLIProxyAPI lists with
owned_by: "anthropic"(from its plain/v1/models) that pi's built-in catalog also knows, and for which CLIProxyAPI reports an output limit (max_tokens). Their compat flags and thinking levels come from that catalog. Every other model, Claude models pi doesn't know, and Claude models without a reported output limit stay on the Codex format. - Setting:
claudeMessagesinprovimux.json(orPROVIMUX_CLAUDE_MESSAGES) is"auto"by default.falsekeeps every model on the Codex format;truealso switches Claude models CLIProxyAPI reports no output limit for (they then get pi's 16,384 default, see below). - Why: Claude's format can carry Anthropic features the Codex format can't. The main one is the 1-hour cache:
with
PI_CACHE_RETENTION=long, pi marks the prompt withcache_controlttl: "1h", CLIProxyAPI passes it through, and Anthropic writes the 1-hour tier, on API keys too. One-hour cache writes cost 2× the input price instead of 1.25×. The thinking levels offered are also the model's own, not a generic list. - Limits come from CLIProxyAPI: the context window and output limit are what CLIProxyAPI reports, as for every
other model. Unlike the Codex format, Claude's format sends the output limit (
max_tokens) on every request. In"auto", a Claude model CLIProxyAPI reports no output limit for stays on the Codex format, which sends no output limit; withtruepi would fall back to 16,384 output tokens. - Not available for these models: Fast mode (a Codex service tier; they keep their standard price under
/fastand/ultrafast) and the Codex WebSocket transport. Thinking, tools, images and auto-compaction work as before. - Changing the setting refreshes the model list (the cache records it). The first request of an ongoing session after a model switches formats is a cache miss.
Where each model comes from, in its name
Through CLIProxyAPI pi sees one provider, so its model list does not say whether a model is served by a subscription
login or by a paid API key, nor by whom. Provimux, or a CLIProxyAPI that lists its credentials
(router-for-me/CLIProxyAPI#7634), is asked for them with the
plain model list (GET /v1/models?include=accounts, one request per model list refresh), and each model's name then
ends with where it comes from:
Claude Opus 5.5 · Anthropic sub, fallback api
Claude Sonnet 4.6 · Anthropic sub, fallback Antigravity sub
anthropic/claude-opus-5.5 · OpenRouter api
subis a subscription login,apian API key.- First comes what CLIProxyAPI may answer with: the credentials at the highest priority, joined by
orwhen they differ (Anthropic sub or api). Afterfallbackcome the others, highest priority first: what may answer when the first fail or cool down. A service is named again only when it changes. - The service is the one behind CLIProxyAPI's provider (
claudeis Anthropic,codexis OpenAI …). An API key goes by the host CLIProxyAPI names for it (openrouter.aiis OpenRouter whatever the entry is called; a host that is not known is shown as it is). A provider that is not known keeps CLIProxyAPI's name for it. - Everything is read from CLIProxyAPI's list; nothing is guessed from a model's id or owner. A CLIProxyAPI that does not list its credentials, or a list that can't be read, leaves every name as it was.
- It says what the list said when it was fetched: after changing credentials or priorities in CLIProxyAPI, run
/provimux-refresh(the startup refresh also updates it). What answered a given request is a separate matter: see the next section.
pi shows a model's name in /model beside its id and searches it, and its model patterns (--model, scoped models)
also match names: openrouter now matches every model that comes from OpenRouter, not only ids that contain the
word.
Which route answered, in the footer
Provimux can serve one model name through several routes (subscription logins, API keys, OpenRouter …). After each answer on a Provimux model, the footer says which one answered it, in the words of the model names:
answered: Anthropic sub
answered: Devin sub
answered: Anthropic api
answered: OpenRouter api
It only ever shows the route that produced the answer you see.
- It is read from the answer itself: the
X-CPA-AUTH-*response headers, or on the Codex WebSocket thecpa_auth_*fields of the turn'sresponse.created. No other extension is needed. - When pi tries a request again (an HTTP 429, or a Codex WebSocket continuation replayed on a fresh socket), only what the attempt that answered said counts: an attempt that names nobody is unnamed, whatever an earlier one said.
- Only an answer changes it: a turn that completed (or calls tools) with something in it. A failed, aborted or empty turn leaves it as it was.
- Whatever routes an install has and however it orders them, the footer names the one that answered: the credential list and its priorities play no part, and a route that is not in the list is named all the same.
- Only the session's own turns count: pi's cache warmer and other extensions' requests, which can run at the same time, never change it.
answered: unknown: the proxy names answers (its model list lists credentials, as Provimux's does; a lookup of the list that fails changes nothing), but not this one (Provimux leaves an answer unnamed when plugin code took part in it).- Needs Provimux 8.1.1-pmx.1 or newer for the footer: an answer counts as named only with both its kind and its
provider (
X-CPA-AUTH-KINDandX-CPA-AUTH-PROVIDER), which Provimux sends from that version on. - Nothing from a proxy that names no answer (plain CLIProxyAPI), and nothing while a model of another provider is selected or answers, even for a Provimux answer that ends after the switch.
Set "answered": false in ~/.pi/agent/provimux.json to turn it off (takes effect on the next start or
/reload).
Where each model comes from (for other extensions)
Through CLIProxyAPI pi sees one provider, but each model is served by a subscription login or an API key of some lab,
and the two can differ in window, prompt-cache lifetime and price (a Claude login keeps a cache for an hour, a Claude
API key for 5 minutes by default). This package tells other pi extensions where each model comes from, over pi's event
bus (pi.events), so that they need to know nothing about CLIProxyAPI.
pi-cache-keeper uses it to fill windows, cache lifetimes and prices
from providers.dev.
model-upstreams:request: an extension that wants the routes sends this (any payload). This package then asks CLIProxyAPIGET /v1/models?include=accountsagain and answers. Without such an extension this adds no request; the model list itself is always loaded with?include=accounts, for the names and the Claude Messages format. The answer belongs to the session that asked: when it ends (quit,/reload, another session) before the list arrives, the lookup is aborted and nothing is said.model-upstreams:{ provider, models: { [modelId]: { upstreams, fallbacks? } } }, the answer, and again after/provimux-refresh.upstreamsare what may serve the model (several: it is not known which),fallbackswhat may answer when those fail or cool down.model-upstreams:answered(Provimux):{ provider, model, upstreams }, what answered a request, at most once per answer.modelis the model the request was sent to (a virtual model's routed model, not the selection). Over HTTP and SSE only the response headers count: the kind inX-CPA-AUTH-KIND, the credential's provider inX-CPA-AUTH-PROVIDERand an API key's host inX-CPA-AUTH-HOST; fields in the body are not Provimux's (an inner gateway's) and are ignored. Over the Codex WebSocket, which has no response headers per turn, only thecpa_auth_kind,cpa_auth_providerandcpa_auth_hostfields Provimux puts on the turn'sresponse.created.- With the provider,
upstreamsis that one credential, whatever its priority, read from the response alone: its provider (whatever its letter case), its kind, and its host, where no host means the credential has none. The credential list is not consulted (it may be older than the proxy's state) nor waited for. A Claude login and a Devin login serving the same model are told apart. A credential that leads to a service not known is still named, so a change of route is seen: by its host for an API key that has one (api.example.test), else by its provider as the response gives it. - Needs Provimux 8.1.1-pmx.1 or newer, which sends the provider with the kind. A kind without a provider names nobody (below).
upstreams: []: answered, by something the proxy would not name. Provimux leaves an answer without the three when plugin code took part in its bytes; from a proxy that names answers (it lists its credentials, or named an answer before in this session) such an answer is reported as[], so that a listener does not keep the last named credential's values. Read it as "route not known". Whether the proxy names answers is known only once its credential list has loaded or it has named one: an answer that names nobody while the list is still loading and before anything was named in this session is not reported. A list that could not be read counts as still loading.- Nothing from plain CLIProxyAPI, which names no answer, nor before an extension asked for the routes.
- When: as soon as the answer's headers (or its
response.createdevent) arrive and its stream's first event says which model it is for, so before the answer ends, while the request is still out. - Each request on its own. Requests overlap: pi's cache warmer refreshes the cache while the turn it warms is still streaming, and an extension can send its own request with the session's callbacks. Each request keeps its own response headers and its one report, so an answer is never reported with another request's credential or model.
pi-cache-keeper reads
upstreams: []as "route not known".- With the provider,
An upstream is { provider, model?, subscription? }: the pi provider the model would come from if used directly
(anthropic, openai-codex, openai, meta, openrouter, google) or a providers.dev provider pi has none for
(devin, antigravity); the model's id there when it differs; true for a subscription login, false for an API
key, absent when not known.
How the routes are made:
- Provimux, or a CLIProxyAPI that lists its credentials (router-for-me/CLIProxyAPI#7634):
CLIProxyAPI uses the highest priority that is free in every routing mode and picks among the credentials sharing it
(round-robin by default; with no priority set, all share 0). So the
upstreamsare the credentials at the highest priority, thefallbacksthe others. An API key whose host CLIProxyAPI names goes by the host (openrouter.ai,api.openai.com,api.anthropic.com,generativelanguage.googleapis.com,api.x.ai,api.meta.ai,api.kimi.com,api.moonshot.ai,api.moonshot.cn,api.deepseek.com,api.mistral.ai,api.groq.com,api.cerebras.ai,api.fireworks.ai,api.together.ai,integrate.api.nvidia.com,api.xiaomimimo.com; another host is not known), whatever its entry is called; without a host, an OpenAI-compatible entry counts as OpenRouter only when namedopenrouter. The model id is the provider's own, as pi's catalog has it (the session's models, else the catalog pi-ai is built with): a prefix before it (CLIProxyAPI's own, or one configured for the credential) is left out unless what is left is not in the catalog and the id with it is. Soopenai/gpt-oss-120bat Groq stays as it is, and a prefixopenaibefore Groq'sllama-3.3-70b-versatileis left out;Qwen/Qwen3.6-Plusat Together,google/gemma-3-12b-itat NVIDIA,accounts/fireworks/models/…at Fireworks andlab/modelat OpenRouter are kept whole. A model the catalog does not have keeps as many parts as nearly all the provider's ids have, else its last. A credential at the top that leads somewhere not known makes the route not known (upstreams: []). - A CLIProxyAPI that doesn't: the lab its model list names as the owner (
owned_by), by login or key (subscriptionabsent; for OpenAI the Codex login or an OpenAI key);devin/…(CLIProxyAPI's own prefix) is Devin; any other name with a slash is not known.
Elapsed time and TPS (TUI)
The provider extension also loads extensions/tps.ts (so pi lists the package as a single extension), which only activates for the primary interactive TUI session (ctx.hasUI && ctx.mode === "tui"):
- While the agent is running, the footer shows
Elapsed …(updates every second). - When the agent settles, the footer keeps the final elapsed time and a notification reports approximate TPS plus token usage (
out/in/ cache r/w / total). - Subagent and print-mode sessions do not own the timer, clear the parent footer, or emit TPS toasts.
Set "tps": false in ~/.pi/agent/provimux.json to turn off just this helper (takes effect on the next start or /reload).
Failure behavior
- CLIProxyAPI
closed network connectionresponses are normalized as transient network errors so pi's agent-level retry policy reconnects and restarts the interrupted assistant turn. Completed conversation and tool results remain available; token streaming does not resume from the exact interruption point. - Before setup / without credentials: provider still appears in
/login; no models are listed yet. - After successful
/login: models are registered; credentials are stored inauth.jsonand mirrored toprovimux.json. - The built-in
/logoutcommand removes only the matchingauth.jsoncredential; environment variables andprovimux.jsonare unchanged. - If a models request returns HTTP 401 or CPA is unreachable during startup, an existing matching cache remains in use while the background refresh fails. Only when no cache is available is a warning logged; reconfigure via
/login Provimuxor fix config/env. - Login final step validates credentials by requesting models:
- HTTP 200 (including empty catalog) → credentials are persisted
- non-200 / network / invalid baseUrl → nothing is persisted; re-enter baseUrl + API key
- If CPA returns HTTP 200 with zero usable models: login still succeeds; re-run
/login Provimuxlater after models become available. - If the selected model does not provide a non-empty
service_tiersarray: the request is left unchanged;/fastand/ultrafaststill update the global preference and warn when enabling a mode. - After
/compact, threshold compaction, or overflow recovery, the provider closes the reused Codex WebSocket for the current session. CLIProxyAPI binds server-side context to the connection, so a reused socket would keep reporting a near-fullcacheReadand retrigger proactive compaction even though the client context is now small. SSE is unaffected because it bills from the request body.
Credits
pi-provimux is a fork of pi-cliproxyapi-provider by Router-For.ME, released under the MIT license. Nearly everything it does is their work: the provider, the login, the model mapping, the cache, the Fast modes and the Codex stream. pi-provimux adds the Provimux parts above and merges the original's changes. Thank you to router-for-me for the extension and for CLIProxyAPI.
License
MIT. See LICENSE.