pi-provider-litellm 4.8.0 → 4.9.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 CHANGED
@@ -320,10 +320,12 @@ LiteLLM Skills, MCP integration, and the budget footer are enabled by default. D
320
320
 
321
321
  Setting `skills.enabled` to `false` disables the Skills Gateway management tools, skill fetching, and system-prompt injection. Setting `mcp.enabled` to `false` stops the extension from registering the proxy's MCP server. Setting `budget.enabled` to `false` registers no budget footer, polls, or `/litellm-budget` command; `budget.display` is described under [Budget status](#budget-status). Restart Pi after changing these settings.
322
322
 
323
- MCP can also be enabled or disabled per provider, though a provider setting cannot turn it on while `mcp.enabled` is `false`:
323
+ MCP can also be enabled or disabled per provider, though a provider setting cannot turn it on while MCP is off as a whole (`mcp.enabled` is `false`, or `LITELLM_ENABLE_MCP` switches it off):
324
324
  - In `~/.pi/agent/settings.json`: set `providers.<name>.mcp.enabled` (or `providers.<name>.enableMcp`) to `false` (or `true`).
325
325
  - In environment variables: set `LITELLM_PROVIDER_<NAME>_ENABLE_MCP` or `LITELLM_PROVIDER_<NAME>_MCP_ENABLED` to `"0"` or `"false"` to disable MCP for a specific provider.
326
326
 
327
+ The three features also read global environment variables that override the `settings.json` block: `LITELLM_ENABLE_SKILLS`, `LITELLM_ENABLE_MCP`, and `LITELLM_ENABLE_BUDGET`. A set value replaces the block's `enabled`, read like every other boolean here: `1` or `true` (in any case) turns the feature on, and anything else, including `0` and `false`, turns it off. An unset, empty or blank value defers to the block. A provider with MCP disabled stays without it under `LITELLM_ENABLE_MCP=1`. They let one settings file serve hosts whose features differ, and a container or CI job can run with model sync only: `LITELLM_ENABLE_MCP=0 LITELLM_ENABLE_SKILLS=0 LITELLM_ENABLE_BUDGET=0 pi`.
328
+
327
329
  Restart Pi after changing these settings.
328
330
 
329
331
  `mcp.exposure` and `mcp.toolExposure` are passed to Pi unchanged and mean what they mean in a Pi `mcp.json` server entry: `codemode` (Pi's default when `exposure` is unset; callable from Pi's `codemode` scripts), `deferred` (declared to the model once Pi's `tool_search` loads it), `direct` (declared on every request), or `hidden`. `toolExposure` keys are tool names as LiteLLM's `/mcp` endpoint offers them, which LiteLLM prefixes with the server name, for example `github-search_code`; `*` matches any characters. Pi validates both settings, and an unusable value is reported once.
@@ -455,6 +457,9 @@ such as OpenAI's GPT-6 Luna, is published as both a chat model and a classifier.
455
457
  |---|---|---|
456
458
  | `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. |
457
459
  | `LITELLM_DISPLAY_NAME` | `LiteLLM` | Custom display name for the default `litellm` provider in the Pi UI. |
460
+ | `LITELLM_ENABLE_BUDGET` | unset (feature on) | When set, overrides `litellm.budget.enabled` from `settings.json`: `1` or `true` keeps the budget footer, polls and `/litellm-budget`, anything else, including `0` and `false`, removes them; unset, empty or blank defers to the block. See [Optional LiteLLM features](#optional-litellm-features). |
461
+ | `LITELLM_ENABLE_MCP` | unset (feature on) | When set, overrides `litellm.mcp.enabled` from `settings.json`: `1` or `true` registers the proxy's MCP server, anything else, including `0` and `false`, registers none; unset, empty or blank defers to the block. See [Optional LiteLLM features](#optional-litellm-features). |
462
+ | `LITELLM_ENABLE_SKILLS` | unset (feature on) | When set, overrides `litellm.skills.enabled` from `settings.json`: `1` or `true` keeps the Skills tools and prompt injection, anything else, including `0` and `false`, removes them; unset, empty or blank defers to the block. See [Optional LiteLLM features](#optional-litellm-features). |
458
463
  | `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"`. |
459
464
  | `LITELLM_PROVIDERS` | unset | Canonical comma- or whitespace-separated list of provider IDs to register. |
460
465
  | `LITELLM_PROVIDERS_JSON` | unset | JSON string of provider configuration objects matching the `litellm.providers` settings schema. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-provider-litellm",
3
- "version": "4.8.0",
3
+ "version": "4.9.0",
4
4
  "description": "LiteLLM proxy provider extension for Pi",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -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.6",
77
+ "typebox": "1.4.7",
78
78
  "vitest": "^5.0.0"
79
79
  }
80
80
  }
package/src/index.ts CHANGED
@@ -781,10 +781,21 @@ function normalizeProviderSettings(raw: unknown): RawProviderSettings | undefine
781
781
  };
782
782
  }
783
783
 
784
- function isFeatureEnabled(
784
+ // A feature's LITELLM_ENABLE_* variable overrides its settings block, read like every other boolean
785
+ // here: 1 or true switch the feature on and any other value off, so a misspelt kill switch still
786
+ // kills. An unset or blank value defers to the block.
787
+ const ENV_FEATURES: Record<"skills" | "mcp" | "budget", string> = {
788
+ skills: "LITELLM_ENABLE_SKILLS",
789
+ mcp: "LITELLM_ENABLE_MCP",
790
+ budget: "LITELLM_ENABLE_BUDGET",
791
+ };
792
+
793
+ export function isFeatureEnabled(
785
794
  settings: Record<string, unknown> | undefined,
786
795
  feature: "skills" | "mcp" | "budget",
787
796
  ): boolean {
797
+ const envValue = process.env[ENV_FEATURES[feature]];
798
+ if (envValue?.trim()) return parseBooleanSetting(envValue);
788
799
  const raw = settings?.[feature];
789
800
  return !isPlainObject(raw) || raw.enabled !== false;
790
801
  }