Skip to content

feat(providers): declarative reasoning_effort_max for deep-reasoning providers - #49355

Closed
leriou wants to merge 1 commit into
NousResearch:mainfrom
leriou:feat/reasoning-effort-max-declarative
Closed

feat(providers): declarative reasoning_effort_max for deep-reasoning providers#49355
leriou wants to merge 1 commit into
NousResearch:mainfrom
leriou:feat/reasoning-effort-max-declarative

Conversation

@leriou

@leriou leriou commented Jun 20, 2026

Copy link
Copy Markdown

What

Some providers (Z.AI/GLM-5.2, etc.) expose a deeper-than-default reasoning tier via a single top-level reasoning_effort parameter (e.g. "max"). Hermes' /reasoning xhigh command had no effect on these providers — they don't override build_api_kwargs_extras, so the base method returned ({}, {}) unconditionally.

How

Add a declarative reasoning_effort_max: str | None field to ProviderProfile. When set, the base build_api_kwargs_extras maps effort=xhighreasoning_effort=<value> as a top-level kwarg. No subclass needed.

# providers/base.py
reasoning_effort_max: str | None = None

# In build_api_kwargs_extras:
if self.reasoning_effort_max and effort == "xhigh":
    return {}, {"reasoning_effort": self.reasoning_effort_max}
return {}, {}
# plugins/model-providers/zai/__init__.py
zai = ProviderProfile(
    ...,
    reasoning_effort_max="max",
)

Why not override

The existing pattern is Nous/OpenRouter/MiniMax each overriding build_api_kwargs_extras with full custom logic. But providers like Z.AI/GLM only need a single parameter — a full override for one line of actual logic is noise. The declarative field follows the same philosophy as default_aux_model and default_max_tokens: simple things stay declarative.

Impact

  • Providers that don't set reasoning_effort_max → zero change (still ({}, {}))
  • Providers that override build_api_kwargs_extras entirely → unaffected (their override wins)
  • Only providers that set the field AND don't override → new behavior (intended)

…providers

Some providers (Z.AI/GLM-5.2, etc.) expose a deeper-than-default reasoning
tier via a single top-level reasoning_effort parameter (e.g. max).
Hermes' /reasoning xhigh command had no effect on these providers because
they don't override build_api_kwargs_extras and the base implementation
returned ({}, {}) unconditionally.

Add a declarative reasoning_effort_max field to ProviderProfile. When set,
the base build_api_kwargs_extras maps effort=xhigh to
reasoning_effort=<value> as a top-level kwarg — no subclass needed.

Providers that don't set the field are unaffected (still ({}, {})).
@alt-glitch alt-glitch added type/feature New feature or request provider/zai ZAI provider P3 Low — cosmetic, nice to have labels Jun 20, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the declarative provider-profile proposal. This is now implemented on main through a more provider-specific path.

  • Automated hermes-sweeper review verified that ZaiProfile.build_api_kwargs_extras() maps GLM-5.2 xhigh/max/ultra to top-level reasoning_effort="max" in plugins/model-providers/zai/__init__.py:79-106.
  • The transport applies profile top-level kwargs to the outgoing request in agent/transports/chat_completions.py:580-592.
  • Coverage verifies both the mapping and the final transport kwargs in tests/plugins/model_providers/test_zai_profile.py:100-107 and :237-250.
  • This shipped in commit a6079dd3502ee94c47481bc068caeea503045f70 (feat(providers): GLM-5.2 native reasoning_effort controls, feat(providers): GLM-5.2 native reasoning_effort controls (salvage #51108) #58884), included in v2026.7.7.

The linked #51482 concerns a related Ollama Cloud reasoning-effort path; the direct Z.AI behavior requested here is already covered 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
@leriou
leriou deleted the feat/reasoning-effort-max-declarative branch July 17, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have provider/zai ZAI provider sweeper:implemented-on-main Sweeper: behavior already present on current main type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants