@billjr99/pi-openai-compat 1.1.25 → 1.1.26
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 +3 -0
- package/index.ts +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -213,6 +213,9 @@ provider's `/models` catalog does not report them:
|
|
|
213
213
|
| `maxTokens` | number | `4096` | Maximum output tokens per response. |
|
|
214
214
|
| `reasoning` | boolean | `false` | Enables pi's thinking mode for the model. |
|
|
215
215
|
| `input` | `["text"]` or `["text","image"]` | `["text"]` | Modalities pi may send; `image` lets pi attach image blocks. Any other value is ignored. |
|
|
216
|
+
| `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). |
|
|
217
|
+
| `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. |
|
|
218
|
+
| `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
219
|
|
|
217
220
|
Most catalogs report none of these beyond the ID, so aggregators and proxies
|
|
218
221
|
(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 {
|
|
@@ -602,6 +607,9 @@ function buildProviderModels(models: CachedModel[]) {
|
|
|
602
607
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
603
608
|
contextWindow: m.contextWindow ?? 128_000,
|
|
604
609
|
maxTokens: m.maxTokens ?? 4_096,
|
|
610
|
+
...(m.thinkingLevelMap ? { thinkingLevelMap: m.thinkingLevelMap } : {}),
|
|
611
|
+
...(m.samplingParams ? { samplingParams: m.samplingParams } : {}),
|
|
612
|
+
...(m.compat ? { compat: m.compat } : {}),
|
|
605
613
|
};
|
|
606
614
|
});
|
|
607
615
|
}
|
|
@@ -623,6 +631,9 @@ function mergeModelMetadata(previous: CachedModel[], fetched: CachedModel[]): Ca
|
|
|
623
631
|
maxTokens: m.maxTokens ?? old.maxTokens,
|
|
624
632
|
reasoning: m.reasoning ?? old.reasoning,
|
|
625
633
|
input: m.input ?? old.input,
|
|
634
|
+
thinkingLevelMap: m.thinkingLevelMap ?? old.thinkingLevelMap,
|
|
635
|
+
samplingParams: m.samplingParams ?? old.samplingParams,
|
|
636
|
+
compat: m.compat ?? old.compat,
|
|
626
637
|
};
|
|
627
638
|
});
|
|
628
639
|
}
|
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.26",
|
|
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",
|