@billjr99/pi-openai-compat 1.1.25 → 1.1.27
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 +4 -0
- package/index.ts +18 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,7 @@ If pi is already running when you install, type `/reload` first.
|
|
|
65
65
|
| **xKiro** | `https://api.xkiro.com/v1` | `sk-xt-...` key from the xKiro console at xkiro.com (docs.xkiro.com) |
|
|
66
66
|
| **TeamoRouter** | `https://api.teamorouter.com/v1` | `sk-teamo-...` key from teamorouter.com (teamorouter.com/docs) |
|
|
67
67
|
| **GMI Cloud** | `https://api.gmi-serving.com/v1` | API key from console.gmicloud.ai → Organization Settings → API Keys |
|
|
68
|
+
| **Token Harbor** | `https://tokenharbor.ai/v1` | `thk_live_...` Universal Key from tokenharbor.ai/dashboard/api-keys |
|
|
68
69
|
| **Ollama (local)** | `http://localhost:11434/v1` | Keyless |
|
|
69
70
|
| **Ollama Cloud** | `https://ollama.com/v1` | Ollama Cloud API key from ollama.com |
|
|
70
71
|
| **llmproxy** | `http://localhost:8080/v1` (editable) | Keyless by default; bearer token if your instance requires one |
|
|
@@ -213,6 +214,9 @@ provider's `/models` catalog does not report them:
|
|
|
213
214
|
| `maxTokens` | number | `4096` | Maximum output tokens per response. |
|
|
214
215
|
| `reasoning` | boolean | `false` | Enables pi's thinking mode for the model. |
|
|
215
216
|
| `input` | `["text"]` or `["text","image"]` | `["text"]` | Modalities pi may send; `image` lets pi attach image blocks. Any other value is ignored. |
|
|
217
|
+
| `thinkingLevelMap` | object | omitted | pi thinking-level remap, passed through to the registered model. Keys are pi thinking levels (`off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`); string values are sent to the provider, `null` hides an unsupported level. See [pi's docs](https://pi.dev/docs/latest/models#thinking-level-map). |
|
|
218
|
+
| `samplingParams` | object | omitted | Free-form object merged verbatim into every request body for the model (e.g. `top_k`, `min_p`, `presence_penalty`). Only OpenAI-compatible APIs apply it. |
|
|
219
|
+
| `compat` | object | omitted | OpenAI compatibility flags for the model (`thinkingFormat`, `chatTemplateKwargs`, `maxTokensField`, `supportsDeveloperRole`, …). See [pi's docs](https://pi.dev/docs/latest/models#openai-compatibility). |
|
|
216
220
|
|
|
217
221
|
Most catalogs report none of these beyond the ID, so aggregators and proxies
|
|
218
222
|
(CLIProxyAPI, for example) register every model as a 128K, text-only,
|
package/index.ts
CHANGED
|
@@ -37,6 +37,11 @@ interface CachedModel {
|
|
|
37
37
|
// omits them (see README "Config file"); /compat-refresh preserves them.
|
|
38
38
|
reasoning?: boolean;
|
|
39
39
|
input?: ModelInput[];
|
|
40
|
+
// Optional provider-model passthrough (mirrors pi's ProviderModelConfig):
|
|
41
|
+
// thinking-level remap, verbatim sampling params, and OpenAI compat flags.
|
|
42
|
+
thinkingLevelMap?: Record<string, string | null>;
|
|
43
|
+
samplingParams?: Record<string, unknown>;
|
|
44
|
+
compat?: Record<string, unknown>;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
interface ProviderConfig {
|
|
@@ -353,6 +358,13 @@ const TEMPLATES: Record<string, {
|
|
|
353
358
|
// control plane (containers, clusters, sandboxes) and has no /chat/completions.
|
|
354
359
|
keyHint: "console.gmicloud.ai → Organization Settings → API Keys (docs at docs.gmicloud.ai/inference-engine)",
|
|
355
360
|
},
|
|
361
|
+
tokenharbor: {
|
|
362
|
+
displayName: "Token Harbor",
|
|
363
|
+
baseUrl: "https://tokenharbor.ai/v1",
|
|
364
|
+
keyless: false,
|
|
365
|
+
// One "Universal Key" reaches every model; free models carry a ":free" id suffix.
|
|
366
|
+
keyHint: "tokenharbor.ai/dashboard/api-keys (Universal Key, format thk_live_...; docs at tokenharbor.ai/docs)",
|
|
367
|
+
},
|
|
356
368
|
custom: {
|
|
357
369
|
displayName: "Custom Endpoint",
|
|
358
370
|
baseUrl: "",
|
|
@@ -602,6 +614,9 @@ function buildProviderModels(models: CachedModel[]) {
|
|
|
602
614
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
603
615
|
contextWindow: m.contextWindow ?? 128_000,
|
|
604
616
|
maxTokens: m.maxTokens ?? 4_096,
|
|
617
|
+
...(m.thinkingLevelMap ? { thinkingLevelMap: m.thinkingLevelMap } : {}),
|
|
618
|
+
...(m.samplingParams ? { samplingParams: m.samplingParams } : {}),
|
|
619
|
+
...(m.compat ? { compat: m.compat } : {}),
|
|
605
620
|
};
|
|
606
621
|
});
|
|
607
622
|
}
|
|
@@ -623,6 +638,9 @@ function mergeModelMetadata(previous: CachedModel[], fetched: CachedModel[]): Ca
|
|
|
623
638
|
maxTokens: m.maxTokens ?? old.maxTokens,
|
|
624
639
|
reasoning: m.reasoning ?? old.reasoning,
|
|
625
640
|
input: m.input ?? old.input,
|
|
641
|
+
thinkingLevelMap: m.thinkingLevelMap ?? old.thinkingLevelMap,
|
|
642
|
+
samplingParams: m.samplingParams ?? old.samplingParams,
|
|
643
|
+
compat: m.compat ?? old.compat,
|
|
626
644
|
};
|
|
627
645
|
});
|
|
628
646
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@billjr99/pi-openai-compat",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.27",
|
|
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",
|