Skip to content

feat: add DeepSeek V4 Pro model support#12179

Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
feature/add-deepseek-v4-pro-model
Draft

feat: add DeepSeek V4 Pro model support#12179
roomote-v0[bot] wants to merge 1 commit intomainfrom
feature/add-deepseek-v4-pro-model

Conversation

@roomote-v0
Copy link
Copy Markdown
Contributor

@roomote-v0 roomote-v0 Bot commented Apr 24, 2026

Related GitHub Issue

Closes: #12177

Description

This PR attempts to address Issue #12177 where deepseek-v4-pro fails with error "The reasoning_content in the thinking mode must be passed back to the API".

The root cause is that deepseek-v4-pro was not recognized as a thinking/reasoning model. Three changes were made:

  1. Added deepseek-v4-pro to the model registry (packages/types/src/providers/deepseek.ts) with:

    • 164K context window, 16K max output tokens
    • Vision support enabled
    • preserveReasoning: true so reasoning_content is passed back to the API during multi-turn tool call conversations
    • Pricing based on info shared in the issue
  2. Updated the isThinkingModel check (src/api/providers/deepseek.ts) to match deepseek-v4 prefix in addition to deepseek-reasoner. This ensures:

    • The thinking: { type: "enabled" } parameter is sent
    • mergeToolResultText is enabled to prevent reasoning_content from being dropped
  3. Added tests for the new model in src/api/providers/__tests__/deepseek.spec.ts

Feedback and guidance are welcome, especially regarding the exact pricing and context window values.

Test Procedure

  • All 27 existing DeepSeek tests pass (1 pre-existing skip)
  • Added 4 new tests for deepseek-v4-pro:
    • Streaming reasoning_content handling
    • Thinking parameter inclusion in API calls
    • preserveReasoning flag verification
    • Model info correctness (maxTokens, contextWindow, supportsImages)
  • Run: cd src && npx vitest run api/providers/__tests__/deepseek.spec.ts

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue.
  • Scope: Changes are focused on the linked issue.
  • Self-Review: Performed self-review.
  • Testing: New tests added for deepseek-v4-pro model.
  • Documentation Impact: No documentation updates required.
  • Contribution Guidelines: Read and agree.

Documentation Updates

  • No documentation updates are required.

Additional Notes

The pricing values used ($2.19/M input, $8.87/M output, $0.55/M cache read) were estimated based on the pricing screenshot shared in the issue. These may need adjustment once official API documentation is confirmed.

Interactively review PR in Roo Code Cloud

- Add deepseek-v4-pro to the model registry with appropriate config
  (164K context, 16K max output, vision support, preserveReasoning)
- Update isThinkingModel check to recognize deepseek-v4 models so
  thinking mode and reasoning_content passback work correctly
- Add tests for the new model

Fixes #12177
@hunterschuler
Copy link
Copy Markdown

164K context window, 16K max output tokens

That context window is incorrect. DeepSeek recommends a minimum context window of 384K and supports up to a 1M context window, per https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro

16K output tokens also may be too strict. DeepSeek API supports 384K max output tokens, per https://api-docs.deepseek.com/quick_start/pricing

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.

[BUG] Cannot work with DeepSeek V4 Pro

3 participants