Oh My Pi provider plugin that discovers models from CLIProxyAPI and registers them for use in omp. Ported from pi-cliproxyapi-provider. It supports catalog-driven OpenAI Fast mode and a status helper that shows elapsed runtime plus a TPS / token-usage toast after each agent turn.
- Registers the
cliproxyapiprovider (OAuth-style entry), so it always appears in/login. - Interactive setup collects
baseUrl+apiKey:/login CLIProxyAPIor/login cliproxyapi. The final step validates credentials against{root}/v1/models?client_version=piand re-prompts on failure. - Maps the CLIProxyAPI catalog into omp models, including Fast service-tier capability, and registers inference against
{root}/backend-api/. - Provides
/fastto toggle OpenAI priority processing for supported models. - Caches the model catalog in
~/.omp/agent/cliproxyapi-models.json, refreshes it in the background on startup, and provides/cliproxyapi-refreshto force a refresh. - In interactive TUI sessions, shows an elapsed-time status during runs and emits a TPS / token usage notification when the run settles.
# from npm
omp install npm:@router-for-me/omp-cliproxyapi-provider # when published / supported
# from a local checkout
git clone https://github.com/ngctro/omp-cliproxyapi-providerFor a local checkout, either symlink/copy it into your user extensions directory:
ln -s "$PWD" ~/.omp/agent/extensions/omp-cliproxyapi-provideror point settings at it (~/.omp/agent/config.yml):
extensions:
- /absolute/path/to/omp-cliproxyapi-providerThe package manifest (omp.extensions) points at src/index.ts; no build step is required. Run once with -e /path/to/checkout/src/index.ts to test ad hoc.
The provider needs both baseUrl and apiKey.
/login CLIProxyAPI # or /login cliproxyapi
Then enter:
- base URL — preferred form is host:port, e.g.
http://127.0.0.1:8317 - API key
Final login validation calls {root}/v1/models?client_version=pi:
- HTTP 200 → login succeeds (empty model list is still OK); models are registered immediately and the catalog cache is rewritten
- non-200 / network error → re-prompt; nothing is persisted until validation passes
On success:
baseUrl/apiKeyare written to~/.omp/agent/cliproxyapi.json- credentials are stored by OMP's auth store (
agent.db) so inference requests authenticate automatically
Re-run /login CLIProxyAPI anytime to reconfigure. OMP's built-in /logout <provider> removes only the stored credential; cliproxyapi.json is left in place — remove or edit that file if you also need to clear provider configuration.
~/.omp/agent/cliproxyapi.json:
{
"baseUrl": "http://127.0.0.1:8317",
"apiKey": "12345",
"fast": false,
"pause": false,
"providerId": "cliproxyapi",
"providerName": "CLIProxyAPI"
}Environment overrides: CLIPROXYAPI_BASE_URL, CLIPROXYAPI_API_KEY, CLIPROXYAPI_PROVIDER_ID, CLIPROXYAPI_PROVIDER_NAME, CLIPROXYAPI_FAST (true/false, 1/0, yes/no, on/off). Resolution order: env > config file > default baseUrl (http://127.0.0.1:8317). Unlike upstream there is no auth.json fallback — after a successful /login the same values are mirrored into cliproxyapi.json.
Preferred form is host:port only. All of these resolve the same way as upstream:
| Input | Inference baseUrl |
|---|---|
http://127.0.0.1:8317 |
http://127.0.0.1:8317/backend-api/ |
http://127.0.0.1:8317/backend-api |
http://127.0.0.1:8317/backend-api/ |
http://127.0.0.1:8317/v1 |
http://127.0.0.1:8317/backend-api/ |
127.0.0.1:8317 |
http://127.0.0.1:8317/backend-api/ |
Inference traffic posts to {inference}/codex/responses.
Requests the OpenAI priority service tier for supported models (lower latency, higher cost).
Fast is off by default. Toggle with /fast; the preference persists in cliproxyapi.json. When enabled at startup, the session's OpenAI-family service tier is set to priority immediately.
Implementation note (OMP divergence): instead of payload hooks, Fast uses OMP's native per-session service-tier knob for the openai family. Requests carry service_tier: "priority" when the selected model id looks like an OpenAI model (gpt-/o3-/codex-/…); other ids are left unchanged. As upstream, /fast warns that the current model cannot use Fast when enabling it with an unsupported model. When models.dev publishes experimental.modes.fast.cost, re-registration swaps in those rates.
Fast capability stays catalog-driven: a CPA model is Fast-capable when its service_tiers field is a non-empty array. Supported models do not produce separate status text (the OMP status line already surfaces priority tiers).
/pause # waits before every provider request
/continue # clears the pause
Both persist pause in cliproxyapi.json. Before every request the setting is reread; while paused, requests poll every 200 ms until cleared.
~/.omp/agent/cliproxyapi-models.json stores model metadata plus derived endpoint URLs and a fetchedAt timestamp — never credentials. Remote query timeout: 60 s. Cache scope: current baseUrl (a different base URL ignores it).
Startup behavior matches upstream: cached models register immediately, then a background refresh rewrites the cache on success; without a cache the first query is synchronous and a failure logs a warning. /cliproxyapi-refresh forces a remote refresh, rewrites the cache, and updates registered models. Delete the file to clear the cache manually.
Same rules as upstream: slug→id, display_name→name, context_window, input_modalities→input types, supported_reasoning_levels[].effort→thinking efforts (non-canonical spellings ignored; unsupported levels simply absent from the effort list rather than hidden via a null map), visibility:"hide" skipped. Prices match canonical entries from models.dev (24 h cache at ~/.omp/agent/tmp/models-dev-cache.json); ambiguous reseller prices fall back to zero rather than guessing.
Active only for primary interactive TUI sessions (ctx.hasUI && ctx.mode === "tui"):
- While the agent runs, an
Elapsed …status updates every second. - On terminal settle (including auto-retry continuations within one run), a notification reports approximate TPS plus token usage (
out/in/cache r/w/total) and the final elapsed time. - Subagent and print-mode sessions do not own the timer, clear the status, or emit toasts.
| Upstream piece | This port | Reason |
|---|---|---|
codex-stream.ts runtime source patching |
Removed; uses built-in openai-codex-responses API |
OMP's transport derives the account-id header from a JWT and omits it for plain keys, so plain CPA keys work natively |
retry.ts transient-error normalization |
Removed | OMP TurnRecovery classifies closed/refused connections and similar transient failures as retryable natively |
auto-compact.ts proactive compaction |
Removed | Context overflow routes into OMP's native compaction-recovery path |
fast-footer.ts footer / model-status "fast" chip |
Removed (no footer seam in OMP) | OMP exposes setStatus/widgets instead; the service tier itself is visible through the session UI |
tps.ts agent_settled event |
Finalize on terminal agent_end (willContinue !== true) |
Same lifecycle, native OMP events |
Files under ~/.pi/agent/ |
~/.omp/agent/ |
OMP agent dir |
auth.json credential fallback |
Removed (env > cliproxyapi.json > default) |
Credentials live in OMP's agent store; /login mirrors them into cliproxyapi.json |
CLIENT_VERSION stays "pi": CLIProxyAPI filters its catalog by this parameter and the pi vocabulary is the documented contract.
Equivalent to upstream: unauthenticated providers still appear in /login with no models yet; 401/unreachable during startup keeps an existing matching cache active and only logs when no cache exists; login validation failure never persists anything.
bun install
bun run check # tsc --noEmit + bun test
bunx tsc --noEmit
bun test # all testsTests stub CLIProxyAPI over local HTTP where needed; no external network required.