pi-cliproxyapi-native 0.1.9 → 0.2.1

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 CHANGED
@@ -4,17 +4,38 @@ Use [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) for chat, image
4
4
 
5
5
  Chat uses Pi's native API adapters and model metadata, with availability from your proxy. Image and video tools have separate model selections, so you can generate media without switching your chat model.
6
6
 
7
+ ## Contents
8
+
9
+ - [Install](#install)
10
+ - [Connection](#connection)
11
+ - [Images and videos](#images-and-videos)
12
+ - [Choose a media model](#choose-a-media-model)
13
+ - [Generate media](#generate-media)
14
+ - [Resolution and aspect ratio](#resolution-and-aspect-ratio)
15
+ - [Supported media models](#supported-media-models)
16
+ - [Files, status, and limits](#files-status-and-limits)
17
+ - [Chat models](#chat-models)
18
+ - [Refresh](#refresh)
19
+ - [Wait for quota reset](#wait-for-quota-reset)
20
+ - [Compaction](#compaction)
21
+ - [Aliases and model limits](#aliases-and-model-limits)
22
+ - [Backend routes](#backend-routes)
23
+ - [OAuth and API-key routes](#oauth-and-api-key-routes)
24
+ - [Thinking and child sessions](#thinking-and-child-sessions)
25
+ - [Protocol notes](#protocol-notes)
26
+ - [License](#license)
27
+
7
28
  ## Install
8
29
 
9
- The extension targets Pi 1.1.0 and CLIProxyAPI 8.0.22, with Node.js 22.19 or newer. Run CLIProxyAPI with your upstream accounts configured before connecting Pi. The extension uses Pi's host-provided packages, adds no runtime dependencies, and needs no compilation.
30
+ The extension targets Pi 1.3.0 and CLIProxyAPI 8.0.32, with Node.js 22.19 or newer. Run CLIProxyAPI with your upstream accounts configured before connecting Pi. The extension uses Pi's host-provided packages, adds no runtime dependencies, and needs no compilation.
10
31
 
11
32
  If you installed `pi-cliproxy-native`, remove it before installing the renamed package. Both register the same `cliproxyapi` provider.
12
33
 
13
34
  ```sh
14
- pi install npm:pi-cliproxyapi-native@0.1.9
35
+ pi install npm:pi-cliproxyapi-native@0.2.1
15
36
  ```
16
37
 
17
- For Git installation, use `pi install git:github.com/hawkff/pi-cliproxyapi-native@v0.1.9`. For a local checkout, use `pi install /path/to/pi-cliproxyapi-native`.
38
+ For Git installation, use `pi install git:github.com/hawkff/pi-cliproxyapi-native@v0.2.1`. For a local checkout, use `pi install /path/to/pi-cliproxyapi-native`.
18
39
 
19
40
  The default proxy address is `http://localhost:8317`. For another address, set the [connection](#connection) before logging in. Restart Pi, then run:
20
41
 
@@ -197,7 +218,7 @@ Without a management key, Claude retains its SDK retry settings and response-bas
197
218
 
198
219
  Invalid management credentials, rejected account access, invalid usage data, or an exhausted allowance with an expired reset stop the quota wait with an explanation. These failures do not trigger Pi's quick retries. Extension-managed waits share one fixed seven-day deadline per provider call; a new cooldown cannot extend it. The extension checks the deadline after waking and before accepting available quota, including after machine sleep. It does not replay a request that has started streaming.
199
220
 
200
- Management requests stay on the configured proxy and reject redirects. Account access tokens stay in CLIProxyAPI. The extension reads account metadata and proxies usage GETs; it does not reset quotas, change credentials, or clear proxy cooldowns. Management keys grant broader access than chat keys, so keep them private. Live lookup supports up to 100 active Claude subscription accounts.
221
+ Live quota lookup requires CLIProxyAPI's `/v8/management` API and does not fall back to legacy `/v0/management` routes. Management requests stay on the configured proxy and reject redirects. Account access tokens stay in CLIProxyAPI. The extension reads account metadata and proxies usage GETs; it does not reset quotas, change credentials, or clear proxy cooldowns. Management keys grant broader access than chat keys, so keep them private. Live lookup supports up to 100 active Claude subscription accounts.
201
222
 
202
223
  Explicit `api/` routes skip live Claude subscription lookup, even with a management key. `oauth/` routes keep the lookup for matching OAuth accounts. Retries keep the selected route's full model ID.
203
224
 
@@ -231,6 +252,8 @@ The recognized prefixes are `vertex/`, `antigravity/`, `api/`, and `oauth/`. Eac
231
252
 
232
253
  For Antigravity IDs `claude-opus-5-5-high` and `claude-sonnet-5-5-high`, the extension falls back to `anthropic/claude-opus-5-5` and `anthropic/claude-sonnet-5-5` metadata. This applies to bare IDs and the recognized route prefixes. Explicit aliases take precedence, followed by exact native metadata. The fallback requires the corresponding canonical entry in Pi and names the model like a configured alias, for example `claude-opus-5-5-high (Claude Opus 5.5)`; requests keep the advertised `-high` ID.
233
254
 
255
+ The same fallback rules map `gemini-4-argon-high` to `google/gemini-4-argon`, including recognized route prefixes.
256
+
234
257
  Use Pi's `models.json` `modelOverrides` for limits, prices, or compatibility changes. Use its `models` array for IDs with no built-in metadata. Updating Pi supplies newer metadata. Catalog prices are estimates, not the proxy's bill; check upstream limits before increasing them.
235
258
 
236
259
  ## Backend routes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-cliproxyapi-native",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "CLIProxyAPI chat discovery and image/video generation with Pi's native adapters",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -39,9 +39,9 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@biomejs/biome": "^2.5.13",
42
- "@earendil-works/pi-ai": "^1.1.0",
43
- "@earendil-works/pi-coding-agent": "^1.1.0",
44
- "@earendil-works/pi-tui": "^1.1.0",
42
+ "@earendil-works/pi-ai": "^1.3.0",
43
+ "@earendil-works/pi-coding-agent": "^1.3.0",
44
+ "@earendil-works/pi-tui": "^1.3.0",
45
45
  "@types/node": "^24.13.4",
46
46
  "typescript": "5.9.3"
47
47
  },
package/src/catalog.ts CHANGED
@@ -180,6 +180,7 @@ const owners: Readonly<Record<string, string>> = {
180
180
  const metadataFallbacks = new Map([
181
181
  ["claude-opus-5-5-high", "anthropic/claude-opus-5-5"],
182
182
  ["claude-sonnet-5-5-high", "anthropic/claude-sonnet-5-5"],
183
+ ["gemini-4-argon-high", "google/gemini-4-argon"],
183
184
  ]);
184
185
 
185
186
  export function mapCatalog(value: unknown, config: Config, known: readonly Model<Api>[]) {
@@ -15,7 +15,7 @@ async function managementRequest(
15
15
  ) {
16
16
  let response: Response;
17
17
  try {
18
- response = await fetch(`${config.baseUrl}/v0/management/${path}`, {
18
+ response = await fetch(`${config.baseUrl}/v8/management/${path}`, {
19
19
  method: body ? "POST" : "GET",
20
20
  headers: { Authorization: `Bearer ${key}`, ...(body ? { "Content-Type": "application/json" } : {}) },
21
21
  body: body ? JSON.stringify(body) : undefined,
@@ -135,7 +135,7 @@ export async function fetchClaudeQuota(
135
135
  );
136
136
  }
137
137
  const bounded = AbortSignal.any([...(signal ? [signal] : []), AbortSignal.timeout(15000)]);
138
- const listing = await managementRequest(config, key, "auth-files", bounded);
138
+ const listing = await managementRequest(config, key, "credentials", bounded);
139
139
  if (!isRecord(listing) || !Array.isArray(listing.files) || listing.files.length > 10000) {
140
140
  throw new Error("The management API returned an invalid account list.");
141
141
  }
@@ -168,13 +168,13 @@ export async function fetchClaudeQuota(
168
168
  const models = await managementRequest(
169
169
  config,
170
170
  key,
171
- `auth-files/models?name=${encodeURIComponent(account.name)}`,
171
+ `credentials/models?name=${encodeURIComponent(account.name)}`,
172
172
  bounded,
173
173
  );
174
174
  if (!isRecord(models) || !Array.isArray(models.models))
175
175
  throw new Error("The management API returned an invalid account catalog.");
176
176
  if (!models.models.some((model: unknown) => isRecord(model) && model.id === modelId)) return undefined;
177
- const response = await managementRequest(config, key, "api-call", bounded, {
177
+ const response = await managementRequest(config, key, "requests/api-call", bounded, {
178
178
  auth_index: account.auth_index,
179
179
  method: "GET",
180
180
  url: "https://api.anthropic.com/api/oauth/usage",