# @hank-warren/pi-cliproxyapi-provider

## 0.5.0

### Minor Changes

- CLIProxyAPI is now the source of truth for model details. Everything its model catalog publishes wins: display name, context window, output limit, input modalities and effort levels. models.dev and pi's built-in catalog supply cost, and fill only what CLIProxyAPI leaves out.

  - **Thinking levels:** CLIProxyAPI's effort list decides which levels pi offers, and a level it does not list is hidden. Claude keeps `off` from pi's native definition, because CLIProxyAPI's catalog cannot express it. On the Codex route `minimal` maps to `low`. An empty list or the `gpt-5.5` template filler still falls back to pi's native map, the family rules and the metadata. Models without a `none` effort no longer offer `off`: on the Codex GPT-5.6/6 routes, CLIProxyAPI ran it at `low`.
  - **Codex context window:** `canonical` (the default) now publishes CLIProxyAPI's `context_window` for the route, for example 500000 for GPT-6.1 Sol, instead of capping it at pi's 272000. `full` still publishes `max_context_window`.
  - **Input:** a route CLIProxyAPI serves as text-only, such as `devin/deepseek-v4-flash` and `devin/inkling`, is no longer offered images.

## 0.4.0

### Minor Changes

- Take model limits from CLIProxyAPI itself and give routing-prefixed models their base model's metadata.

  - Each discovery also reads CLIProxyAPI's Codex-client catalog (`/v1/models?client_version=`), which carries its registry's context window, output limit, effort levels, input modalities and display name. Its context window and output limit win over models.dev, so pi's `max_tokens` matches what the route allows (`devin/claude-opus-5-5`: 64000). An entry is used only when it carries `max_tokens`, CPA's own data rather than template filler. A failed spec fetch never fails discovery and keeps the previous specs.
  - A prefixed id (`team/gpt-6-sol`, `plus/gpt-6-sol`, `devin/claude-opus-5-5`) that matches nothing is matched by its base id, so account-pinned and provider-namespaced routes get real cost, modalities and thinking maps instead of pi's 128000/16384 defaults. Requests keep the full id.
  - A canonical owner now also matches punctuation-insensitively within its provider (Devin's `gpt-5-6-sol`), and CLIProxyAPI's `moonshot`/`zhipu` owners map to models.dev's `moonshotai`/`zhipuai`.
  - CPA's effort list describes models nothing else does (Devin's SWE models), ignoring the `gpt-5.5` template list CPA pads unknown models with.
  - A models.dev limit of `0` (image-generation models) no longer becomes a 0-token context window.
  - `gpt56ContextWindow: "full"` now uses CPA's `max_context_window`, falling back to models.dev; canonical mode takes the smaller of CPA's and pi's window.
  - `/cliproxyapi status` counts models with CPA limits, and a refresh reports a failed spec fetch.

## 0.3.0

### Minor Changes

- Publish pi's native Claude mid-conversation system messages and tool changes, so a system-prompt or tool change mid-session no longer rewrites the prompt cache.

  - Claude models that pi's native catalog marks with `supportsMidConvoSystemMessages` and `supportsMidConvoToolChanges` now carry them. A later system-prompt change is sent as a `role: "system"` message, and a tool change as `tool_addition`/`tool_removal` blocks against deferred declarations. Measured through CLIProxyAPI v8.0.15: across a mid-session tool change, the next turn read the whole 17.8k-token prefix from cache, where the previous behaviour read none of it and rewrote it.
  - **This requires CLIProxyAPI v8.0.4 or later.** Earlier releases do not rewrite tool names inside `tool_addition`/`tool_removal` blocks for OAuth credentials (router-for-me/CLIProxyAPI#6174), so the first request after a tool change fails with "references unknown tool". Set `"midConversationUpdates": false` under `pi-cliproxyapi-provider` in `settings.json`, or disable it in `/cliproxyapi config` → `Models`, for older proxies. It is independent of `perTurnEffort` (v8.0.3+).
  - `/cliproxyapi status` reports the new setting.

## 0.2.2

### Patch Changes

- Typecheck against pi 0.99 and 1.0: the model list is kept as the package's own chat-model type throughout and widens to pi's chat | image | classifier union only at `registerProvider`, so `model-ui.ts` compiles again. Types only; runtime behavior is unchanged, and pi 0.84 still typechecks.

## 0.2.1

### Patch Changes

- Typecheck against pi 0.99, whose `ProviderModelConfig` is a chat | image | classifier union: `compat` and `api` are now taken from the chat member. Types only; runtime behavior is unchanged, and pi 0.84-0.87 still typecheck.

## 0.2.0

### Minor Changes

- Take Claude and Codex wire profiles from pi's native catalogs, and switch Claude effort per turn.

  - Claude and Codex-served GPT models now use the running pi's `anthropic` and `openai-codex` catalogs for their thinking maps, reasoning flag and context window. The hand-written GPT-5.5, GPT-5.6 and GPT-6 rules remain only as fallbacks for ids pi does not list. As a result:
    - GPT-5.6 `minimal` sends `low` instead of being rejected by the Codex route.
    - GPT-5.5 and every other model in pi's Codex catalog go over the Responses API.
    - GPT-5.3 Codex Spark advertises its real 128000-token window.
  - Opus 5, Opus 5.5 and Fable 5.1 publish `supportsMidConvoEffort`. Changing the thinking level mid-session becomes a per-turn directive, so the prompt cache survives the switch.
  - **This requires CLIProxyAPI v8.0.3 or later.** Older releases reject the directive and fail every request to those models. Set `"perTurnEffort": false` under `pi-cliproxyapi-provider` in `settings.json`, or disable it in `/cliproxyapi config` → `Models`, to keep top-level effort.

## 0.1.1

### Patch Changes

- Ship the startup fix the 0.1.0 changelog announced. 0.1.0 was published from the package's initial merge (#20), before the perf work in #21 landed; #21 then re-applied a changeset onto the same version, so its publish was skipped as already on npm. The registry's 0.1.0 tarball is the pre-fix code (~3.3 s of startup on a warm cache). This release carries the indexed metadata catalog, offline `refreshModels` reuse of the current snapshot, and the pruned models.dev cache; measured startup for the extension drops from ~3.9 s to ~0.7 s.

## 0.1.0

### Minor Changes

- Initial publication of the fork of `0xRichardH/pi-cliproxyapi-provider` (0.15.23 at `hank-warren/pi-cliproxyapi-provider@3a4d021`), with two changes:

  - The 4.7 MB `models-dev-fallback.json` first-run seed is replaced by pi-ai's own built-in model catalog, read at runtime from `@earendil-works/pi-ai/providers/all`. It ships zero bytes, is regenerated on every pi release, and carries a finished `thinkingLevelMap` per model. `/cliproxyapi status` reports it as `builtin (pi catalog generated <age>)`; the live models.dev fetch still replaces it on the first model discovery.
  - Startup cost drops from ~3.3 s to ~0.2 s on a warm cache: the metadata catalog is indexed once per snapshot instead of scanned per model, offline `refreshModels` calls reuse the current snapshot instead of re-reading the cache, and the cache is pruned to the nine models.dev fields the provider reads (7.5 MB → under 3 MB).
