Skip to content

fix: respect reasoning_config for custom providers and fix OpenRouter… - #43613

Closed
Stephen30Yan wants to merge 1 commit into
NousResearch:mainfrom
Stephen30Yan:fix/reasoning-switch-custom-providers
Closed

fix: respect reasoning_config for custom providers and fix OpenRouter…#43613
Stephen30Yan wants to merge 1 commit into
NousResearch:mainfrom
Stephen30Yan:fix/reasoning-switch-custom-providers

Conversation

@Stephen30Yan

Copy link
Copy Markdown

… hardcoded reasoning

Two bugs fixed in _build_kwargs():

  1. OpenRouter path (line 418): hardcoded extra_body.reasoning to {"enabled": True, "effort": "medium"} instead of reading the user's reasoning_config. Now respects the toggle switch.

  2. Custom/unknown providers: reasoning_config was completely ignored because supports_reasoning was False for non-OpenRouter endpoints. Now sends top-level reasoning_effort param (which most OpenAI-compat APIs like DeepSeek/ARK expect). Maps "none" to "minimal" since some APIs reject "none" as invalid.

What does this PR do?

Related Issue

Fixes #

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

How to Test

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:

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

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 Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

… hardcoded reasoning

Two bugs fixed in _build_kwargs():

1. OpenRouter path (line 418): hardcoded extra_body.reasoning to
   {"enabled": True, "effort": "medium"} instead of reading the
   user's reasoning_config. Now respects the toggle switch.

2. Custom/unknown providers: reasoning_config was completely ignored
   because supports_reasoning was False for non-OpenRouter endpoints.
   Now sends top-level reasoning_effort param (which most OpenAI-compat
   APIs like DeepSeek/ARK expect). Maps "none" to "minimal" since
   some APIs reject "none" as invalid.
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/openrouter OpenRouter aggregator P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jun 10, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #20594, which fixes the same two bugs (OpenRouter hardcoded reasoning effort ignoring reasoning_config, and custom/non-OpenRouter providers being excluded from reasoning forwarding). #20594 is the earlier open PR; consider consolidating there.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for identifying the reasoning-config forwarding gap. This is now implemented on main through the live provider-profile path, so this older legacy-path patch is redundant.

  • Automated hermes-sweeper review verified agent/chat_completion_helpers.py:947-986: registered providers return through provider_profile before the legacy fallback and receive reasoning_config.
  • plugins/model-providers/custom/__init__.py:52-60 forwards configured effort as top-level reasoning_effort and emits think: false for disabled reasoning.
  • plugins/model-providers/openrouter/__init__.py:149-160 forwards the supplied reasoning_config as OpenRouter reasoning data, with the necessary mandatory-Anthropic exception.
  • Commit 67df958dbe06bb10ca16b8686c76baf0de3bac03 added the live custom-provider implementation and regression coverage; it shipped in v2026.7.7.
  • The earlier duplicate discussion on fix: forward reasoning_config to custom providers (vLLM, Ollama, etc.) #20594 records the same live-path resolution and is now closed as implemented on main.

@teknium1 teknium1 closed this Jul 14, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 14, 2026
@Stephen30Yan
Stephen30Yan deleted the fix/reasoning-switch-custom-providers branch July 14, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have provider/openrouter OpenRouter aggregator sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants