@billjr99/pi-openai-compat 1.1.16 → 1.1.17

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.
Files changed (3) hide show
  1. package/README.md +25 -23
  2. package/index.ts +11 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -59,23 +59,25 @@ If pi is already running when you install, type `/reload` first.
59
59
  | **llmproxy** | `http://localhost:8080/v1` (editable) | Keyless by default; bearer token if your instance requires one |
60
60
  | **Custom** | Any URL you supply | Optional bearer token |
61
61
 
62
- > **llmproxy and the `__` model-id rewrite.**
63
- > [llmproxy](https://github.com/BillJr99/llmproxy) advertises model ids in the
64
- > `provider__model` form (e.g. `openrouter__gpt-4`) and exposes virtual models
65
- > such as `llmproxy__free` and `llmproxy__loadbalanced`. pi rejects model ids that
66
- > contain `__`, so without special handling **every llmproxy model is silently
67
- > dropped from `/model`**. The llmproxy template therefore sets
68
- > `rewriteDoubleUnderscore: true`: the extension rewrites the first `__` of each id
69
- > to `/` (e.g. `openrouter__gpt-4` `openrouter/gpt-4`, `llmproxy__free`
70
- > `llmproxy/free`) before registering with pi. llmproxy canonicalizes that slash
71
- > form back to `__` on each request, so routing still works.
62
+ > **The `__` → `/` model-id rewrite (display compatibility).**
63
+ > Some providers advertise model ids in a `provider__model` form. For example,
64
+ > [llmproxy](https://github.com/BillJr99/llmproxy) exposes ids like
65
+ > `openrouter__gpt-4` and virtual models such as `llmproxy__free` and
66
+ > `llmproxy__loadbalanced`. The extension can optionally rewrite the first `__`
67
+ > of each id to `/` (e.g. `openrouter__gpt-4` → `openrouter/gpt-4`,
68
+ > `llmproxy__free` `llmproxy/free`) before registering with pi, so the ids
69
+ > display in the more familiar `provider/model` slash form. Upstreams that use
70
+ > the `__` convention canonicalize the slash form back to `__` on each request,
71
+ > so routing still works.
72
72
  >
73
- > The flag is a per-provider config field (`rewriteDoubleUnderscore`, default
74
- > **false**) and is enabled automatically only for the llmproxy template — other
75
- > providers are unaffected. If you added llmproxy as a **Custom** endpoint instead
76
- > of via the llmproxy template, set `"rewriteDoubleUnderscore": true` on that
77
- > provider in `~/.config/pi-openai-compat/config.json` (or re-run `/compat-login`
78
- > and pick **llmproxy (local)**).
73
+ > This is a presentation-only convenience controlled by a per-provider config
74
+ > field (`rewriteDoubleUnderscore`, default **false**). It is enabled
75
+ > automatically for the llmproxy template purely for display consistency other
76
+ > providers are unaffected, and you can turn it on or off freely. If you added a
77
+ > provider as a **Custom** endpoint and want the slash-form display, set
78
+ > `"rewriteDoubleUnderscore": true` on that provider in
79
+ > `~/.config/pi-openai-compat/config.json` (or re-run `/compat-login` and pick a
80
+ > template that enables it). Leaving it off keeps the original `__` ids.
79
81
 
80
82
  > **Providers whose model catalog lives at a non-standard `/models` path (as of June 2026)**
81
83
  > Some providers don't return models at `<base_url>/models`. The extension
@@ -347,13 +349,13 @@ For OpenRouter: some keys are restricted to free-tier models only.
347
349
  For NIM: confirm your account has inference access enabled.
348
350
 
349
351
  **`/compat-login` reports N models but far fewer appear in `/model`**
350
- This is the classic llmproxy symptom: pi drops every model id containing `__`, so
351
- llmproxy's `provider__model` ids (and `llmproxy__free` / `llmproxy__loadbalanced`)
352
- never show. Make sure you logged in via the **llmproxy (local)** template (it sets
353
- `rewriteDoubleUnderscore: true` automatically). If you used **Custom**, add
354
- `"rewriteDoubleUnderscore": true` to that provider in
355
- `~/.config/pi-openai-compat/config.json` and re-run `/compat-refresh`. After the
356
- fix the ids appear in slash form (`openrouter/gpt-4`, `llmproxy/free`).
352
+ The usual cause is a **scoped or restricted API key/account** the catalog
353
+ endpoint advertises the full model list, but your credentials are only entitled
354
+ to a subset, so pi only surfaces the ones you can actually use. Check whether your
355
+ key is limited to specific models or a free tier on the provider's dashboard.
356
+ (This is unrelated to the `__` → `/` rewrite, which is a display-only convenience —
357
+ see the note in **Supported providers** above. Toggling `rewriteDoubleUnderscore`
358
+ only changes how ids are displayed, not how many appear.)
357
359
 
358
360
  **Models appear in `/model` but requests fail**
359
361
  Check `/compat-login` ran successfully (no error message).
package/index.ts CHANGED
@@ -49,11 +49,11 @@ interface ProviderConfig {
49
49
  // only once rather than on every session_start while the config stays stale.
50
50
  staleNotified?: boolean;
51
51
  // When true, rewrite the FIRST "__" of every model id to "/" before
52
- // registering with pi. pi rejects model ids containing "__", so providers like
53
- // llmproxy (which uses "provider__model" ids) would otherwise have their entire
54
- // catalog dropped from /model. The rewrite is the inverse of llmproxy's own
55
- // request-side canonicalization, so requests still round-trip. Defaults false;
56
- // the wizard turns it on only for the llmproxy template.
52
+ // registering with pi, so ids from providers that use a "provider__model"
53
+ // convention (e.g. llmproxy) display in the more familiar "provider/model"
54
+ // slash form. This is a display-only convenience: such upstreams canonicalize
55
+ // the slash form back to "__" on each request, so requests still round-trip.
56
+ // Defaults false; the wizard turns it on only for the llmproxy template.
57
57
  rewriteDoubleUnderscore?: boolean;
58
58
  }
59
59
 
@@ -105,9 +105,10 @@ const TEMPLATES: Record<string, {
105
105
  /** Keep only models whose task.name matches this string (case-insensitive). */
106
106
  modelsKeepTask?: string;
107
107
  /**
108
- * Rewrite the first "__" of each model id to "/" before registering with pi.
109
- * pi drops model ids containing "__", so this is required for llmproxy (whose
110
- * ids are "provider__model"). Default false; set true only where pi needs it.
108
+ * Rewrite the first "__" of each model id to "/" before registering with pi,
109
+ * for display compatibility ids from "provider__model" upstreams (e.g.
110
+ * llmproxy) then show in the familiar "provider/model" slash form. Display-only;
111
+ * default false; set true where you want the slash-form presentation.
111
112
  */
112
113
  rewriteDoubleUnderscore?: boolean;
113
114
  }> = {
@@ -302,8 +303,8 @@ const TEMPLATES: Record<string, {
302
303
  keyless: true,
303
304
  promptUrl: true,
304
305
  // llmproxy advertises "provider__model" ids (and virtuals like
305
- // "llmproxy__free"). pi rejects "__" in model ids, so rewrite the first
306
- // "__" to "/" here; llmproxy canonicalizes the slash form back on requests.
306
+ // "llmproxy__free"). Rewrite the first "__" to "/" here so they display in
307
+ // the familiar slash form; llmproxy canonicalizes it back on requests.
307
308
  rewriteDoubleUnderscore: true,
308
309
  },
309
310
  vercel: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@billjr99/pi-openai-compat",
3
- "version": "1.1.16",
3
+ "version": "1.1.17",
4
4
  "description": "pi-coding-agent extension: OpenAI-compatible endpoint support (OpenRouter, NVIDIA NIM, Nous Portal, Ollama, custom)",
5
5
  "author": "Bill Mongan <https://github.com/BillJr99>",
6
6
  "license": "MIT",