Skip to content

fix: add NVIDIA API host to reasoning_content allowlist for DeepSeek V4 models#914

Open
SnotacusNexus wants to merge 3 commits intoGitlawb:mainfrom
SnotacusNexus:main
Open

fix: add NVIDIA API host to reasoning_content allowlist for DeepSeek V4 models#914
SnotacusNexus wants to merge 3 commits intoGitlawb:mainfrom
SnotacusNexus:main

Conversation

@SnotacusNexus
Copy link
Copy Markdown

@SnotacusNexus SnotacusNexus commented Apr 27, 2026

Summary

  • Adds integrate.api.nvidia.com to the reasoning_content allowlist so DeepSeek models (deepseek-ai/deepseek-v4-flash, deepseek-ai/deepseek-v4-pro) hosted on NVIDIA's API don't get a 400 error on tool-call rounds
  • Adds a history-based fallback (hasThinkingBlockInHistory) so unlisted providers that already returned a thinking block continue to echo reasoning_content correctly
  • Adds providerSupportsReasoning() as a unified entry point combining explicit host matching + history detection, with a carve-out for api.openai.com to avoid false positives

Impact

  • user-facing: fixes API Error: 400 {"error":{"message":"The reasoning_content in the thinking mode must be passed back to the API."}} when using DeepSeek models (deepseek-ai/deepseek-v4-flash, deepseek-ai/deepseek-v4-pro) through integrate.api.nvidia.com
  • developer/maintainer: the two-pronged approach (allowlist + history heuristic) means new reasoning providers work without code changes as long as they already returned a thinking block on the first response

Testing

  • bun run build
  • bun run smoke
  • focused tests: bun test src/services/api/openaiShim.test.ts — blocked by pre-existing bun:bundle import issue in slowOperations.ts

Notes

  • provider/model path tested: NVIDIA API (integrate.api.nvidia.com) with deepseek-ai/deepseek-v4-flash and deepseek-ai/deepseek-v4-pro
  • follow-up work or known limitations: none

@SnotacusNexus SnotacusNexus changed the title fix: add NVIDIA API host to reasoning_content allowlist for DeepSeek models fix: add NVIDIA API host to reasoning_content allowlist for DeepSeek V4 models Apr 27, 2026
@jatmn
Copy link
Copy Markdown
Collaborator

jatmn commented Apr 27, 2026

#910 adds per provider/gateway flags for this i think. or at least has the framework to adapt it cleanly.
I would test you change concepts against that pr and see if it works or not.

kevincodex1
kevincodex1 previously approved these changes Apr 27, 2026
gnanam1990
gnanam1990 previously approved these changes Apr 28, 2026
Copy link
Copy Markdown
Collaborator

@gnanam1990 gnanam1990 left a comment

Choose a reason for hiding this comment

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

Nice — adding NVIDIA's integrate.api.nvidia.com to the allowlist and the unified providerSupportsReasoning() helper is a clean refactor. Explicit api.openai.com carve-out to avoid false positives is a good touch.

LGTM. Once the bun:bundle smoke is unblocked, a small unit test for hasThinkingBlockInHistory would be a nice follow-up.

@SnotacusNexus SnotacusNexus dismissed stale reviews from kevincodex1 and gnanam1990 via ad5bc2a May 1, 2026 19:33
@kevincodex1
Copy link
Copy Markdown
Contributor

hello bro @SnotacusNexus we just merged the registry PR for providers, kindly fix conflicts and this is good to go

Copy link
Copy Markdown
Collaborator

@Vasanthdev2004 Vasanthdev2004 left a comment

Choose a reason for hiding this comment

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

Targeted maintainer triage review of the current head ($short).

Verdict: Needs changes

Blocking issue:

  1. GitHub reports this branch as DIRTY / conflicting with main, so it cannot be merged or final-approved as-is. Please rebase or merge latest main, resolve the conflicts, and rerun the relevant checks.

I did not do a full code review because the current branch state is not mergeable. Happy to re-review once the branch is clean.

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.

5 participants