pi-provider-litellm 4.6.0 → 4.7.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 +12 -7
- package/package.json +3 -3
- package/src/index.ts +4 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
LiteLLM proxy native Provider extension for [Pi](https://pi.dev). Pi 0.99.2+ is required; on older Pi, install `npm:pi-provider-litellm@3.4.0`.
|
|
4
4
|
|
|
5
|
-
Discovers models from self-hosted LiteLLM proxies and registers them under Pi providers. The default provider is `litellm`; optional aliases can register additional LiteLLM providers with separate credentials. Supports `/login litellm`, LiteLLM MCP tools, LiteLLM Skills Gateway prompt injection, and Google ADC token auth. Tries `/model/info` first (admin endpoint with rich metadata), falls back to `/v1/models` (OpenAI-compatible) on 401/403/404 or an empty list, then tries `/health` plus per-endpoint `/model/info` for older LiteLLM proxies.
|
|
5
|
+
Discovers models from self-hosted LiteLLM proxies and registers them under Pi providers. The default provider is `litellm`; optional aliases can register additional LiteLLM providers with separate credentials. Supports `/login litellm`, LiteLLM MCP tools, LiteLLM Skills Gateway prompt injection, budget status, image generation and classifier routes, and Google ADC token auth. A [Go port](#pig) brings it to PiG, without image generation and classifier routes. Tries `/model/info` first (admin endpoint with rich metadata), falls back to `/v1/models` (OpenAI-compatible) on 401/403/404 or an empty list, then tries `/health` plus per-endpoint `/model/info` for older LiteLLM proxies.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -425,10 +425,11 @@ such as OpenAI's GPT-6 Luna, is published as both a chat model and a classifier.
|
|
|
425
425
|
| `LITELLM_PROVIDERS` | unset | Canonical comma- or whitespace-separated list of provider IDs to register. |
|
|
426
426
|
| `LITELLM_PROVIDERS_JSON` | unset | JSON string of provider configuration objects matching the `litellm.providers` settings schema. |
|
|
427
427
|
| `LITELLM_PROVIDER_<NAME>_*` | unset | Per-provider environment variables for base URL, API key, headers, display name, OAuth, Google auth, and MCP enable/disable toggle (`_ENABLE_MCP` / `_MCP_ENABLED`). See [Multi-provider environment variables](#multi-provider-environment-variables). |
|
|
428
|
+
| `LITELLM_STARTUP_KEY_HELPER` | unset | If set to `1`, activation runs `LITELLM_API_KEY_HELPER` (or the configured key helper) once to seed models at startup. Without it the helper is never run at activation, so a helper-only setup has no models in `pi -p` print mode until a refresh. |
|
|
428
429
|
| `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. |
|
|
429
430
|
| `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. |
|
|
430
431
|
| `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. |
|
|
431
|
-
| `PI_OFFLINE` | unset | Pi documents it as disabling automatic network activity, including model catalog refreshes. Through Pi 1.
|
|
432
|
+
| `PI_OFFLINE` | unset | Pi documents it as disabling automatic network activity, including model catalog refreshes. Through Pi 1.4.0, 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. |
|
|
432
433
|
| `LITELLM_DISCOVERY_TIMEOUT_MS` | `5000` | Background and explicit discovery fetch timeout in ms; `0` disables automatic discovery |
|
|
433
434
|
| `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 |
|
|
434
435
|
| `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 |
|
|
@@ -436,7 +437,7 @@ such as OpenAI's GPT-6 Luna, is published as both a chat model and a classifier.
|
|
|
436
437
|
| `LITELLM_TRUST_PROXY_LIMITS` | unset | If `1`, a deployment's explicit `model_info.max_input_tokens` / `max_output_tokens` win over Pi's catalog instead of taking the smaller of the two; the catalog still fills missing values and the group minimum still applies. A `models.json` `modelOverrides` entry still wins first |
|
|
437
438
|
| `LITELLM_MODELS_DEV` | unset | If `1`, enrich discovered metadata (limits, prices, effort lists) from models.dev, cached for 28 days in `litellm-models-dev.json`. Off by default because LiteLLM's `/model/info` is authoritative; use it when LiteLLM's model map lacks a model's metadata |
|
|
438
439
|
|
|
439
|
-
Only use a trusted `LITELLM_API_KEY_HELPER` or `!command`. Prefer an absolute executable path, keep secrets out of command arguments, and print only the token to stdout without logging it to stderr.
|
|
440
|
+
Only use a trusted `LITELLM_API_KEY_HELPER` or `!command`. Prefer an absolute executable path, keep secrets out of command arguments, and print only the token to stdout without logging it to stderr. With `LITELLM_STARTUP_KEY_HELPER=1` the helper also runs at startup, so set that flag only from a launcher you trust.
|
|
440
441
|
|
|
441
442
|
With `LITELLM_VERBOSE_DISCOVERY=1`, `/model/info` discovery reports published routes whose context window uses the fallback assumption (including wildcard expansions) on one line with the selected value, a count, and a sample of escaped route names. Each route is reported once per process. Explicit or authoritative catalog limits do not trigger it, even when numerically equal to the default. Set `model_info.max_input_tokens` on every deployment in the route to provide real limits; this diagnostic does not change discovery limits or routing.
|
|
442
443
|
|
|
@@ -485,7 +486,9 @@ If your LiteLLM proxy exposes `/claude-code/marketplace.json`, enabled skills ar
|
|
|
485
486
|
## PiG
|
|
486
487
|
|
|
487
488
|
A Go port for [PiG](https://github.com/MichaelKinsy/PiG) lives in [`pig/`](pig/README.md). It reads the same
|
|
488
|
-
settings, environment variables and `auth.json` entries; see [pig/README.md](pig/README.md) to install it.
|
|
489
|
+
settings, environment variables and `auth.json` entries; see [pig/README.md](pig/README.md) to install it. A PiG native
|
|
490
|
+
provider cannot yet surface image or classifier models, so the port does not publish image generation or decision
|
|
491
|
+
routes.
|
|
489
492
|
|
|
490
493
|
## Mocked LiteLLM smoke workflow
|
|
491
494
|
|
|
@@ -512,13 +515,15 @@ npm run supply-chain:guard
|
|
|
512
515
|
npm pack --dry-run
|
|
513
516
|
```
|
|
514
517
|
|
|
518
|
+
Changes to the Go port in `pig/` are verified separately; see [pig/README.md](pig/README.md) for its `go test` and `pig package validate` steps.
|
|
519
|
+
|
|
515
520
|
The published npm package contains only `src`, `README.md`, `LICENSE`, and the `package.json` npm always includes. Pi loads the TypeScript source entrypoint for both npm and Git installs. The package does not expose a JavaScript or TypeScript library import; load it through Pi.
|
|
516
521
|
|
|
517
522
|
## Release
|
|
518
523
|
|
|
519
|
-
Releases are driven by semver tags named `v*.*.*`. The GitHub release workflow installs from the lockfile, then `npm publish` runs `prepublishOnly` to check the source, build `dist` for verification, verify the package contents, and publish to npm with provenance before the workflow creates a GitHub release.
|
|
524
|
+
Releases are driven by semver tags named `v*.*.*`. The GitHub release workflow installs from the lockfile, then `npm publish` runs `prepublishOnly` to check the source, build `dist` for verification, verify the package contents, and publish to npm with provenance before the workflow creates a GitHub release. The same tag publishes the Go port from `pig/` as `pig-provider-litellm`.
|
|
520
525
|
|
|
521
|
-
Before tagging a release, keep `package.json` and `package
|
|
526
|
+
Before tagging a release, keep the `package.json`, `package-lock.json` and `pig/package.json` versions in sync and verify the dry-run package contents.
|
|
522
527
|
|
|
523
528
|
## Model catalog
|
|
524
529
|
|
|
@@ -609,7 +614,7 @@ The development probe runs against minimized snapshots with `npm run probe:proxy
|
|
|
609
614
|
| "no credentials" warning at startup | Env vars not set and no OAuth credential — run `/login litellm` |
|
|
610
615
|
| No models, or no new routes, while `PI_OFFLINE` is set | Pi skips every model network refresh, including the one `/model` starts. Run `/litellm-refresh`, or unset `PI_OFFLINE` (`PI_OFFLINE=0` is not enough) |
|
|
611
616
|
| `No models available` at startup, gone after a restart | A Pi startup race, not discovery — see [`No models available` at startup](#no-models-available-at-startup) |
|
|
612
|
-
|
|
|
617
|
+
| `/litellm-refresh` reports `refreshed 0 models` | Proxy returned an empty list — check pi's startup log and verify `/model/info`, `/v1/models`, or `/health` responds |
|
|
613
618
|
| `/model/info` returning 401/403/404 or an empty list | Expected behavior with virtual keys — extension falls back to `/v1/models` |
|
|
614
619
|
| Discovery times out | Increase `LITELLM_DISCOVERY_TIMEOUT_MS` or set `LITELLM_OFFLINE=1` to fall back on cached models. Offline mode does not recover a root mismatch, including a different path prefix — see [Model host enforcement](#model-host-enforcement) |
|
|
615
620
|
| A provider shows no models | The base URL is missing, invalid, still the placeholder, or its full root, including any path prefix, differs from the root in the cached catalog. Check stderr and see [Model host enforcement](#model-host-enforcement) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-provider-litellm",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "LiteLLM proxy provider extension for Pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"basic-ftp": "6.0.1",
|
|
64
64
|
"nanoid": "3.3.18",
|
|
65
65
|
"protobufjs": "8.7.1",
|
|
66
|
-
"undici": "8.
|
|
66
|
+
"undici": "8.12.3"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@biomejs/biome": "^2.4.15",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
75
75
|
"es-module-lexer": "^3.0.2",
|
|
76
76
|
"tsx": "^4.21.0",
|
|
77
|
-
"typebox": "1.4.
|
|
77
|
+
"typebox": "1.4.3",
|
|
78
78
|
"vitest": "^5.0.0"
|
|
79
79
|
}
|
|
80
80
|
}
|
package/src/index.ts
CHANGED
|
@@ -67,6 +67,7 @@ const ENV_CLI_JWT_EXPIRATION_HOURS = "LITELLM_CLI_JWT_EXPIRATION_HOURS";
|
|
|
67
67
|
const ENV_OFFLINE = "LITELLM_OFFLINE";
|
|
68
68
|
const ENV_VERBOSE_DISCOVERY = "LITELLM_VERBOSE_DISCOVERY";
|
|
69
69
|
const ENV_MODELS_DEV = "LITELLM_MODELS_DEV";
|
|
70
|
+
const ENV_STARTUP_KEY_HELPER = "LITELLM_STARTUP_KEY_HELPER";
|
|
70
71
|
const MODELS_DEV_CACHE_FILENAME = "litellm-models-dev.json";
|
|
71
72
|
const DEFAULT_TIMEOUT_MS = 5000;
|
|
72
73
|
const SEED_TIMEOUT_MS = 3000;
|
|
@@ -2727,9 +2728,9 @@ export default async function (pi: ExtensionAPI): Promise<void> {
|
|
|
2727
2728
|
const agentDir = getAgentDir();
|
|
2728
2729
|
try {
|
|
2729
2730
|
const stored = readStoredCredential(definition.name, join(agentDir, "auth.json"));
|
|
2730
|
-
//
|
|
2731
|
-
//
|
|
2732
|
-
const auth = await authForCredential(definition, stored,
|
|
2731
|
+
// Activation must not run the user's key helper as a side effect, so helper-backed setups keep waiting
|
|
2732
|
+
// for Pi's own refresh; LITELLM_STARTUP_KEY_HELPER=1 is the launcher's opt-in to run it here.
|
|
2733
|
+
const auth = await authForCredential(definition, stored, process.env[ENV_STARTUP_KEY_HELPER] === "1");
|
|
2733
2734
|
const storedModels = await readStoredModels({
|
|
2734
2735
|
agentDir,
|
|
2735
2736
|
provider: definition.name,
|