pi-nvidia-nim 1.1.16 → 1.1.18

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.
Files changed (2) hide show
  1. package/index.ts +26 -1
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -249,6 +249,7 @@ const CONTEXT_WINDOWS: Record<string, number> = {
249
249
  // MiniMax
250
250
  "minimaxai/minimax-m2": 1048576,
251
251
  "minimaxai/minimax-m2.1": 1048576,
252
+ "minimaxai/minimax-m2.7": 204800,
252
253
  // Meta Llama
253
254
  "meta/llama-3.1-405b-instruct": 131072,
254
255
  "meta/llama-3.1-70b-instruct": 131072,
@@ -373,6 +374,7 @@ const MAX_TOKENS: Record<string, number> = {
373
374
  "moonshotai/kimi-k2-thinking": 16384,
374
375
  "minimaxai/minimax-m2": 8192,
375
376
  "minimaxai/minimax-m2.1": 8192,
377
+ "minimaxai/minimax-m2.7": 8192,
376
378
  "meta/llama-4-maverick-17b-128e-instruct": 16384,
377
379
  "meta/llama-4-scout-17b-16e-instruct": 16384,
378
380
  "z-ai/glm4.7": 16384,
@@ -400,6 +402,7 @@ const FEATURED_MODELS = [
400
402
  "moonshotai/kimi-k2-instruct-0905",
401
403
  "minimaxai/minimax-m2.1",
402
404
  "minimaxai/minimax-m2",
405
+ "minimaxai/minimax-m2.7",
403
406
  "z-ai/glm5",
404
407
  "z-ai/glm4.7",
405
408
  "openai/gpt-oss-120b",
@@ -633,6 +636,28 @@ async function fetchNimModels(apiKey: string): Promise<string[]> {
633
636
  // =============================================================================
634
637
 
635
638
  export default function (pi: ExtensionAPI) {
639
+ // Bail out cleanly if the user hasn't set up an API key yet. Without this
640
+ // guard, pi's flow can still route requests through this provider's
641
+ // streamSimple (e.g. when probing available providers, or when the
642
+ // configured default provider can't be resolved for any reason), which
643
+ // causes a fatal "NVIDIA_NIM_API_KEY environment variable is not set"
644
+ // error to be emitted on every `pi` invocation — even when the user
645
+ // never intended to use NVIDIA NIM. Skipping registration leaves the
646
+ // extension dormant: no NIM models appear in the picker, no provider is
647
+ // available to route to, and other providers (OpenAI, Anthropic, custom
648
+ // OpenAI-compatible endpoints in models.json, etc.) work normally.
649
+ //
650
+ // Re-enable by exporting the key:
651
+ // export NVIDIA_NIM_API_KEY=nvapi-...
652
+ if (!process.env[NVIDIA_NIM_API_KEY_ENV]) {
653
+ // One-line, stderr, only on first load. Not fatal.
654
+ console.error(
655
+ `pi-nvidia-nim: ${NVIDIA_NIM_API_KEY_ENV} not set — extension dormant. ` +
656
+ `Set the key (https://build.nvidia.com) and reload pi to enable NVIDIA NIM models.`
657
+ );
658
+ return;
659
+ }
660
+
636
661
  // Build the curated model list
637
662
  const modelMap = new Map<string, NimModelEntry>();
638
663
 
@@ -657,7 +682,7 @@ export default function (pi: ExtensionAPI) {
657
682
  // On session start, discover additional models from the API
658
683
  pi.on("session_start", async (_event: any, ctx: any) => {
659
684
  const apiKey = process.env[NVIDIA_NIM_API_KEY_ENV];
660
- if (!apiKey) return; // API key not available, skip model discovery
685
+ if (!apiKey) return; // belt-and-suspenders: skip if env was unset after load
661
686
 
662
687
  // Fetch live model list
663
688
  const liveModelIds = await fetchNimModels(apiKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-nvidia-nim",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "NVIDIA NIM API provider extension for pi coding agent — access 100+ models from build.nvidia.com",
5
5
  "type": "module",
6
6
  "files": [