Skip to content

feat(providers): add NVIDIA NIM and Z.ai providers#5560

Merged
waleedlatif1 merged 120 commits into
stagingfrom
worktree-nvidia-provider-research
Jul 10, 2026
Merged

feat(providers): add NVIDIA NIM and Z.ai providers#5560
waleedlatif1 merged 120 commits into
stagingfrom
worktree-nvidia-provider-research

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Add NVIDIA NIM as a new BYOK provider — Nemotron model family (llama-3.1-nemotron-70b-instruct, llama-3.1-nemotron-ultra-253b-v1, llama-3.3-nemotron-super-49b-v1.5, nemotron-3-nano-30b-a3b, nemotron-3-super-120b-a12b, nemotron-3-ultra-550b-a55b) via NVIDIA's OpenAI-compatible NIM endpoint (integrate.api.nvidia.com)
  • Add Z.ai as a new hosted provider (Sim provides the key, same tier as openai/anthropic/google) — GLM model family (glm-5.2 down to glm-4-32b-0414-128k) via api.z.ai's OpenAI-compatible endpoint, bare glm-* model ids with no provider prefix, matching how openai/anthropic models are named
  • Z.ai's tool_choice is forced to 'auto' since the API only documents auto support (forcing a specific function or 'none' is rejected) — force/none from the tool-usage-control UI is ignored with a warning log instead of erroring against the live API
  • Wired Z.ai into the hosted-key rotation system (ZAI_API_KEY_1/2/3) alongside the existing openai/anthropic/gemini/cohere rotation
  • Ran a full /validate-model-style audit against both providers' live docs before shipping — caught and fixed a duplicate recommended flag on each provider, a missing thinking capability on glm-5-turbo, a stale default model on nvidia, and the tool_choice mismatch above

Type of Change

  • New feature

Testing

  • bunx vitest run providers/models.test.ts — 18/18 passing (added coverage for both new providers, including hosted-model + routing assertions for zai)
  • tsc --noEmit — zero new type errors
  • biome check — clean
  • Tested manually via the model dropdown/config wiring; no live API key exercised

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

waleedlatif1 and others added 30 commits April 3, 2026 23:30
…ership workflow edits via sockets, ui improvements
…ration, signup method feature flags, SSO improvements
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
…nts, secrets performance, polling refactors, drag resources in mothership
…endar triggers, docs updates, integrations/models pages improvements
…mat, logs performance improvements

