pi-provider-litellm 4.0.1 → 4.1.0
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 -2
- package/package.json +3 -3
- package/src/backend-identity.ts +1 -1
- package/src/discover.ts +9 -4
- package/src/index.ts +3 -1
- package/src/public-catalog.ts +4 -2
package/README.md
CHANGED
|
@@ -156,7 +156,7 @@ Provider fields:
|
|
|
156
156
|
| `baseUrl` | `LITELLM_BASE_URL` for `litellm`; required for aliases | LiteLLM proxy URL, with or without `/v1`. Must be a full `http`/`https` URL; a provider with no resolvable base URL exposes no models (see [Model host enforcement](#model-host-enforcement)) |
|
|
157
157
|
| `apiKey` | `LITELLM_API_KEY_HELPER`/`LITELLM_API_KEY` for `litellm`; required for aliases | Pi config value for this provider's key. Use `$ENV_VAR`, `${ENV_VAR}`, `!command`, or a literal key. Escape a literal `$` as `$$`. |
|
|
158
158
|
| `headers` | `$LITELLM_HEADERS` for `litellm`; unset for aliases | JSON string env reference or inline object of request headers |
|
|
159
|
-
| `displayName` |
|
|
159
|
+
| `displayName` | `LITELLM_DISPLAY_NAME` / `"LiteLLM"` for `litellm`; alias name for aliases | Label shown in Pi UI |
|
|
160
160
|
| `enabled` | `true` | Set `false` to skip an alias |
|
|
161
161
|
| `oidc` | unset | `litellm` only. Sign in directly with an OpenID Connect identity provider instead of the LiteLLM-hosted flows; see [Direct OIDC login](#direct-oidc-login) |
|
|
162
162
|
| `allowInsecureHttp` | `false` | Set `true` to permit plaintext HTTP for this provider, for example `http://host.docker.internal`. Credentials and request data will not be encrypted. Loopback HTTP works without this setting. |
|
|
@@ -214,11 +214,12 @@ Native Messages authenticates with `x-api-key`; every transport carries the `x-l
|
|
|
214
214
|
| Variable | Default | Effect |
|
|
215
215
|
|---|---|---|
|
|
216
216
|
| `LITELLM_API_KEY_HELPER` | unset | Command that prints a fresh LiteLLM bearer token. Takes precedence over `LITELLM_API_KEY`. The extension runs it while resolving request auth, and Pi's per-request auth path is uncached, so rotating/short-lived tokens stay fresh. |
|
|
217
|
+
| `LITELLM_DISPLAY_NAME` | `LiteLLM` | Custom display name for the default `litellm` provider in the Pi UI. |
|
|
217
218
|
| `LITELLM_HEADERS` | unset | JSON object of extra headers sent to LiteLLM provider, discovery, MCP, and Skills Gateway requests. Provider aliases can use it with `"headers": "$LITELLM_HEADERS"`. |
|
|
218
219
|
| `LITELLM_GCLOUD_TOKEN_AUTH` | unset | If set to a non-empty value other than `0`, use Google Application Default Credentials as the LiteLLM bearer token source. This takes precedence over `LITELLM_API_KEY_HELPER` and `LITELLM_API_KEY` when no stored `/login litellm` credential exists. |
|
|
219
220
|
| `GOOGLE_APPLICATION_CREDENTIALS` | Google default ADC path | Optional path to an ADC JSON file used by `LITELLM_GCLOUD_TOKEN_AUTH`. If unset, the extension checks the default gcloud ADC locations. |
|
|
220
221
|
| `LITELLM_OFFLINE` | unset | If `1`, disable all model and MCP discovery, including post-login discovery; use cached models only when their stored canonical proxy root exactly matches the active credential root, including any path prefix. URL-standard host casing and default ports are canonicalized, but paths remain case-sensitive. |
|
|
221
|
-
| `PI_OFFLINE` | unset | Pi documents it as disabling automatic network activity, including model catalog refreshes. Through Pi 1.0.
|
|
222
|
+
| `PI_OFFLINE` | unset | Pi documents it as disabling automatic network activity, including model catalog refreshes. Through Pi 1.0.3, any set value (including `0` or an empty string) disables startup model discovery and `/model` network refreshes. Run `/litellm-refresh`, or unset it, to discover; cached models can still be used offline. |
|
|
222
223
|
| `LITELLM_DISCOVERY_TIMEOUT_MS` | `5000` | Background and explicit discovery fetch timeout in ms; `0` disables automatic discovery |
|
|
223
224
|
| `LITELLM_CLI_JWT_EXPIRATION_HOURS` | `24` | CLI SSO token lifetime fallback for older proxies whose poll response omits `expires_in`; mirror a non-default proxy setting locally |
|
|
224
225
|
| `LITELLM_VERBOSE_DISCOVERY` | unset | If `1`, enable progress messages during model discovery (login, refresh, startup), including startup skip reasons and defaulted `/model/info` context windows. Progress messages are off by default |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-provider-litellm",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "LiteLLM proxy provider extension for Pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@biomejs/biome": "^2.4.15",
|
|
70
|
-
"@earendil-works/pi-ai": "^1.0.
|
|
71
|
-
"@earendil-works/pi-coding-agent": "^1.0.
|
|
70
|
+
"@earendil-works/pi-ai": "^1.0.3",
|
|
71
|
+
"@earendil-works/pi-coding-agent": "^1.0.3",
|
|
72
72
|
"@kitlangton/terminal-control": "1.2.1",
|
|
73
73
|
"@types/node": "^26.0.0",
|
|
74
74
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
package/src/backend-identity.ts
CHANGED
package/src/discover.ts
CHANGED
|
@@ -26,7 +26,12 @@ import {
|
|
|
26
26
|
wireString,
|
|
27
27
|
} from "./model-groups.js";
|
|
28
28
|
import { type ProxyVersion, type ProxyVersionFloor, probeProxyVersion, proxyVersionAtLeast } from "./proxy-version.js";
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
loadPublicCatalog,
|
|
31
|
+
PI_AZURE_PROVIDER,
|
|
32
|
+
type PublicCatalog,
|
|
33
|
+
type PublicCatalogRecord,
|
|
34
|
+
} from "./public-catalog.js";
|
|
30
35
|
import { intersectThinkingLevelMaps } from "./thinking-levels.js";
|
|
31
36
|
import type {
|
|
32
37
|
DiscoveredModel,
|
|
@@ -443,11 +448,11 @@ function nativeMessagesCatalog(
|
|
|
443
448
|
: {};
|
|
444
449
|
}
|
|
445
450
|
|
|
446
|
-
const ADAPTER_CATALOG_PROVIDERS: Readonly<Record<string, BuiltinProvider>> = {
|
|
451
|
+
const ADAPTER_CATALOG_PROVIDERS: Readonly<Record<string, BuiltinProvider | undefined>> = {
|
|
447
452
|
anthropic: "anthropic",
|
|
448
453
|
claude: "anthropic",
|
|
449
|
-
azure:
|
|
450
|
-
azure_ai:
|
|
454
|
+
azure: toKnownProvider(PI_AZURE_PROVIDER),
|
|
455
|
+
azure_ai: toKnownProvider(PI_AZURE_PROVIDER),
|
|
451
456
|
bedrock: "amazon-bedrock",
|
|
452
457
|
bedrock_converse: "amazon-bedrock",
|
|
453
458
|
chatgpt: "openai-codex",
|
package/src/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ const PROVIDER_NAME = "litellm";
|
|
|
37
37
|
const SETTINGS_KEY = "litellm";
|
|
38
38
|
const ENV_BASE_URL = "LITELLM_BASE_URL";
|
|
39
39
|
const ENV_API_KEY = "LITELLM_API_KEY";
|
|
40
|
+
const ENV_DISPLAY_NAME = "LITELLM_DISPLAY_NAME";
|
|
40
41
|
const GCLOUD_ADC_SOURCE = "gcloud ADC";
|
|
41
42
|
const ENV_API_KEY_HELPER = "LITELLM_API_KEY_HELPER";
|
|
42
43
|
const ENV_HEADERS = "LITELLM_HEADERS";
|
|
@@ -496,6 +497,7 @@ function getProviderDefinitions(settings: Record<string, unknown> | undefined):
|
|
|
496
497
|
const rawProviders = settings?.providers && typeof settings.providers === "object" ? settings.providers : undefined;
|
|
497
498
|
const providerSettings = rawProviders as Record<string, unknown> | undefined;
|
|
498
499
|
const defaultSettings = normalizeProviderSettings(providerSettings?.[PROVIDER_NAME]);
|
|
500
|
+
const defaultDisplayName = cleanConfig(process.env[ENV_DISPLAY_NAME]) ?? "LiteLLM";
|
|
499
501
|
|
|
500
502
|
const makeDefinition = (
|
|
501
503
|
name: string,
|
|
@@ -503,7 +505,7 @@ function getProviderDefinitions(settings: Record<string, unknown> | undefined):
|
|
|
503
505
|
isDefault: boolean,
|
|
504
506
|
): ProviderDefinition => ({
|
|
505
507
|
name,
|
|
506
|
-
displayName: stringSetting(raw?.displayName) ?? (isDefault ?
|
|
508
|
+
displayName: stringSetting(raw?.displayName) ?? (isDefault ? defaultDisplayName : name),
|
|
507
509
|
baseUrl: stringSetting(raw?.baseUrl),
|
|
508
510
|
apiKeyConfig: stringSetting(raw?.apiKey),
|
|
509
511
|
headers: raw?.headers ?? (isDefault ? `$${ENV_HEADERS}` : undefined),
|
package/src/public-catalog.ts
CHANGED
|
@@ -8,6 +8,8 @@ export const MODELS_DEV_URL = "https://models.dev/api.json";
|
|
|
8
8
|
const MODELS_DEV_CACHE_TTL_MS = 28 * 24 * 60 * 60 * 1000;
|
|
9
9
|
const DEFAULT_TIMEOUT_MS = 5000;
|
|
10
10
|
const KNOWN_PROVIDERS = new Set<string>(getProviders());
|
|
11
|
+
// Pi 1.0.3 renamed its Azure catalog from `azure-openai-responses` to `azure`.
|
|
12
|
+
export const PI_AZURE_PROVIDER = KNOWN_PROVIDERS.has("azure") ? "azure" : "azure-openai-responses";
|
|
11
13
|
|
|
12
14
|
export interface PublicCatalogRecord {
|
|
13
15
|
source: "models.dev" | "pi-vendor" | "pi-adapter";
|
|
@@ -72,8 +74,8 @@ const PROVIDER_ALIASES: Readonly<Record<string, readonly string[]>> = {
|
|
|
72
74
|
|
|
73
75
|
const PI_PROVIDER_ALIASES: Readonly<Record<string, readonly string[]>> = {
|
|
74
76
|
"amazon-bedrock": ["amazon-bedrock"],
|
|
75
|
-
azure: [
|
|
76
|
-
azure_ai: [
|
|
77
|
+
azure: [PI_AZURE_PROVIDER],
|
|
78
|
+
azure_ai: [PI_AZURE_PROVIDER],
|
|
77
79
|
chatgpt: ["openai-codex"],
|
|
78
80
|
"fireworks-ai": ["fireworks"],
|
|
79
81
|
openai: ["openai"],
|