Conversation
Coded with Opus 4.6 so maybe a bit wierd. but it works!
There was a problem hiding this comment.
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-apito route requests to NVIDIA NIM. - Registers the
nvidiaprovider across enums/constants and adds default fallback model entries + context limits. - Adds
VITE_NVIDIA_API_KEYwiring 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. |
| target: 'https://integrate.api.nvidia.com/v1', | ||
| changeOrigin: true, | ||
| rewrite: (path: string) => path.replace(/^\/nvidia-api/, ''), |
There was a problem hiding this comment.
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.
| 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'), |
| '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, |
There was a problem hiding this comment.
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.
| 'nvidia': import.meta.env.VITE_NVIDIA_API_KEY, |
| url: import.meta.env.DEV | ||
| ? '/nvidia-api' | ||
| : 'https://integrate.api.nvidia.com/v1', |
There was a problem hiding this comment.
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.
| url: import.meta.env.DEV | |
| ? '/nvidia-api' | |
| : 'https://integrate.api.nvidia.com/v1', | |
| url: 'https://integrate.api.nvidia.com', |
|
@copilot apply changes based on the comments in this thread |
Coded with Opus 4.6 so maybe a bit wierd. but it works! and have good ratelimits 40 request per minute. and free.