fix(csp): add missing analytics domains, remove unsafe-eval, fix workspace CSP gap (#4179)
fix(landing): return 404 for invalid dynamic route slugs (#4182)
improvement(seo): optimize sitemaps, robots.txt, and core web vitals across sim and docs (#4170)
fix(gemini): support structured output with tools on Gemini 3 models (#4184)
feat(brightdata): add Bright Data integration with 8 tools (#4183)
fix(mothership): fix superagent credentials (#4185)
fix(logs): close sidebar when selected log disappears from filtered list; cleanup (#4186)
v0.6.46: mothership streaming fixes, brightdata integration
…, library, typescript 7, jupyter notebook, o11y, meta muse, gpt 5.6
- NVIDIA NIM (BYOK): Nemotron model family (70B/Ultra-253B/Super-49B v1.5,
  Nemotron-3 Nano/Super/Ultra) via integrate.api.nvidia.com's
  OpenAI-compatible API
- Z.ai (hosted): GLM model family (5.2 down to 4-32B) via api.z.ai's
  OpenAI-compatible API, bare glm-* model ids with no provider prefix,
  Sim-provided key rotation (ZAI_API_KEY_1/2/3) matching openai/anthropic/google
- Z.ai tool_choice is forced to 'auto' since the API only documents auto
  support; forced/none tool_choice from prepareToolsWithUsageControl is
  ignored with a warning log instead of being sent to the API
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 10, 2026 4:08pm

Request Review

@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Z.ai hosted keys and BYOK affect billing and credential paths for all GLM catalog models; the large new provider adapters touch core execution (tools, streaming, structured output) though they follow existing OpenAI-compatible patterns.

Overview
Adds NVIDIA NIM and Z.ai as first-class LLM providers, with catalog entries, icons, registry wiring, and OpenAI-compatible adapters (NIM at integrate.api.nvidia.com, Z.ai at api.z.ai).

NVIDIA ships six nvidia/* Nemotron models (pattern ^nvidia/), tool calling, streaming, and deferred json_schema when tools are active. Attachments are explicitly unsupported like other text-only adapters.

Z.ai ships twelve bare glm-* models with empty modelPatterns so self-hosted glm-* IDs are not misrouted. GLM models are added to getHostedModels() with ZAI_API_KEY_1/2/3 rotation, hosted-key resolution in providers/utils and BYOK (zai in contracts). The Z.ai adapter maps thinking / reasoning_effort, uses json_object instead of strict JSON schema, and always sends tool_choice: 'auto' (forced/none choices are ignored with a warning); post-tool streaming/format calls drop tools rather than using tool_choice: 'none'.

Shared plumbing updates tokenization heuristics, attachment provider lists, and tests for both catalogs plus Z.ai hosted routing.

Reviewed by Cursor Bugbot for commit bb0a944. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds NVIDIA NIM and Z.ai as model providers. The main changes are:

  • New NVIDIA NIM and Z.ai provider adapters.
  • New Nemotron and GLM model catalog entries.
  • Z.ai hosted-key rotation and BYOK wiring.
  • Provider registry, icon, attachment, and tokenization updates.
  • Tests for provider definitions and model routing.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/providers/models.ts Adds NVIDIA and Z.ai model definitions and exact Z.ai catalog routing.
apps/sim/providers/zai/index.ts Adds the Z.ai request adapter with hosted GLM request handling and tool filtering.
apps/sim/providers/nvidia/index.ts Adds the NVIDIA NIM request adapter for Nemotron models.
apps/sim/lib/api-key/byok.ts Adds Z.ai to hosted-key and workspace BYOK lookup.
apps/sim/lib/core/config/api-keys.ts Adds Z.ai rotating-key support.

Reviews (4): Last reviewed commit: "fix(providers): route Z.ai through the w..." | Re-trigger Greptile

Comment thread apps/sim/providers/models.ts Outdated
Drop the /^glm/ fallback pattern - it would overmatch any unrelated
self-hosted "glm-*" model (e.g. a custom vLLM/LiteLLM deployment) and
misroute it to Z.ai's hosted, Sim-billed key. Routing now relies solely
on the exact model-id match against zai's static catalog.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

Re: Greptile's P1 "Disabled Tools Become Auto" finding (flagged outside the diff, in the summary) — traced this through and don't think it reproduces:

  • request.tools is passed through prepareToolsWithUsageControl, which filters OUT any tool whose usageControl === 'none' before returning filteredTools.
  • If every tool is disabled, filteredTools.length === 0 and the function takes its early-return branch, returning { tools: undefined, toolChoice: undefined, ... } — not an empty array.
  • zai/index.ts's guard is if (filteredTools?.length && toolChoice) — with filteredTools undefined, filteredTools?.length is undefined (falsy), so the block is skipped entirely and payload.tools is never set. Z.ai receives no tools field at all and has nothing to call.
  • If only some tools are disabled, the remaining (still-enabled) ones are sent with tool_choice: 'auto' — which is exactly the intended "let the model pick among the tools that are actually enabled" behavior, not a bypass of the disabled ones.

This filtering logic is unmodified shared code (prepareToolsWithUsageControl in providers/utils.ts), identical to how sakana/openai already handle usageControl: 'none' — my change only touches what tool_choice value gets sent for the tools that remain after filtering, not which tools are filtered. Happy to add a regression test here if useful, but wanted to flag the reasoning before making a speculative code change. Let me know if I'm missing a path where this actually triggers.

Fixed the P2 finding (/^glm/ overmatching unrelated self-hosted models) in f6c0117 — thread resolved.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/providers/zai/index.ts
request.thinkingLevel and request.reasoningEffort were computed but
never mapped onto the Z.ai payload, so the thinking toggle and GLM-5.2's
reasoning_effort control silently no-op'd and always ran on Z.ai's
server-side default instead of the user's selection.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/providers/utils.ts
getApiKeyWithBYOK (the resolver actually used by workspace provider
runs, per providers/index.ts) only rotated server keys for
openai/anthropic/google/mistral, so GLM calls without a user apiKey
failed even with ZAI_API_KEY_1/2/3 configured — getApiKey in
providers/utils.ts had zai wired but that's not the codepath workspace
runs go through. Add zai to the hosted-check condition, and register it
as a BYOKProviderId so a workspace can also bring its own Z.ai key.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit bb0a944. Configure here.

@waleedlatif1 waleedlatif1 merged commit 2986362 into staging Jul 10, 2026
18 checks passed
@waleedlatif1 waleedlatif1 deleted the worktree-nvidia-provider-research branch July 10, 2026 16:15
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.

4 participants