Skip to content

The agent that grows with you

feat: accept dict-form reasoning_effort for providers with bespoke thinking tiers

teknium15c113bb07c97
diff --git a/cli-config.yaml.example b/cli-config.yaml.example
index a9a3332959b..3277828f708 100644
--- a/cli-config.yaml.example
+++ b/cli-config.yaml.example
@@ -1221,12 +1221,17 @@ agent:
# Reasoning effort level (OpenRouter and Nous Portal)
# Controls how much "thinking" the model does before responding.
# Options: "xhigh" (max), "high", "medium", "low", "minimal", "none" (disable)
+ # Providers with bespoke thinking tiers (a relay serving fast/thinking): use the
+ # dict form and the level is sent verbatim. Bare strings stay strict (typo guard).
+ # reasoning_effort:
+ # enabled: true
+ # effort: thinking
reasoning_effort: "medium"
# Per-model reasoning effort overrides (optional dict)
# Key: any sensible model spelling works (exact, dots↔dashes interchangeable,
# provider prefix optional). First match wins.
- # Value: reasoning effort level (same options as reasoning_effort)
+ # Value: reasoning effort level (same options as reasoning_effort, dict form included)
# Override the global reasoning_effort for that specific model.
# NOTE: no `hermes config set` support for this key -- edit YAML directly.
# reasoning_overrides:
diff --git a/hermes_constants.py b/hermes_constants.py
index df35569ac1d..d0536b6f927 100644
--- a/hermes_constants.py
+++ b/hermes_constants.py
@@ -971,9 +971,20 @@ def parse_reasoning_effort(effort) -> dict | None:
``None`` for empty/unrecognized input (caller uses the default); ``{"enabled": False}`` for
"none"/"false"/"disabled"/YAML False — ``reasoning_effort: false`` must mean disabled.
+
+ The dict form ``{"enabled": true, "effort": "<level>"}`` passes ``effort`` through verbatim so
+ providers with bespoke thinking tiers (``fast``/``thinking`` relays) can be asked for their real
+ level; bare strings stay strict so a typo like ``hgih`` never reaches the wire. The wire layer
+ already tolerates unknown names (``agent.reasoning_effort.clamp_effort``).
"""
if effort is None or effort is True:
return None
+ if isinstance(effort, dict):
+ if effort.get("enabled", True) is False:
+ return {"enabled": False}
+ # ``or ""``: a falsy effort (0/False) is "no level", never the string "0" on the wire.
+ level = str(effort.get("effort") or "").strip()
+ return {"enabled": True, "effort": level} if level else None
effort = str(effort).strip().lower() # False -> "false" -> disabled; "" matches neither set
if effort in {"none", "false", "disabled"}:
return {"enabled": False}
diff --git a/tests/test_hermes_constants.py b/tests/test_hermes_constants.py
index 97b86b24baf..9de605fb014 100644
--- a/tests/test_hermes_constants.py
+++ b/tests/test_hermes_constants.py
@@ -574,6 +574,23 @@ class TestResolveReasoningConfig:
cfg = self._cfg(effort="medium", overrides={"gpt-5": "turbo-max"})
assert resolve_reasoning_config(cfg, "gpt-5") == {"enabled": True, "effort": "medium"}
+ def test_dict_form_passes_bespoke_tier_verbatim_globally_and_per_model(self):
+ """#93238: providers with custom tiers (fast/thinking) need the dict form to send their
+ real level; a bare non-ladder string stays rejected so typos never reach the wire."""
+ from hermes_constants import parse_reasoning_effort, resolve_reasoning_config
+ cfg = self._cfg(effort={"enabled": True, "effort": "thinking"},
+ overrides={"lumo-max": {"enabled": True, "effort": "fast"}})
+ assert resolve_reasoning_config(cfg, "gpt-5") == {"enabled": True, "effort": "thinking"}
+ assert resolve_reasoning_config(cfg, "my-relay/lumo-max") == {"enabled": True, "effort": "fast"}
+ assert parse_reasoning_effort("thinking") is None
+
+ def test_dict_form_disabled_or_empty_effort(self):
+ """enabled:false disables regardless of level; a dict without a level is 'unset'."""
+ from hermes_constants import parse_reasoning_effort
+ assert parse_reasoning_effort({"enabled": False, "effort": "low"}) == {"enabled": False}
+ assert parse_reasoning_effort({"enabled": True}) is None
+ assert parse_reasoning_effort({"effort": 0}) is None
+
class TestReasoningOverridesDefaultConfig:
"""Tests for the agent.reasoning_overrides default config key (Task 2)."""
diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.md
index f1fb6d7a1ff..48c73d7eb68 100644
--- a/website/docs/user-guide/configuration.md
+++ b/website/docs/user-guide/configuration.md
@@ -1821,6 +1821,23 @@ The key matching is **spelling-tolerant** — any reasonable spelling will match
- A key prefixed with a named custom provider (`ollama-local/qwen3.6:27b-q4_k_m`) also applies when the request carries only the bare model id (`qwen3.6:27b-q4_k_m`), which is what fallback entries and `providers:` routes send
- Exact matches take precedence over variants
+#### Custom reasoning tier names
+
+Some OpenAI-compatible endpoints expose thinking tiers outside the standard ladder (a relay serving `fast`/`thinking` instead of `low`…`max`). A bare string outside the ladder is rejected with `Unknown reasoning_effort '<value>', using default (medium)` so a typo can never reach the wire. To request a provider's own tier name, use the explicit dict form — the `effort` value is sent verbatim as the top-level `reasoning_effort` field:
+
+```yaml
+agent:
+ reasoning_effort:
+ enabled: true
+ effort: thinking # sent as-is
+ reasoning_overrides:
+ "my-relay/lumo-max": # dict form works per model too
+ enabled: true
+ effort: fast
+```
+
+`enabled: false` in the dict form turns thinking off, the same as `reasoning_effort: none`.
+
:::note
Model ids contain dots (`claude-opus-4.5`, `qwen3.6:27b`), which `hermes config set` treats as nesting separators. Escape them with a backslash to write the literal key — `hermes config set 'agent.reasoning_overrides.ollama-local/qwen3\.6:27b-q4_k_m' low` — or edit the YAML directly. See [Dots inside key names](../reference/cli-commands.md#dots-inside-key-names).
:::