Skip to content
Python

Add NVIDIA NIM provider support

Hrishikesh Naveenam2191743f23ae
diff --git a/coworker/providers/matrix.py b/coworker/providers/matrix.py
index 26b2cb89..d1a7d767 100644
--- a/coworker/providers/matrix.py
+++ b/coworker/providers/matrix.py
@@ -16,7 +16,7 @@ where the vendor spec wasn't re-checked stay ``None`` — the meter simply hides
showing a made-up denominator. Values entered 2026-07-28 from vendor docs; verify alongside
the id refresh.
-Resellers: Together + Fireworks + OpenRouter + Nebius + OrcaRouter. TODO: add Groq entries here AND its
+Resellers: Together + Fireworks + OpenRouter + Nebius + OrcaRouter + NVIDIA NIM. TODO: add Groq entries here AND its
descriptor in ``registry.py`` once the current provider surface is tested — deliberately
deferred to bound how much needs verifying at once.
"""
@@ -335,6 +335,22 @@ MATRIX: dict[str, ModelEntry] = {
"orcarouter:deepseek/deepseek-v4-pro": ModelEntry(
"DeepSeek V4 Pro · via OrcaRouter", _AGENTIC, 1_048_576
),
+ # NVIDIA NIM — ids verified against integrate.api.nvidia.com/v1/models (2026-07-25).
+ # Tool calling was probed live per model the same day: each returned two well-formed
+ # calls in a single assistant turn, so _AGENTIC (incl. parallel) is observed, not
+ # assumed. Vision left off — not tested. NVIDIA also fronts kimi-k2.6, but it 404s
+ # ("Not found for account") on a standard build.nvidia.com key, so it stays out until
+ # that's verifiable.
+ "nvidia:nvidia/llama-3.3-nemotron-super-49b-v1.5": ModelEntry(
+ "Llama 3.3 Nemotron Super · via NVIDIA"
+ ),
+ "nvidia:nvidia/nemotron-3-ultra-550b-a55b": ModelEntry(
+ "Nemotron 3 Ultra · via NVIDIA"
+ ),
+ "nvidia:z-ai/glm-5.2": ModelEntry("GLM-5.2 · via NVIDIA"),
+ # ~150s to first response from cold on this route — usable, but noticeably slower
+ # than the same model via Together/Fireworks.
+ "nvidia:deepseek-ai/deepseek-v4-pro": ModelEntry("DeepSeek V4 Pro · via NVIDIA"),
# -- cloud accounts (models running in the user's own AWS/GCP) ----------------
# Bedrock ids carry a family segment (claude/ → native Anthropic path, other/ →
# Converse) plus AWS's own `-v<n>:<m>` version suffix. Some regions require the
diff --git a/coworker/providers/registry.py b/coworker/providers/registry.py
index 0cc6edfa..1d582006 100644
--- a/coworker/providers/registry.py
+++ b/coworker/providers/registry.py
@@ -743,6 +743,18 @@ DESCRIPTORS: list[ProviderDescriptor] = [
recommended_model="anthropic/claude-sonnet-5",
env_key="ORCAROUTER_API_KEY",
),
+ # NVIDIA NIM: NVIDIA's own Nemotron line plus other labs' models, all under NVIDIA's
+ # `vendor/model` namespace (hence a routed id like `nvidia:nvidia/nemotron-…`). Same
+ # reseller shape as Together/Fireworks; the endpoint also fronts self-hosted NIM
+ # containers, which is why the base_url help calls that out.
+ _compat(
+ "nvidia",
+ "NVIDIA NIM",
+ base_url="https://integrate.api.nvidia.com/v1",
+ recommended_model="nvidia/llama-3.3-nemotron-super-49b-v1.5",
+ env_key="NVIDIA_API_KEY",
+ endpoint_help="Prefilled with NVIDIA's hosted NIM endpoint. Point it at a self-hosted NIM container (e.g. http://localhost:8000/v1) to use your own deployment.",
+ ),
ProviderDescriptor(
name="ollama",
title="Ollama",
@@ -870,6 +882,8 @@ def detect_provider(api_key: str) -> Optional[str]:
return "openrouter"
if key.startswith("AIza"):
return "gemini"
+ if key.startswith("nvapi-"):
+ return "nvidia"
if key.startswith(("sk-", "sk_")):
return "openai"
return None
@@ -1141,6 +1155,26 @@ def verify_provider_key(
headers = {"Authorization": f"Bearer {key}"} if key else {}
resp = httpx.get(v1_base(name, base_url) + "/models", headers=headers, timeout=timeout)
+ elif name == "nvidia":
+ # NIM's /v1/models is PUBLIC: it answers 200 for any key, including an empty
+ # one, so the usual list-models probe can't tell a good key from a typo. Auth
+ # is enforced only on inference — and only once the model id routes (a bad
+ # model 404s before the key is looked at) — so we spend a single token on the
+ # recommended model instead.
+ default_base = next(
+ (f.default for f in d.fields if f.key == "base_url" and f.default), ""
+ )
+ base = (base_url or "").strip().rstrip("/") or default_base.rstrip("/")
+ resp = httpx.post(
+ base + "/chat/completions",
+ headers={"Authorization": f"Bearer {key}"},
+ json={
+ "model": d.recommended_model,
+ "messages": [{"role": "user", "content": "hi"}],
+ "max_tokens": 1,
+ },
+ timeout=timeout,
+ )
elif name in ("ark", "ark-agent-plan-cn"):
default_base = next(
(f.default for f in d.fields if f.key == "base_url" and f.default), ""
diff --git a/coworker/server/manager.py b/coworker/server/manager.py
index 4eecac05..a3e4e0d7 100644
--- a/coworker/server/manager.py
+++ b/coworker/server/manager.py
@@ -4272,6 +4272,11 @@ class SessionManager:
"qwen": ["qwen3-max", "qwen3-coder-plus", "qwen-plus"],
"xai": ["grok-4.3", "grok-4"],
"mistral": ["mistral-large-latest", "mistral-small-latest"],
+ # NIM ids carry their own `vendor/model` namespace; both probed 2026-07-25.
+ "nvidia": [
+ "nvidia/llama-3.3-nemotron-super-49b-v1.5",
+ "nvidia/nemotron-3-ultra-550b-a55b",
+ ],
}
def _suggested_models(self, name: str) -> list[str]:
diff --git a/surfaces/gui/src/api.ts b/surfaces/gui/src/api.ts
index 18185e08..1a9cf81b 100644
--- a/surfaces/gui/src/api.ts
+++ b/surfaces/gui/src/api.ts
@@ -2766,6 +2766,7 @@ export function detectProvider(apiKey: string): string | null {
if (key.startsWith("sk-orca-")) return "orcarouter";
if (key.startsWith("sk-or-")) return "openrouter";
if (key.startsWith("AIza")) return "gemini";
+ if (key.startsWith("nvapi-")) return "nvidia";
if (key.startsWith("sk-") || key.startsWith("sk_")) return "openai";
return null;
}
diff --git a/surfaces/gui/src/providers/ProviderSetup.tsx b/surfaces/gui/src/providers/ProviderSetup.tsx
index 6435df1a..9920366b 100644
--- a/surfaces/gui/src/providers/ProviderSetup.tsx
+++ b/surfaces/gui/src/providers/ProviderSetup.tsx
@@ -42,6 +42,7 @@ export const KEY_HELP: Record<string, { url: string; label: string; labelKey?: s
fireworks: { url: "https://fireworks.ai/account/api-keys", label: "fireworks.ai" },
together: { url: "https://api.together.xyz/settings/api-keys", label: "together.xyz" },
nebius: { url: "https://tokenfactory.nebius.com/project/api-keys", label: "tokenfactory.nebius.com" },
+ nvidia: { url: "https://build.nvidia.com/settings/api-keys", label: "build.nvidia.com" },
zai: { url: "https://z.ai/manage-apikey/apikey-list", label: "z.ai" },
kimi: { url: "https://platform.moonshot.ai/console/api-keys", label: "platform.moonshot.ai" },
deepseek: { url: "https://platform.deepseek.com/api_keys", label: "platform.deepseek.com" },
diff --git a/surfaces/gui/src/providers/logos.ts b/surfaces/gui/src/providers/logos.ts
index 71e4d18d..3d9cf71f 100644
--- a/surfaces/gui/src/providers/logos.ts
+++ b/surfaces/gui/src/providers/logos.ts
@@ -20,6 +20,7 @@ import openrouter from "./logos/openrouter.svg";
import orcarouter from "./logos/orcarouter.svg";
import fireworks from "./logos/fireworks.svg";
import together from "./logos/together.svg";
+import nvidia from "./logos/nvidia.svg";
import zai from "./logos/zai.svg";
import kimi from "./logos/kimi.svg";
import deepseek from "./logos/deepseek.svg";
@@ -52,6 +53,7 @@ export const PROVIDER_LOGOS: Record<string, string> = {
fireworks,
together,
nebius,
+ nvidia,
zai,
kimi,
deepseek,
@@ -77,6 +79,7 @@ export const PROVIDER_ORDER = [
"openrouter-account",
"fireworks",
"together",
+ "nvidia",
"zai",
"kimi",
"deepseek",
diff --git a/surfaces/gui/src/providers/logos/nvidia.svg b/surfaces/gui/src/providers/logos/nvidia.svg
new file mode 100644
index 00000000..a9683c2e
--- /dev/null
+++ b/surfaces/gui/src/providers/logos/nvidia.svg
@@ -0,0 +1 @@
+<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Nvidia</title><path d="M10.212 8.976V7.62c.127-.01.256-.017.388-.021 3.596-.117 5.957 3.184 5.957 3.184s-2.548 3.647-5.282 3.647a3.227 3.227 0 01-1.063-.175v-4.109c1.4.174 1.681.812 2.523 2.258l1.873-1.627a4.905 4.905 0 00-3.67-1.846 6.594 6.594 0 00-.729.044m0-4.476v2.025c.13-.01.259-.019.388-.024 5.002-.174 8.261 4.226 8.261 4.226s-3.743 4.69-7.643 4.69c-.338 0-.675-.031-1.007-.092v1.25c.278.038.558.057.838.057 3.629 0 6.253-1.91 8.794-4.169.421.347 2.146 1.193 2.501 1.564-2.416 2.083-8.048 3.763-11.24 3.763-.308 0-.603-.02-.894-.048V19.5H24v-15H10.21zm0 9.756v1.068c-3.356-.616-4.287-4.21-4.287-4.21a7.173 7.173 0 014.287-2.138v1.172h-.005a3.182 3.182 0 00-2.502 1.178s.615 2.276 2.507 2.931m-5.961-3.3c1.436-1.935 3.604-3.148 5.961-3.336V6.523C5.81 6.887 2 10.723 2 10.723s2.158 6.427 8.21 7.015v-1.166C5.77 16 4.25 10.958 4.25 10.958h-.002z" fill="#74B71B" fill-rule="nonzero"></path></svg>
\ No newline at end of file
diff --git a/tests/test_provider_verify.py b/tests/test_provider_verify.py
index 39e0b3ae..d1984734 100644
--- a/tests/test_provider_verify.py
+++ b/tests/test_provider_verify.py
@@ -1,5 +1,5 @@
-"""Tests for provider key detection + the live (read-only) Test/verify path. SDK-free: the
-single httpx.get is monkeypatched so no network is touched."""
+"""Tests for provider key detection + the live Test/verify path. SDK-free: httpx.get — and
+httpx.post, which only NVIDIA NIM needs — are monkeypatched so no network is touched."""
from __future__ import annotations
@@ -18,6 +18,7 @@ from coworker.providers import detect_provider, verify_provider_key
("sk-orca-v1-abc", "orcarouter"),
("sk-or-v1-abc", "openrouter"),
("AIzaSyAbc123", "gemini"),
+ ("nvapi-abc123", "nvidia"),
("sk-proj-abc", "openai"),
("sk_live_abc", "openai"),
("", None),
@@ -141,6 +142,44 @@ def test_verify_ollama_uses_v1_models_no_key(monkeypatch):
assert "headers" not in cap # keyless
+# -- NVIDIA NIM: the one provider a list-models probe can't verify ---------------
+def _patch_post_refusing_get(monkeypatch, status=200, capture=None):
+ _patch_post(monkeypatch, status=status, capture=capture)
+
+ def refuse_get(*_a, **_kw): # see the docstring below
+ raise AssertionError("NVIDIA verify must not GET /models — it is unauthenticated")
+
+ monkeypatch.setattr("httpx.get", refuse_get)
+
+
+def test_verify_nvidia_posts_a_one_token_completion(monkeypatch):
+ """NIM's /v1/models is PUBLIC — 200 for any key, including an empty one — so a
+ list-models probe would greenlight a typo. Auth is only enforced on inference, hence
+ the POST. The GET stub above fails the test if this ever regresses to the generic
+ branch."""
+ from coworker.providers.registry import get_descriptor
+
+ cap: dict = {}
+ _patch_post_refusing_get(monkeypatch, status=200, capture=cap)
+ assert verify_provider_key("nvidia", api_key="nvapi-x") == {"ok": True}
+ assert cap["url"] == "https://integrate.api.nvidia.com/v1/chat/completions"
+ assert cap["headers"]["Authorization"] == "Bearer nvapi-x"
+ # Asserted against the descriptor, not a literal: NIM model ids rotate, and the point
+ # is that verify names the *recommended* model — a bad id 404s before auth is checked.
+ assert cap["json"]["model"] == get_descriptor("nvidia").recommended_model
+ assert cap["json"]["max_tokens"] == 1
+
+
+def test_verify_nvidia_bad_key_is_invalid(monkeypatch):
+ """NIM answers 403 on a bad key (401 with no header at all); both must read as a key
+ problem, not as an unreachable server."""
+ _patch_post_refusing_get(monkeypatch, status=403)
+ assert verify_provider_key("nvidia", api_key="nvapi-bad") == {
+ "ok": False,
+ "error": "Invalid API key.",
+ }
+
+
@pytest.mark.parametrize(
"name,base_url,model",
[
@@ -161,7 +200,7 @@ def test_verify_ark_uses_non_persisted_responses_probe(
):
"""Reverse-verified probe: the captured fixture must be non-empty and provider-specific."""
cap: dict = {}
- _patch_post(monkeypatch, status=200, capture=cap)
+ _patch_post_refusing_get(monkeypatch, status=200, capture=cap)
assert verify_provider_key(name, api_key="ark-key") == {"ok": True}
assert cap["url"] == base_url + "/responses"
@@ -176,7 +215,7 @@ def test_verify_ark_uses_non_persisted_responses_probe(
def test_verify_ark_profile_endpoint_override(monkeypatch):
cap: dict = {}
- _patch_post(monkeypatch, status=200, capture=cap)
+ _patch_post_refusing_get(monkeypatch, status=200, capture=cap)
verify_provider_key(
"ark",
@@ -187,6 +226,17 @@ def test_verify_ark_profile_endpoint_override(monkeypatch):
assert cap["url"] == "https://gateway.example/ark/v3/responses"
+def test_verify_nvidia_custom_endpoint(monkeypatch):
+ """The descriptor's help text promises a self-hosted NIM container works — only true
+ if the override actually reaches the request."""
+ cap: dict = {}
+ _patch_post_refusing_get(monkeypatch, status=200, capture=cap)
+ verify_provider_key(
+ "nvidia", api_key="nvapi-x", base_url="http://localhost:8000/v1/"
+ )
+ assert cap["url"] == "http://localhost:8000/v1/chat/completions"
+
+
def test_verify_network_error_is_clean(monkeypatch):
_patch_get(monkeypatch, raise_exc=ConnectionError("boom"))
res = verify_provider_key("openai", api_key="sk-x")
diff --git a/tests/test_providers.py b/tests/test_providers.py
index 89a734aa..6bd4b305 100644
--- a/tests/test_providers.py
+++ b/tests/test_providers.py
@@ -278,7 +278,8 @@ def test_stream_accumulates_tool_calls():
)
-# -- OpenAI-compatible vendor providers (Z AI, DeepSeek, Kimi, MiniMax, Qwen, xAI, Mistral) ------
+# -- OpenAI-compatible vendor providers (Z AI, DeepSeek, Kimi, MiniMax, Qwen, xAI, Mistral,
+# NVIDIA NIM) ------------------------------------------------------------------------------
COMPAT_VENDORS = {
"zai": "https://api.z.ai/api/paas/v4",
@@ -288,6 +289,7 @@ COMPAT_VENDORS = {
"qwen": "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
"xai": "https://api.x.ai/v1",
"mistral": "https://api.mistral.ai/v1",
+ "nvidia": "https://integrate.api.nvidia.com/v1",
}
@@ -501,6 +503,9 @@ def test_matrix_answers_capabilities_for_reseller_ids():
"openrouter:meta-llama/llama-4-maverick",
"nebius:zai-org/GLM-5.2",
"orcarouter:anthropic/claude-sonnet-5",
+ # NIM ids are `vendor/model`, so NVIDIA's own models repeat the word in the
+ # routed id. Deliberate: the `z-ai/` and `deepseek-ai/` rows in matrix.py don't.
+ "nvidia:nvidia/llama-3.3-nemotron-super-49b-v1.5",
):
caps = capabilities_for(mid)
assert caps.tools and caps.parallel_tool_calls and caps.streaming