Skip to content

Nvidia NIM APIs support#64

Open
TG-TG-TG-TG-TG-TG wants to merge 1 commit intomkurman:mainfrom
TG-TG-TG-TG-TG-TG:main
Open

Nvidia NIM APIs support#64
TG-TG-TG-TG-TG-TG wants to merge 1 commit intomkurman:mainfrom
TG-TG-TG-TG-TG-TG:main

Conversation

@TG-TG-TG-TG-TG-TG
Copy link
Copy Markdown

Coded with Opus 4.6 so maybe a bit wierd. but it works! and have good ratelimits 40 request per minute. and free.

Coded with Opus 4.6 so maybe a bit wierd. but it works!
Copilot AI review requested due to automatic review settings March 19, 2026 19:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds NVIDIA NIM as an external provider option so the app can route model listing and generation/chat calls to NVIDIA’s OpenAI-compatible endpoints.

Changes:

  • Adds a Vite dev proxy for /nvidia-api to route requests to NVIDIA NIM.
  • Registers the nvidia provider across enums/constants and adds default fallback model entries + context limits.
  • Adds VITE_NVIDIA_API_KEY wiring to Settings UI and .env.example.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
vite.config.ts Adds a dev proxy route intended to forward NVIDIA NIM API calls.
interfaces/enums.ts Adds ExternalProvider.Nvidia.
constants.ts Adds NVIDIA provider config + fallback model list + context limits.
components/SettingsPanel.tsx Adds VITE_NVIDIA_API_KEY mapping for env-based UI indicator.
.env.example Documents VITE_NVIDIA_API_KEY.

Comment on lines +15 to +17
target: 'https://integrate.api.nvidia.com/v1',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/nvidia-api/, ''),
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dev proxy target includes /v1, but some call sites construct URLs that already include /v1/... (notably Responses API handling). This can yield proxied requests to .../v1/v1/... and 404s. Safer options are: proxy to https://integrate.api.nvidia.com (no /v1) and include /v1 in the rewritten path, or ensure the client base URL never produces an extra /v1 segment.

Suggested change
target: 'https://integrate.api.nvidia.com/v1',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/nvidia-api/, ''),
target: 'https://integrate.api.nvidia.com',
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/nvidia-api(\/v1)?/, '/v1'),

Copilot uses AI. Check for mistakes.
'kimi': import.meta.env.VITE_KIMI_API_KEY,
'z.ai': import.meta.env.VITE_ZAI_API_KEY,
'chutes': import.meta.env.VITE_CHUTES_API_KEY,
'nvidia': import.meta.env.VITE_NVIDIA_API_KEY,
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This UI maps the NVIDIA provider to import.meta.env.VITE_NVIDIA_API_KEY (and shows the “(env)” state), but SettingsService.getApiKey() currently has no case 'nvidia', so leaving the key empty will not actually fall back to the env var at runtime. Either add NVIDIA handling in SettingsService.getApiKey() or avoid implying env fallback here.

Suggested change
'nvidia': import.meta.env.VITE_NVIDIA_API_KEY,

Copilot uses AI. Check for mistakes.
Comment on lines +105 to +107
url: import.meta.env.DEV
? '/nvidia-api'
: 'https://integrate.api.nvidia.com/v1',
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PROVIDERS['nvidia'].url uses a dev-only relative path (/nvidia-api). That value is also passed through to the local backend AI routes (SSE/chat/jobs) as baseUrl, where it must be an absolute URL for the OpenAI SDK; using a relative path will break backend routing when enabled. It also interacts poorly with the Responses-API URL builder (which appends /v1/...), producing /nvidia-api/v1/... in dev and resulting in a double /v1/v1/... once proxied. Consider keeping the provider URL consistently absolute (e.g., https://integrate.api.nvidia.com/v1) and applying the Vite proxy only inside the browser-fetch path, or adjust the proxy/URL pair so the dev baseUrl already includes /v1 without duplicating it downstream.

Suggested change
url: import.meta.env.DEV
? '/nvidia-api'
: 'https://integrate.api.nvidia.com/v1',
url: 'https://integrate.api.nvidia.com',

Copilot uses AI. Check for mistakes.
@mkurman
Copy link
Copy Markdown
Owner

mkurman commented Apr 7, 2026

@copilot apply changes based on the comments in this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants