pi-provider-litellm 2.0.0 → 2.0.2
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/dist/discover.js +25 -2
- package/dist/index.js +9 -3
- package/dist/provider.js +1 -2
- package/package.json +3 -3
package/dist/discover.js
CHANGED
|
@@ -439,8 +439,31 @@ export async function discoverModels(baseUrl, apiKey, options = {}) {
|
|
|
439
439
|
model_info: { ...previous?.model_info, ...entry.model_info },
|
|
440
440
|
});
|
|
441
441
|
}
|
|
442
|
-
|
|
443
|
-
|
|
442
|
+
let models = [...entries.values()].map(mapFromModelInfo).filter((m) => m !== undefined);
|
|
443
|
+
// LiteLLM's /model/info does NOT expand wildcard model_name entries (e.g.
|
|
444
|
+
// "lemonade/*" backed by model: openai/* + check_provider_endpoint: true)
|
|
445
|
+
// — it returns the literal wildcard only. The discovered ids live in
|
|
446
|
+
// /v1/models instead. When /model/info contains any wildcard id, also query
|
|
447
|
+
// /v1/models and merge the expanded (non-wildcard) entries in, dropping the
|
|
448
|
+
// raw wildcard row so it doesn't surface as a phantom model choice.
|
|
449
|
+
// Ref: docs.litellm.ai/docs/proxy/model_discovery
|
|
450
|
+
if (models.some((m) => m.id.includes("*"))) {
|
|
451
|
+
progress?.("/model/info has wildcard entries, expanding via /v1/models...");
|
|
452
|
+
let modelsDev;
|
|
453
|
+
if (options.modelsDev !== false) {
|
|
454
|
+
progress?.("Loading models.dev catalog for metadata enrichment...");
|
|
455
|
+
modelsDev = await getModelsDevCatalog(options);
|
|
456
|
+
}
|
|
457
|
+
const listResult = await fetchJson(`${base}/v1/models`, apiKey, options);
|
|
458
|
+
if (listResult.ok) {
|
|
459
|
+
const expanded = (listResult.data.data ?? [])
|
|
460
|
+
.map((entry) => mapFromModelsList(entry, modelsDev))
|
|
461
|
+
.filter((m) => m !== undefined && !m.id.includes("*"));
|
|
462
|
+
const seen = new Set(models.map((m) => m.id));
|
|
463
|
+
models = [...models.filter((m) => !m.id.includes("*")), ...expanded.filter((m) => !seen.has(m.id))];
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return { source: "model_info", models: deduplicateModels(models) };
|
|
444
467
|
}
|
|
445
468
|
if (![401, 403, 404].includes(infoResult.status)) {
|
|
446
469
|
throw new Error(`/model/info returned ${infoResult.status}`);
|
package/dist/index.js
CHANGED
|
@@ -596,8 +596,10 @@ function prepareLiteLLMRequestPayload(payload, modelId, api, sessionId) {
|
|
|
596
596
|
next[key] = value;
|
|
597
597
|
};
|
|
598
598
|
if (api !== "openai-responses" && modelId && shouldSuppressReasoningContent(modelId)) {
|
|
599
|
-
for (const [key, value] of Object.entries(REASONING_SUPPRESSION_DEFAULTS))
|
|
600
|
-
|
|
599
|
+
for (const [key, value] of Object.entries(REASONING_SUPPRESSION_DEFAULTS)) {
|
|
600
|
+
if (key !== "thinking")
|
|
601
|
+
update(key, value);
|
|
602
|
+
}
|
|
601
603
|
}
|
|
602
604
|
// LiteLLM still routes gpt-5.5 tool+reasoning requests through chat completions.
|
|
603
605
|
// Drop reasoning until the gateway honors /v1/responses for this route.
|
|
@@ -862,7 +864,11 @@ export default async function (pi) {
|
|
|
862
864
|
context.credential) {
|
|
863
865
|
const auth = await authForCredential(definition, context.credential);
|
|
864
866
|
defaultRuntimeAuth = auth;
|
|
865
|
-
|
|
867
|
+
const registration = registerMcpTools(auth, context.signal);
|
|
868
|
+
if (context.signal)
|
|
869
|
+
await registration;
|
|
870
|
+
else
|
|
871
|
+
void registration.catch(() => undefined);
|
|
866
872
|
}
|
|
867
873
|
}
|
|
868
874
|
};
|
package/dist/provider.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createProvider } from "@earendil-works/pi-ai";
|
|
2
|
-
import { openAICompletionsApi } from "@earendil-works/pi-ai/
|
|
3
|
-
import { openAIResponsesApi } from "@earendil-works/pi-ai/api/openai-responses.lazy";
|
|
2
|
+
import { openAICompletionsApi, openAIResponsesApi } from "@earendil-works/pi-ai/compat";
|
|
4
3
|
export function toNativeModels(provider, baseUrl, models) {
|
|
5
4
|
return models.map((model) => ({
|
|
6
5
|
...model,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-provider-litellm",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "LiteLLM proxy provider extension for Pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@biomejs/biome": "^2.4.15",
|
|
68
|
-
"@earendil-works/pi-ai": "^0.
|
|
69
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
68
|
+
"@earendil-works/pi-ai": "^0.82.1",
|
|
69
|
+
"@earendil-works/pi-coding-agent": "^0.82.1",
|
|
70
70
|
"@kitlangton/terminal-control": "0.6.0",
|
|
71
71
|
"@types/node": "^26.0.0",
|
|
72
72
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|