Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

Add NVIDIA NIM Provider

Mauro Druwel1a90cafcc26a
diff --git a/web-app/public/images/model-provider/nvidia.svg b/web-app/public/images/model-provider/nvidia.svg
new file mode 100644
index 000000000..91a2855f0
--- /dev/null
+++ b/web-app/public/images/model-provider/nvidia.svg
@@ -0,0 +1,8 @@
+<svg version="1.2" baseProfile="tiny-ps" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1559 1032" width="1559" height="1032">
+ <title>NVIDIA_logo-svg</title>
+ <style>
+ tspan { white-space:pre }
+ .shp0 { fill: #76b900 }
+ </style>
+ <path id="Layer" fill-rule="evenodd" class="shp0" d="M1557.9 -0.5L1557.9 1029.78L581.99 1029.78L581.99 908.81C602.63 911.1 623.28 912.25 645.06 912.25C870.98 912.25 1269.49 797.01 1440.36 653.67C1415.13 628.45 1292.99 570.54 1263.18 546.46C1083.13 701.26 897.36 832.55 640.48 832.55C620.98 832.55 600.91 830.83 581.42 828.54L581.42 742.54C604.93 746.55 628.44 748.85 652.52 748.85C928.32 748.85 1193.23 426.63 1193.23 426.63C1193.23 426.63 962.15 124.49 608.37 136.53L580.84 138.25L580.84 -0.5L1557.9 -0.5ZM608.37 212.78C862.95 204.75 1029.81 431.79 1029.81 431.79C1029.81 431.79 849.76 681.77 656.53 681.77C630.73 681.77 605.5 677.75 581.42 669.73L581.42 387.65C680.61 399.69 700.68 443.26 759.74 542.45L892.2 431.22C892.2 431.22 795.29 304.51 632.45 304.51C615.25 303.94 598.05 305.09 580.84 306.81L580.84 213.97C299.69 236 159.4 443.26 159.4 443.26C159.4 443.26 266.63 789.55 580.84 828.54L580.84 908.81C152.52 868.67 0 427.21 0 427.21C0 427.21 269.49 163.47 581.42 138.25L581.42 213.89C590.4 213.33 599.38 212.78 608.37 212.78ZM580.84 743.11C343.46 700.69 277.52 453.58 277.52 453.58C277.52 453.58 391.63 327.45 580.84 306.81L580.84 387.07L580.27 387.07C481.07 375.03 403.09 467.91 403.09 467.91C403.09 467.91 447.24 624.43 580.84 669.73L580.84 743.11Z" />
+</svg>
\ No newline at end of file
diff --git a/web-app/src/constants/providers.ts b/web-app/src/constants/providers.ts
index ed3407141..fcfc187eb 100644
--- a/web-app/src/constants/providers.ts
+++ b/web-app/src/constants/providers.ts
@@ -385,4 +385,38 @@ export const predefinedProviders = [
},
],
},
+ {
+ active: true,
+ api_key: '',
+ base_url: 'https://integrate.api.nvidia.com/v1',
+ explore_models_url: 'https://build.nvidia.com/models',
+ provider: 'nvidia',
+ settings: [
+ {
+ key: 'api-key',
+ title: 'API Key',
+ description:
+ "The NVIDIA NIM API uses API keys for authentication. Visit [NVIDIA NGC API Keys](https://org.ngc.nvidia.com/setup/api-keys) to create an API key for your requests.",
+ controller_type: 'input',
+ controller_props: {
+ placeholder: 'Insert API Key',
+ value: '',
+ type: 'password',
+ input_actions: ['unobscure', 'copy'],
+ },
+ },
+ {
+ key: 'base-url',
+ title: 'Base URL',
+ description:
+ 'The NVIDIA NIM OpenAI-compatible endpoint to use. See the [NVIDIA NIM API documentation](https://docs.api.nvidia.com/nim/reference/llm-apis) for more information.',
+ controller_type: 'input',
+ controller_props: {
+ placeholder: 'https://integrate.api.nvidia.com/v1',
+ value: 'https://integrate.api.nvidia.com/v1',
+ },
+ },
+ ],
+ models: [],
+ },
]
diff --git a/web-app/src/lib/__tests__/utils.test.ts b/web-app/src/lib/__tests__/utils.test.ts
index 33c51447e..57634bbf7 100644
--- a/web-app/src/lib/__tests__/utils.test.ts
+++ b/web-app/src/lib/__tests__/utils.test.ts
@@ -19,6 +19,7 @@ describe('getProviderLogo', () => {
)
expect(getProviderLogo('openai')).toBe('/images/model-provider/openai.svg')
expect(getProviderLogo('gemini')).toBe('/images/model-provider/gemini.svg')
+ expect(getProviderLogo('nvidia')).toBe('/images/model-provider/nvidia.svg')
})
it('returns undefined for unknown providers', () => {
@@ -33,6 +34,7 @@ describe('getProviderTitle', () => {
expect(getProviderTitle('openai')).toBe('OpenAI')
expect(getProviderTitle('openrouter')).toBe('OpenRouter')
expect(getProviderTitle('gemini')).toBe('Gemini')
+ expect(getProviderTitle('nvidia')).toBe('NVIDIA NIM')
})
it('capitalizes first letter for unknown providers', () => {
diff --git a/web-app/src/lib/utils.ts b/web-app/src/lib/utils.ts
index 992c8b273..b9c288976 100644
--- a/web-app/src/lib/utils.ts
+++ b/web-app/src/lib/utils.ts
@@ -89,6 +89,8 @@ export function getProviderLogo(provider: string) {
return '/images/model-provider/azure.svg'
case 'xai':
return '/images/model-provider/xai.svg'
+ case 'nvidia':
+ return '/images/model-provider/nvidia.svg'
default:
return undefined
}
@@ -112,6 +114,8 @@ export const getProviderTitle = (provider: string) => {
return 'Hugging Face'
case 'xai':
return 'xAI'
+ case 'nvidia':
+ return 'NVIDIA NIM'
default:
return provider.charAt(0).toUpperCase() + provider.slice(1)
}