pi-nvidia-nim 1.1.2 → 1.1.4
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/index.ts +5 -2
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -531,6 +531,7 @@ interface NimModelEntry {
|
|
|
531
531
|
maxTokens: number;
|
|
532
532
|
cost: { input: number; output: number; cacheRead: number; cacheWrite: number };
|
|
533
533
|
compat?: Record<string, unknown>;
|
|
534
|
+
headers?: Record<string, string>;
|
|
534
535
|
}
|
|
535
536
|
|
|
536
537
|
function makeDisplayName(modelId: string): string {
|
|
@@ -550,6 +551,9 @@ function buildModelEntry(modelId: string): NimModelEntry | null {
|
|
|
550
551
|
const contextWindow = CONTEXT_WINDOWS[modelId] ?? 4096;
|
|
551
552
|
const maxTokens = MAX_TOKENS[modelId] ?? Math.min(2048, contextWindow);
|
|
552
553
|
|
|
554
|
+
// Get API key for Authorization header
|
|
555
|
+
const apiKey = process.env[NVIDIA_NIM_API_KEY_ENV];
|
|
556
|
+
|
|
553
557
|
const entry: NimModelEntry = {
|
|
554
558
|
id: modelId,
|
|
555
559
|
name: makeDisplayName(modelId),
|
|
@@ -558,6 +562,7 @@ function buildModelEntry(modelId: string): NimModelEntry | null {
|
|
|
558
562
|
contextWindow,
|
|
559
563
|
maxTokens,
|
|
560
564
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
565
|
+
headers: apiKey ? { Authorization: `Bearer ${apiKey}` } : undefined,
|
|
561
566
|
};
|
|
562
567
|
|
|
563
568
|
// Default compat for all NIM models:
|
|
@@ -631,7 +636,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
631
636
|
baseUrl: NVIDIA_NIM_BASE_URL,
|
|
632
637
|
apiKey: NVIDIA_NIM_API_KEY_ENV,
|
|
633
638
|
api: "openai-completions",
|
|
634
|
-
authHeader: true,
|
|
635
639
|
models: curatedModels,
|
|
636
640
|
streamSimple: nimStreamSimple,
|
|
637
641
|
});
|
|
@@ -671,7 +675,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
671
675
|
baseUrl: NVIDIA_NIM_BASE_URL,
|
|
672
676
|
apiKey: NVIDIA_NIM_API_KEY_ENV,
|
|
673
677
|
api: "openai-completions",
|
|
674
|
-
authHeader: true,
|
|
675
678
|
models: allModels,
|
|
676
679
|
streamSimple: nimStreamSimple,
|
|
677
680
|
});
|