fix(provider): add NVIDIA NIM DeepSeek request compatibility#37833
Open
fuselayer wants to merge 2 commits into
Open
fix(provider): add NVIDIA NIM DeepSeek request compatibility#37833fuselayer wants to merge 2 commits into
fuselayer wants to merge 2 commits into
Conversation
This was referenced Jul 20, 2026
fuselayer
force-pushed
the
fix/nvidia-nim-request-shape
branch
from
July 20, 2026 06:03
3160fce to
4399657
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #24264
Type of change
What does this PR do?
DeepSeek V4 models on NVIDIA NIM (
deepseek-ai/deepseek-v4-flash,deepseek-ai/deepseek-v4-pro) hang instead of streaming a response. NIM only streams reasoning tokens for these models when the request body includeschat_template_kwargs. Since the AI SDK drops unknown top-level config keys, there's no way to set this fromopencode.json, so the field never reaches the wire and the request stalls.Two changes in
transform.ts:In
options(), for thenvidiaprovider on@ai-sdk/openai-compatible, I setchat_template_kwargs: { thinking: true, reasoning_effort: "high" }fordeepseek-v4models. This lands directly on the request body (same pattern as the existingalibaba-cnenable_thinkingblock right above it), so it isn't stripped by the SDK.In
normalizeMessages(), I remap anydeveloperrole message tosystemfor thenvidiaprovider. NIM returns a 500 on thedeveloperrole oncechat_template_kwargsis present, so without this the first change just turns the hang into a 500.I confirmed the field names against NVIDIA's own DeepSeek V4 docs (they use
chat_template_kwargswiththinking, notenable_thinking, which is a different NIM model family).How did you verify your code works?
Ran the patched build locally (
bun run dev:desktop) against NVIDIA NIM with my own API key.deepseek-v4-flashhung until timeout.developer-role 500s.ResourceExhausted), which confirms the request is actually reaching the backend now instead of stalling on malformed body.I couldn't re-verify against NVIDIA-hosted Kimi because that model returns a 404 "function not found for account" for my key right now, so I scoped this PR to DeepSeek only.
Screenshots / recordings
N/A — not a UI change.
Checklist