pi-cliproxyapi-provider 0.15.58 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -7
- package/data/models-dev-fallback.json +1 -1
- package/extensions/index.ts +10 -9
- package/package.json +7 -7
- package/src/commands.ts +1 -1
- package/src/gateway-telemetry.ts +3 -1
- package/src/matching.ts +42 -8
- package/src/model-api.ts +60 -5
- package/src/model-capabilities.ts +90 -8
- package/src/model-ui.ts +5 -5
- package/src/provider.ts +9 -13
- package/src/registration.ts +6 -8
- package/src/types.ts +10 -4
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# pi-cliproxyapi-provider
|
|
2
2
|
|
|
3
|
-
`pi-cliproxyapi-provider` registers one [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) instance as a pi model provider. It discovers models from CLIProxyAPI's OpenAI-compatible `/v1/models` endpoint and enriches them with provider-specific metadata from [models.dev](https://models.dev/). Mixed catalogs use OpenAI Completions by default, while GPT-5.
|
|
3
|
+
`pi-cliproxyapi-provider` registers one [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) instance as a pi model provider. It discovers models from CLIProxyAPI's OpenAI-compatible `/v1/models` endpoint and enriches them with provider-specific metadata from [models.dev](https://models.dev/). Mixed catalogs use OpenAI Completions by default, while Codex GPT models (`gpt-5.3-codex` and later, including GPT-6) use the Responses API so pi can read their usage data, and Claude models use the Anthropic Messages API so signed thinking blocks and per-turn thinking effort survive a multi-turn conversation. Canonical `/v1/models` owners such as `openai` select the matching provider metadata; aliases can override that selection when a proxy routes billing differently.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
+
Requires Pi 0.87.0 or later. Pi 0.86 kept tool declarations in transcript system messages and could drop them after a context handler or compaction, leaving the model without built-in tools. Pi 0.87.0 restores the full tool state ([#9846](https://github.com/earendil-works/pi/pull/9846)).
|
|
8
|
+
|
|
7
9
|
Install from npm:
|
|
8
10
|
|
|
9
11
|
```bash
|
|
@@ -75,11 +77,22 @@ Set `CLIPROXYAPI_METADATA_FALLBACK_PROVIDER=none` to disable unresolved-model me
|
|
|
75
77
|
|
|
76
78
|
Project config supports `metadataFallbackProvider`, metadata aliases, and bounded per-model overrides. Set `metadataFallbackProvider` to `null` or `"none"` to disable fallback. Connection and auth settings such as `baseUrl`, `providerName`, `authRequired`, `authHeader`, and `headers` must be set in global config or environment variables.
|
|
77
79
|
|
|
78
|
-
###
|
|
80
|
+
### Codex GPT context window
|
|
81
|
+
|
|
82
|
+
The provider advertises a conservative context window for the models CLIProxyAPI serves from Codex OAuth credentials, so compaction behavior matches Pi's native definitions and no assumption is made that every CLIProxyAPI route enables the provider's full long-context limit:
|
|
79
83
|
|
|
80
|
-
|
|
84
|
+
| Models | Default context window |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| `gpt-5.3-codex-spark` | `128000` |
|
|
87
|
+
| `gpt-5.4`, `gpt-5.5`, `gpt-5.6`, `gpt-5.6-luna`, `gpt-5.6-sol`, `gpt-5.6-terra` | `272000` |
|
|
88
|
+
| `gpt-6-astra`, `gpt-6-luna`, `gpt-6-sol` | `272000` |
|
|
89
|
+
| `gpt-5.6-cyber` | `400000` |
|
|
90
|
+
| `gpt-6.1-sol`, `gpt-6.1-terra` | `500000` |
|
|
91
|
+
| `gpt-5.3-codex`, `gpt-5.4-mini`, `gpt-5.4-nano`, `gpt-5.4-pro`, `gpt-5.5-pro` | models.dev limit |
|
|
81
92
|
|
|
82
|
-
|
|
93
|
+
These values mirror Pi's native `openai` and `openai-codex` catalogs.
|
|
94
|
+
|
|
95
|
+
To opt into the full context limit reported by models.dev (currently `1050000` tokens for the OpenAI Codex GPT models), add this package-specific setting to global `~/.pi/agent/settings.json`:
|
|
83
96
|
|
|
84
97
|
```json
|
|
85
98
|
{
|
|
@@ -98,7 +111,7 @@ Use `"full"` only when the selected CLIProxyAPI route and upstream account actua
|
|
|
98
111
|
|
|
99
112
|
### Model and display configuration
|
|
100
113
|
|
|
101
|
-
Run `/cliproxyapi config` in Pi TUI mode to edit every package-level `settings.json` value. The tabbed panel has `Connection`, `Models`, and `Display` sections; it controls the GPT
|
|
114
|
+
Run `/cliproxyapi config` in Pi TUI mode to edit every package-level `settings.json` value. The tabbed panel has `Connection`, `Models`, and `Display` sections; it controls the Codex GPT context-window mode and whether the model selector shows the published strict tool-schema capability.
|
|
102
115
|
|
|
103
116
|
```json
|
|
104
117
|
{
|
|
@@ -111,6 +124,16 @@ Run `/cliproxyapi config` in Pi TUI mode to edit every package-level `settings.j
|
|
|
111
124
|
|
|
112
125
|
`showStrictMode` defaults to `false` because the selector stays compact for normal use. Enable it when diagnosing tool-schema behavior; model details always show `Strict tool schema` explicitly. Saving through `/cliproxyapi config` reloads Pi. Select `Connection` to open the endpoint and authentication editor.
|
|
113
126
|
|
|
127
|
+
## Thinking levels
|
|
128
|
+
|
|
129
|
+
Claude models use the Anthropic Messages API, where Pi sends thinking effort per turn. Pi offers `xhigh` and `max` only when a model publishes a `thinkingLevelMap`, and hides every level that the map sets to `null`.
|
|
130
|
+
|
|
131
|
+
CLIProxyAPI's `/v1/models` response carries no effort data, so the provider derives the map from models.dev `reasoning_options` for Claude models only. It prefers the `anthropic/` entry named by `canonical_model_id`. Listed efforts map to themselves and any Pi level the model omits maps to `null`.
|
|
132
|
+
|
|
133
|
+
An entry with only effort values means thinking cannot be disabled, so `off` maps to `null`. When the entry lists a `toggle` or `budget_tokens` option, `off` stays available. A budget-only entry leaves the map unset and keeps Pi's default budget mapping.
|
|
134
|
+
|
|
135
|
+
GPT-5.3 Codex, GPT-5.4, GPT-5.5, GPT-5.6, and GPT-6 keep their hand-written maps, mirroring Pi's native `openai` catalog.
|
|
136
|
+
|
|
114
137
|
## Authenticate
|
|
115
138
|
|
|
116
139
|
Use pi's normal API-key login flow:
|
|
@@ -185,11 +208,11 @@ Project config reads `metadataFallbackProvider`, `modelAliases`, and `modelOverr
|
|
|
185
208
|
|
|
186
209
|
Run `/cliproxyapi models` in Pi TUI mode to inspect the models in the current CPA snapshot. The selector shows the effective API, reasoning mode, and context window. The detail view also shows input modalities, cost, thinking levels, and the compatibility values that Pi will publish.
|
|
187
210
|
|
|
188
|
-
Only `reasoning`, `contextWindow`, and `maxTokens` are editable. Values are constrained to safe presets; choose `auto` to remove an override and restore the derived value after reload. API routing and compatibility stay provider-owned: GPT
|
|
211
|
+
Only `reasoning`, `contextWindow`, and `maxTokens` are editable. Values are constrained to safe presets; choose `auto` to remove an override and restore the derived value after reload. API routing and compatibility stay provider-owned: Codex GPT models remain on `openai-responses` and Claude models on `anthropic-messages`, while the CLIProxyAPI workaround publishes `supportsStrictMode: false`.
|
|
189
212
|
|
|
190
213
|
For CPA Responses requests, the extension also applies the Codex-compatible function-tool wire contract used by `pi-codex-conversion`: each function tool explicitly carries `strict: null`. This preserves optional tool arguments such as `interactive_shell.listBackground` without replacing CPA authentication, transport, discovery, or streaming with the ChatGPT-backed `openai-codex-responses` provider.
|
|
191
214
|
|
|
192
|
-
Saving writes
|
|
215
|
+
Saving writes the project config and reloads Pi. Project overrides take precedence over global overrides field by field; choose `auto` to remove an override.
|
|
193
216
|
|
|
194
217
|
## Snapshots and startup
|
|
195
218
|
|