Skip to content

Add DeepSeek V4 model support (direct API + OpenRouter)#452

Open
junaid-hasan wants to merge 1 commit into
math-inc:mainfrom
junaid-hasan:main
Open

Add DeepSeek V4 model support (direct API + OpenRouter)#452
junaid-hasan wants to merge 1 commit into
math-inc:mainfrom
junaid-hasan:main

Conversation

@junaid-hasan
Copy link
Copy Markdown

  • Add deepseek-v4-pro and deepseek-v4-flash to both direct DeepSeek provider catalog and OpenRouter model list
  • Retain deepseek-chat and deepseek-reasoner (deprecated 2026/07/24)
  • Fix reasoning/thinking for direct DeepSeek API:
    • _supports_reasoning_extra_body() now recognizes deepseek.com URLs
    • Use DeepSeek-native format: extra_body={'thinking': {'type': 'enabled/disabled'}}
    • Add top-level reasoning_effort param (high/max) per DeepSeek API spec
  • OpenRouter path unchanged — continues using existing reasoning format

Tested end-to-end via Gauss agent with deepseek-v4-pro, deepseek-v4-flash, deepseek-chat (direct + OpenRouter), all passing.

What does this PR do?

Adds DeepSeek V4 model support and fixes thinking mode for the direct DeepSeek API endpoint. DeepSeek's new V4 models (deepseek-v4-pro, deepseek-v4-flash) use a different thinking mode format
than OpenRouter — extra_body={"thinking": {"type": "enabled"}} + top-level reasoning_effort instead of extra_body={"reasoning": {...}}. The direct API endpoint was previously unreachable for
thinking mode because _supports_reasoning_extra_body() only returned true for OpenRouter URLs. The existing deepseek-chat / deepseek-reasoner models are being deprecated July 2026, so the
catalog needs the V4 replacements.

Related Issue

Fixes # (no existing issue — this is a new provider model update)

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • gauss_cli/models.py — Added deepseek-v4-pro and deepseek-v4-flash to direct DeepSeek provider catalog and OpenRouter model list
  • run_agent.py_supports_reasoning_extra_body() now recognizes deepseek.com base URLs
  • run_agent.py_build_api_kwargs() uses DeepSeek-native thinking format ({"thinking": {"type": "enabled/disabled"}} in extra_body, reasoning_effort as top-level param)

How to Test

  1. Set DEEPSEEK_API_KEY env var with a valid DeepSeek API key
  2. gauss --provider deepseek --model deepseek-v4-pro -q "What is 2+2?" — should respond with thinking mode enabled
  3. gauss --provider openrouter --model deepseek/deepseek-v4-pro -q "What is 2+2?" — should work via OpenRouter as before
  4. Verify gauss_cli/models.py lists deepseek-v4-pro and deepseek-v4-flash in provider menus

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Debian 13 (Equivalent to Ubuntu 26.04)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A
  • N/A — no new config keys, no architecture changes, no doc changes needed
  • N/A — no tool behavior changes
  • N/A — no cross-platform impact (pure provider config + API param mapping)

For New Skills

  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Gauss tools)
  • I've tested the skill end-to-end: gauss --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

   === Direct DeepSeek API ===
   deepseek-v4-flash (non-thinking): 4 (1.4s)
   deepseek-v4-pro  (thinking):      Paris (2.2s)
   deepseek-v4-pro  (tools+thinking): listed directory contents (69s)

   === OpenRouter ===
   deepseek/deepseek-chat:            4 (1.9s)
   deepseek/deepseek-v4-pro (think):  Berlin (19.5s)

   All 5/5 passing.

- Add deepseek-v4-pro and deepseek-v4-flash to both direct DeepSeek
  provider catalog and OpenRouter model list
- Retain deepseek-chat and deepseek-reasoner (deprecated 2026/07/24)
- Fix reasoning/thinking for direct DeepSeek API:
  - _supports_reasoning_extra_body() now recognizes deepseek.com URLs
  - Use DeepSeek-native format: extra_body={'thinking': {'type': 'enabled/disabled'}}
  - Add top-level reasoning_effort param (high/max) per DeepSeek API spec
- OpenRouter path unchanged — continues using existing reasoning format

Tested end-to-end via Gauss agent with deepseek-v4-pro, deepseek-v4-flash,
deepseek-chat (direct + OpenRouter), all passing.
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.

1 participant