# NousResearch/hermes-agent · Configurable fallback provider chains for auxiliary model tasks

## Open now

- 0 issues, 1 PR open on GitHub.
- PR #129725: feat(tts): opt-in provider fallback chain (tts.fallback_chain)

Most members propose or implement configurable per-task fallback providers or chains for auxiliary models (e.g. vision, TTS, web_extract, compression), including a consolidation proposal. One member concerns fallback on auth errors in auto mode, and another mentions a capacity-error gate fix.

## TL;DR

- 11 member(s): 0 open issue(s), 6 closed issue(s), 1 open PR(s), 1 merged PR(s), 3 PR(s) closed without merging.
- A fix was merged to main in PR #27625. Verify it addresses your case.
- **Recommended:** read PR #27625 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `partially_resolved` · deciding PR(s): `pr-27625`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_PARTIAL`): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
- Members outside that structural core may belong to a different underlying problem.
- Pairwise link density `0.17`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #17067: feat: fallback models for auxiliary/web_extract
- #22201: Per-auxiliary fallback_providers for independent task resilience
- #26882: \[Feature\] Configurable fallback chains for auxiliary tasks
- #27298: feat: General per-task fallback chains for ALL auxiliary models (vision, compression, STT, summarization, etc.)
- #32408: Proposal: consolidate ~12 auxiliary fallback PRs into per-task fallback_providers
- #51814: Feature Request: Fallback providers for auxiliary model slots

## Prior & competing PRs

- **#27625: feat(auxiliary): layered fallback (chain → main agent) + capacity-error gate fix**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `agent/auxiliary_client.py`, `scripts/release.py`, `tests/agent/test_auxiliary_client.py`, `website/docs/user-guide/features/fallback-providers.md`
  - fix hunks:
  - `agent/auxiliary_client.py`

    ```diff
    @@ -2087,7 +2087,13 @@ def _is_payment_error(exc: Exception) -> bool:
         """Detect payment/credit/quota exhaustion errors.
     
         Returns True for HTTP 402 (Payment Required) and for 429/other errors
    -    whose message indicates billing exhaustion rather than rate limiting.
    +    whose message indicates billing exhaustion or daily quota exhaustion
    +    rather than transient rate limiting.
    +
    +    Daily token quota errors (e.g. Bedrock "Too many tokens per day",
    +    Vertex AI "quota exceeded") are functionally equivalent to credit
    +    exhaustion — the provider cannot serve the request until the quota
    +    resets — and should trigger the same provider-fallback logic.
         """
         status = getattr(exc, "status_code", None)
         if status == 402:
    ```

    ```diff
    @@ -2095,10 +2101,19 @@ def _is_payment_error(exc: Exception) -> bool:
         err_lower = str(exc).lower()
         # OpenRouter and other providers include "credits" or "afford" in 402 bodies,
         # but sometimes wrap them in 429 or other codes.
    +    # Daily quota exhaustion from Bedrock, Vertex AI, and similar providers
    +    # uses different language but is semantically identical to credit exhaustion.
         if status in {402, 429, None}:
    -        if any(kw in err_lower for kw in ("credits", "insufficient funds",
    -                                           "can only afford", "billing",
    -                                           "payment required")):
    +        if any(kw in err_lower for kw in (
    +            "credits", "insufficient funds",
    +            "can only afford", "billing",
    +            "payment required",
    +            # Daily / monthly quota exhaustion keywords
    +            "quota exceeded", "quota_exceeded",
    +            "too many tokens per day", "daily limit",
    +            "tokens per day", "daily quota",
    +            "resource exhausted",  # Vertex AI / gRPC quota errors
    +        )):
                 return True
         return False
     
    ```

    ```diff
    @@ -2579,6 +2594,133 @@ def _try_payment_fallback(
         return None, None, ""
     
     
    +def _try_main_agent_model_fallback(
    +    failed_provider: str,
    +    task: str = None,
    +    reason: str = "error",
    +) -> Tuple[Optional[Any], Optional[str], str]:
    +    """Last-resort fallback to the user's main agent provider + model.
    +
    +    Used after the configured fallback_chain is exhausted (or empty) for
    +    users with an explicit auxiliary provider.  This is the "safety net"
    +    layer: if nothing the user asked for can serve the request, try the
    +    main chat model before giving up.
    +
    +    Skips when the failed provider already IS the main provider (no point
    +    retrying the same backend that just failed).
    +
    +    Returns:
    +        (client, model, provider_label) or (None, None, "") if no fallback.
    +    """
    +    main_provider = (_read_main_provider() or "").strip()
    +    main_model = (_read_main_model() or "").strip()
    +    if not main_provider or not main_model or main_provider.lower() in {"auto", ""}:
    +        return None, None, ""
    +
    +    skip = (failed_provider or "").lower().strip()
    +    if main_provider.lower() == skip:
    +        # The thing that failed IS the main model — nothing to fall back to.
    +        return None, None, ""
    +    if _is_provider_unhealthy(main_provider):
    +        _log_skip_unhealthy(main_provider, task)
    +        return None, None, ""
    +
    +    try:
    +        client, resolved_model = resolve_provider_client(
    +            provider=main_provider, model=main_model,
    +        )
    +    except Exception:
    +        client, resolved_model = None, None
    +
    +    if client is None:
    +        return None, None, ""
    +
    +    label = f"main-agent({main_provider})"
    +    logger.info(
    +        "Auxiliary %s: %s on %s — falling back to main agent model %s (%s)",
    +        task or "call", reason, failed_provider, label, resolved_model or main_model,
    +    )
    +    return client, resolved_model or main_model, label
    +
    +
    +def _try_configured_fallback_chain(
    +    task: str,
    +    failed_provider: str,
    +    reason: str = "error",
    +) -> Tuple[Optional[Any], Optional[str], str]:
    +    """Try user-configured fallback_chain for a specific auxiliary task.
    +
    +    Reads auxiliary.<task>.fallback_chain from config.yaml and tries each
    +    entry in order.  Each entry must have at least ``provider``; ``model``,
    +    ``base_url``, and ``api_key`` are optional.
    +
    +    Returns:
    +        (client, model, provider_label) or (None, None, "") if no fallback.
    +    """
    +    if not task:
    +        return None, None, ""
    +
    +    task_config = _get_auxiliary_task_config(task)
    +    chain = task_config.get("fallback_chain")
    +    if not chain or not isinstance(chain, list):
    +        return None, None, ""
    +
    +    skip = failed_provider.lower().strip()
    +    tried = []
    +
    +    for i, entry in enumerate(chain):
    +        if not isinstance(entry, dict):
    +            continue
    +        fb_provider = str(entry.get("provider", "")).strip()
    +        if not fb_provider or fb_provider.lower() == skip:
    +            continue
    +        fb_model = str(entry.get("model", "")).strip() or None
    +        fb_base_url = str(entry.get("base_url", "")).strip() or None
    +        fb_api_key = [redacted:secret-assignment]"api_key", "")).strip() or None
    +
    +        label = f"fallback_chain[{i}]({fb_provider})"
    +
    +        try:
    +            fb_client = _resolve_single_provider(
    +                fb_provider, fb_model, fb_base_url, fb_api_key)
    +        except Exception:
    +            fb_client = None
    +
    +        if fb_client is not None:
    +            logger.info(
    +                "Auxiliary %s: %s on %s — configured fallback to %s (%s)",
    +                task, reason, failed_provider, label, fb_model or "default",
    +            )
    +            return fb_client, fb_model, label
    +        tried.append(label)
    +
    +    if tried:
    +        logger.debug(
    +            "Auxiliary %s: configured fallback_chain exhausted (tried: %s)",
    +            task, ", ".join(tried),
    +        )
    +    return None, None, ""
    +
    +
    +def _resolve_single_provider(
    +    provider: str,
    +    model: Optional[str] = None,
    +    base_url: Optional[str] = None,
    +    api_key: [redacted:secret-assignment] = None,
    +) -> Optional[Any]:
    +    """Resolve a single provider entry from fallback_chain to an OpenAI client.
    +
    +    Uses the existing provider resolution infrastructure where possible.
    +    """
    +    # Reuse resolve_provider_client which handles provider→client mapping
    +    client, resolved_model = resolve_provider_client(
    +        provider=provider,
    +        model=model,
    +        base_url=base_url,
    +        api_key=[redacted:secret-assignment]
    +    )
    +    return client
    +
     def _resolve_auto(main_runtime: Optional[Dict[str, Any]] = None) -> Tuple[Optional[OpenAI], Optional[str]]:
         """Full auto-detection chain.
     
    ```

    ```diff
    @@ -4526,11 +4668,17 @@ def call_llm(
                 or _is_connection_error(first_err)
                 or _is_rate_limit_error(first_err)
             )
    -        # Only try alternative providers when the user didn't explicitly
    -        # configure this task's provider.  Explicit provider = hard constraint;
    -        # auto (the default) = best-effort fallback chain.  (#7559)
    +        # Respect explicit provider choice for transient errors (auth, request
    +        # validation, etc.) but allow fallback when the provider clearly cannot
    +        # serve the request due to capacity: payment/quota exhaustion and
    +        # connection failures are capacity problems, not request constraints.
    +        # See #26803: daily token quota (429 + "too many tokens per day") must
    +        # fall back just like a 402 credit error.
             is_auto = resolved_provider in {"auto", "", None}
    -        if should_fallback and is_auto:
    +        # Capacity errors bypass the explicit-provider gate: the provider
    +        # literally cannot serve this request regardless of user intent.
    +        is_capacity_error = _is_payment_error(first_err) or _is_connection_error(first_err)
    +        if should_fallback and (is_auto or is_capacity_error):
                 if _is_payment_error(first_err):
                     reason = "payment error"
                     # Resolve the actual provider label (resolved_provider may be
    ```

    ```diff
    @@ -4546,8 +4694,24 @@ def call_llm(
                     reason = "connection error"
                 logger.info("Auxiliary %s: %s on %s (%s), trying fallback",
                             task or "call", reason, resolved_provider, first_err)
    -            fb_client, fb_model, fb_label = _try_payment_fallback(
    -                resolved_provider, task, reason=reason)
    +
    +            # Fallback order (#26882, #26803):
    +            #   1. User-configured fallback_chain (per-task) if set
    +            #   2. Main agent model (last-resort safety net)
    +            # For auto users (no explicit aux provider), use the full
    +            # auto-detection chain instead — its Step 1 IS the main agent
    +            # model, so users on `auto` already get main-model fallback.
    +            fb_client, fb_model, fb_label = (None, None, "")
    +            if is_auto:
    +                fb_client, fb_model, fb_label = _try_payment_fallback(
    +                    resolved_provider, task, reason=reason)
    +            else:
    +                fb_client, fb_model, fb_label = _try_configured_fallback_chain(
    +                    task, resolved_provider or "auto", reason=reason)
    +                if fb_client is None:
    +                    fb_client, fb_model, fb_label = _try_main_agent_model_fallback(
    +                        resolved_provider, task, reason=reason)
    +
                 if fb_client is not None:
                     fb_kwargs = _build_call_kwargs(
                         fb_label, fb_model, messages,
    ```

    ```diff
    @@ -4557,6 +4721,14 @@ def call_llm(
                         base_url=str(getattr(fb_client, "base_url", "") or ""))
                     return _validate_llm_response(
                         fb_client.chat.completions.create(**fb_kwargs), task)
    +            # All fallback layers exhausted — emit a single user-visible
    +            # warning so the operator knows aux task is about to fail.
    +            # (#26882) The error itself is re-raised below.
    +            logger.warning(
    +                "Auxiliary %s: %s on %s and all fallbacks exhausted "
    +                "(fallback_chain + main agent model). Raising original error.",
    +                task or "call", reason, resolved_provider,
    +            )
             # Connection/timeout errors leave the cached client poisoned (closed
             # httpx transport, half-read stream, dead async loop).  Drop it from
             # the cache regardless of whether we found a fallback above so the
    ```

    ```diff
    @@ -4858,8 +5030,12 @@ async def async_call_llm(
                 or _is_connection_error(first_err)
                 or _is_rate_limit_error(first_err)
             )
    +        # Capacity errors (payment/quota/connection) bypass the explicit-provider
    +        # gate — the provider cannot serve the request regardless of user intent.
    +        # See #26803: daily token quota must fall back like a 402 credit error.
             is_auto = resolved_provider in {"auto", "", None}
    -        if should_fallback and is_auto:
    +        is_capacity_error = _is_payment_error(first_err) or _is_connection_error(first_err)
    +        if should_fallback and (is_auto or is_capacity_error):
                 if _is_payment_error(first_err):
                     reason = "payment error"
                     _mark_provider_unhealthy(
    ```

    ```diff
    @@ -4871,8 +5047,23 @@ async def async_call_llm(
                     reason = "connection error"
                 logger.info("Auxiliary %s (async): %s on %s (%s), trying fallback",
                             task or "call", reason, resolved_provider, first_err)
    -            fb_client, fb_model, fb_label = _try_payment_fallback(
    -                resolved_provider, task, reason=reason)
    +
    +            # Fallback order (#26882, #26803):
    +            #   1. User-configured fallback_chain (per-task) if set
    +            #   2. Main agent model (last-resort safety net)
    +            # Auto users get the full auto-detection chain instead — its
    +            # Step 1 IS the main agent model.
    +            fb_client, fb_model, fb_label = (None, None, "")
    +            if is_auto:
    +                fb_client, fb_model, fb_label = _try_payment_fallback(
    +                    resolved_provider, task, reason=reason)
    +            else:
    +                fb_client, fb_model, fb_label = _try_configured_fallback_chain(
    +                    task, resolved_provider or "auto", reason=reason)
    +                if fb_client is None:
    +                    fb_client, fb_model, fb_label = _try_main_agent_model_fallback(
    +                        resolved_provider, task, reason=reason)
    +
                 if fb_client is not None:
                     fb_kwargs = _build_call_kwargs(
                         fb_label, fb_model, messages,
    ```

    ```diff
    @@ -4888,6 +5079,12 @@ async def async_call_llm(
                         fb_kwargs["model"] = async_fb_model
                     return _validate_llm_response(
                         await async_fb.chat.completions.create(**fb_kwargs), task)
    +            # All fallback layers exhausted — warn before re-raising. (#26882)
    +            logger.warning(
    +                "Auxiliary %s (async): %s on %s and all fallbacks exhausted "
    +                "(fallback_chain + main agent model). Raising original error.",
    +                task or "call", reason, resolved_provider,
    +            )
             # Mirror the sync path: drop poisoned clients on connection/timeout
             # so the next aux call rebuilds.  See issue #23432.
             if _is_connection_error(first_err):
    ```
  - `scripts/release.py`

    ```diff
    @@ -184,6 +184,7 @@
         "[redacted:email]": "npmisantosh",
         "39641663+luarss@users.noreply.github.com": "luarss",
         "16263913+zccyman@users.noreply.github.com": "zccyman",
    +    "zccyman@users.noreply.github.com": "zccyman",  # PR #26998 (auxiliary fallback chain)
         "[redacted:email]": "Osraka",
         "98612432+Osraka@users.noreply.github.com": "Osraka",
         "112634774+ryptotalent@users.noreply.github.com": "ryptotalent",
    ```
  - `tests/agent/test_auxiliary_client.py`

    ```diff
    @@ -923,6 +923,44 @@ def test_no_status_code_no_message(self):
             exc = Exception("connection reset")
             assert _is_payment_error(exc) is False
     
    +    # ── Daily / monthly quota exhaustion (#26803) ────────────────────────────
    +
    +    def test_429_quota_exceeded(self):
    +        """Cloud provider quota exhaustion (e.g. Vertex AI) is a payment error."""
    +        exc = Exception("RESOURCE_EXHAUSTED: quota exceeded for project")
    +        exc.status_code = 429
    +        assert _is_payment_error(exc) is True
    +
    +    def test_429_too_many_tokens_per_day(self):
    +        """Bedrock / LiteLLM daily token limit is a payment error."""
    +        exc = Exception("Too many tokens per day: 1000000 used, 1000000 limit")
    +        exc.status_code = 429
    +        assert _is_payment_error(exc) is True
    +
    +    def test_429_daily_limit_phrase(self):
    +        """Generic 'daily limit' phrasing is a payment error."""
    +        exc = Exception("You have exceeded your daily limit.")
    +        exc.status_code = 429
    +        assert _is_payment_error(exc) is True
    +
    +    def test_429_resource_exhausted_grpc(self):
    +        """Vertex AI gRPC RESOURCE_EXHAUSTED maps to payment error."""
    +        exc = Exception("resource exhausted")
    +        exc.status_code = 429
    +        assert _is_payment_error(exc) is True
    +
    +    def test_429_daily_quota_phrase(self):
    +        """'daily quota' phrasing is a payment error."""
    +        exc = Exception("Daily quota of 500 requests reached.")
    +        exc.status_code = 429
    +        assert _is_payment_error(exc) is True
    +
    +    def test_429_transient_rate_limit_not_quota(self):
    +        """Transient 429 rate limit without quota keywords is NOT a payment error."""
    +        exc = Exception("Rate limit exceeded. Retry after 10s.")
    +        exc.status_code = 429
    +        assert _is_payment_error(exc) is False
    +
     
     class TestIsRateLimitError:
         """_is_rate_limit_error detects 429 rate-limit errors warranting fallback."""
    ```

    ```diff
    @@ -1111,6 +1149,140 @@ def test_429_rate_limit_triggers_fallback(self, monkeypatch):
             # Fallback client should have been used
             assert fallback_client.chat.completions.create.called
     
    +
    +class TestAuxiliaryFallbackLayering:
    +    """Explicit-provider users get layered fallback: configured_chain → main agent → warn."""
    +
    +    def _make_payment_err(self):
    +        exc = Exception("Payment Required: insufficient credits")
    +        exc.status_code = 402
    +        return exc
    +
    +    def test_explicit_provider_uses_configured_chain_first(self, monkeypatch, caplog):
    +        """When a user has fallback_chain configured, it's tried BEFORE the main agent model."""
    +        monkeypatch.setenv("OPENROUTER_API_KEY", "or-key")
    +
    +        primary_client = MagicMock()
    +        primary_client.chat.completions.create.side_effect = self._make_payment_err()
    +
    +        chain_client = MagicMock()
    +        chain_client.chat.completions.create.return_value = MagicMock(choices=[
    +            MagicMock(message=MagicMock(content="from configured chain"))
    +        ])
    +
    +        main_called = MagicMock()
    +
    +        with patch("agent.auxiliary_client._get_cached_client",
    +                   return_value=(primary_client, "glm-4v-flash")), \
    +             patch("agent.auxiliary_client._resolve_task_provider_model",
    +                   return_value=("glm", "glm-4v-flash", None, None, None)), \
    +             patch("agent.auxiliary_client._try_configured_fallback_chain",
    +                   return_value=(chain_client, "gpt-4o-mini", "fallback_chain[0](openai)")), \
    +             patch("agent.auxiliary_client._try_main_agent_model_fallback",
    +                   side_effect=main_called):
    +            result = call_llm(
    +                task="vision",
    +                messages=[{"role": "user", "content": "hello"}],
    +            )
    +
    +        assert chain_client.chat.completions.create.called
    +        # Main agent fallback should NOT have been consulted — chain succeeded first
    +        main_called.assert_not_called()
    +
    +    def test_explicit_provider_falls_back_to_main_when_chain_exhausted(self, monkeypatch):
    +        """If configured fallback_chain returns nothing, main agent model is tried next."""
    +        monkeypatch.setenv("OPENROUTER_API_KEY", "or-key")
    +
    +        primary_client = MagicMock()
    +        primary_client.chat.completions.create.side_effect = self._make_payment_err()
    +
    +        main_client = MagicMock()
    +        main_client.chat.completions.create.return_value = MagicMock(choices=[
    +            MagicMock(message=MagicMock(content="from main agent"))
    +        ])
    +
    +        with patch("agent.auxiliary_client._get_cached_client",
    +                   return_value=(primary_client, "glm-4v-flash")), \
    +             patch("agent.auxiliary_client._resolve_task_provider_model",
    +                   return_value=("glm", "glm-4v-flash", None, None, None)), \
    +             patch("agent.auxiliary_client._try_configured_fallback_chain",
    +                   return_value=(None, None, "")), \
    +             patch("agent.auxiliary_client._try_main_agent_model_fallback",
    +                   return_value=(main_client, "claude-sonnet-4", "main-agent(openrouter)")):
    +            result = call_llm(
    +                task="vision",
    +                messages=[{"role": "user", "content": "hello"}],
    +            )
    +
    +        assert main_client.chat.completions.create.called
    +
    +    def test_warning_emitted_when_all_fallbacks_exhausted(self, monkeypatch, caplog):
    +        """When chain AND main model both fail, a user-visible warning fires before re-raise."""
    +        monkeypatch.setenv("OPENROUTER_API_KEY", "or-key")
    +
    +        primary_client = MagicMock()
    +        primary_client.chat.completions.create.side_effect = self._make_payment_err()
    +
    +        with patch("agent.auxiliary_client._get_cached_client",
    +                   return_value=(primary_client, "glm-4v-flash")), \
    +             patch("agent.auxiliary_client._resolve_task_provider_model",
    +                   return_value=("glm", "glm-4v-flash", None, None, None)), \
    +             patch("agent.auxiliary_client._try_configured_fallback_chain",
    +                   return_value=(None, None, "")), \
    +             patch("agent.auxiliary_client._try_main_agent_model_fallback",
    +                   return_value=(None, None, "")), \
    +             caplog.at_level("WARNING", logger="agent.auxiliary_client"):
    +            with pytest.raises(Exception, match="Payment Required"):
    +                call_llm(
    +                    task="vision",
    +                    messages=[{"role": "user", "content": "hello"}],
    +                )
    +
    +        assert any(
    +            "all fallbacks exhausted" in r.message for r in caplog.records
    +        ), f"Expected exhaustion warning, got: {[r.message for r in caplog.records]}"
    +
    +
    +class TestTryMainAgentModelFallback:
    +    """_try_main_agent_model_fallback resolves the user's main provider+model as a safety net."""
    +
    +    def test_returns_none_when_main_provider_is_auto(self):
    +        from agent.auxiliary_client import _try_main_agent_model_fallback
    +        with patch("agent.auxiliary_client._read_main_provider", return_value="auto"), \
    +             patch("agent.auxiliary_client._read_main_model", return_value="some-model"):
    +            client, model, label = _try_main_agent_model_fallback("glm", task="vision")
    +        assert client is None and model is None and label == ""
    +
    +    def test_returns_none_when_failed_provider_equals_main(self):
    +        """If the thing that failed IS the main model, no point retrying it."""
    +        from agent.auxiliary_client import _try_main_agent_model_fallback
    +        with patch("agent.auxiliary_client._read_main_provider", return_value="openrouter"), \
    +             patch("agent.auxiliary_client._read_main_model", return_value="anthropic/claude-sonnet-4"):
    +            client, model, label = _try_main_agent_model_fallback("openrouter", task="vision")
    +        assert client is None and label == ""
    +
    +    def test_resolves_main_provider_client(self):
    +        from agent.auxiliary_client import _try_main_agent_model_fallback
    +        fake_client = MagicMock()
    +        with patch("agent.auxiliary_client._read_main_provider", return_value="openrouter"), \
    +             patch("agent.auxiliary_client._read_main_model", return_value="anthropic/claude-sonnet-4"), \
    +             patch("agent.auxiliary_client._is_provider_unhealthy", return_value=False), \
    +             patch("agent.auxiliary_client.resolve_provider_client",
    +                   return_value=(fake_client, "anthropic/claude-sonnet-4")):
    +            client, model, label = _try_main_agent_model_fallback("glm", task="vision")
    +        assert client is fake_client
    +        assert model == "anthropic/claude-sonnet-4"
    +        assert label == "main-agent(openrouter)"
    +
    +    def test_skips_when_main_provider_is_unhealthy(self):
    +        from agent.auxiliary_client import _try_main_agent_model_fallback
    +        with patch("agent.auxiliary_client._read_main_provider", return_value="openrouter"), \
    +             patch("agent.auxiliary_client._read_main_model", return_value="anthropic/claude-sonnet-4"), \
    +             patch("agent.auxiliary_client._is_provider_unhealthy", return_value=True):
    +            client, model, label = _try_main_agent_model_fallback("glm", task="vision")
    +        assert client is None
    +
    +
     # ---------------------------------------------------------------------------
     # Gate: _resolve_api_key_provider must skip anthropic when not configured
     # ---------------------------------------------------------------------------
    ```

    ```diff
    @@ -2349,10 +2521,13 @@ def close(self):
         def test_call_llm_evicts_on_connection_error_with_explicit_provider(self):
             """Connection error on an explicit provider must drop the cached client.
     
    -        This is the exact reporter scenario: ``auxiliary.compression.provider:
    -        main`` (resolves to ``openai-codex``) → no fallback chain runs (not
    -        auto), but the cached client was poisoned by a prior timeout and must
    -        be evicted so the next call rebuilds.
    +        Reporter scenario: ``auxiliary.compression.provider: main`` (resolves
    +        to ``openai-codex``).  After #26803, capacity errors (payment/quota/
    +        connection) DO trigger fallback even on explicit providers — so we
    +        also stub ``_try_payment_fallback`` to ``(None, None, "")`` so the
    +        connection error re-raises after eviction instead of escaping into
    +        a real network call.  The contract under test is cache eviction,
    +        not the fallback gate.
             """
             from agent.auxiliary_client import _client_cache, _client_cache_lock
     
    ```

    ```diff
    @@ -2372,6 +2547,9 @@ def test_call_llm_evicts_on_connection_error_with_explicit_provider(self):
                 ), patch(
                     "agent.auxiliary_client._get_cached_client",
                     return_value=(poisoned, "gpt-5.5"),
    +            ), patch(
    +                "agent.auxiliary_client._try_payment_fallback",
    +                return_value=(None, None, ""),
                 ):
                     with pytest.raises(ConnectionError):
                         call_llm(
    ```

    ```diff
    @@ -2405,6 +2583,9 @@ async def test_async_call_llm_evicts_on_connection_error_with_explicit_provider(
                 ), patch(
                     "agent.auxiliary_client._get_cached_client",
                     return_value=(poisoned, "gpt-5.5"),
    +            ), patch(
    +                "agent.auxiliary_client._try_payment_fallback",
    +                return_value=(None, None, ""),
                 ):
                     with pytest.raises(ConnectionError):
                         await async_call_llm(
    ```
  - `website/docs/user-guide/features/fallback-providers.md`

    ```diff
    @@ -320,6 +320,55 @@ auxiliary:
     
     ---
     
    +## Auxiliary Capacity-Error Fallback
    +
    +When you set an explicit auxiliary provider (e.g. `auxiliary.vision.provider: glm`), Hermes treats that as your preferred choice — but if the provider literally cannot serve the request because of a **capacity error** (HTTP 402 payment required, HTTP 429 daily-quota exhaustion, connection failure), Hermes falls back through a layered chain instead of failing silently:
    +
    +1. **Primary aux provider** — the one you configured (tried first, always)
    +2. **`auxiliary.<task>.fallback_chain`** — your per-task override list, if you wrote one
    +3. **Main agent provider + model** — last-resort safety net (always tried, even if you didn't write a chain)
    +4. **Warn + re-raise** — if every layer fails, Hermes logs `Auxiliary <task>: ... all fallbacks exhausted` at WARNING level and re-raises the original error
    +
    +Transient HTTP 429 rate limits (`Retry-After: ...`) are treated as request constraints, not capacity problems — they respect your explicit provider choice and do **not** trigger the fallback ladder. Only daily/monthly quota exhaustion, payment errors, and connection failures bypass the explicit-provider gate.
    +
    +For users on `provider: auto` (no explicit aux provider), the existing auto-detection chain runs in place of steps 2–3. Its first step is already the main agent model, so `auto` users get the same outcome with zero config.
    +
    +### Optional: per-task fallback chain
    +
    +If you want a different fallback ordering than "main agent model first", configure `fallback_chain` explicitly. Each entry needs at least `provider`; `model`, `base_url`, and `api_key` are optional.
    +
    +```yaml
    +auxiliary:
    +  vision:
    +    provider: glm
    +    model: glm-4v-flash
    +    fallback_chain:
    +      - provider: openrouter
    +        model: google/gemini-3-flash-preview
    +      - provider: nous
    +        model: anthropic/claude-sonnet-4
    +
    +  compression:
    +    provider: openrouter
    +    fallback_chain:
    +      - provider: openai
    +        model: gpt-4o-mini
    +```
    +
    +You do **not** need to configure `fallback_chain` to get fallback — the main-agent safety net runs regardless. Use it only when you specifically want a different order than the default.
    +
    +### Provider quota errors that trigger fallback
    +
    +Hermes recognizes these as capacity-equivalent to 402 credit exhaustion (not transient rate limits):
    +
    +- Bedrock / LiteLLM: `Too many tokens per day`, `daily limit`, `tokens per day`
    +- Vertex AI / GCP: `quota exceeded`, `resource exhausted`, `RESOURCE_EXHAUSTED`
    +- Generic: `daily quota`, `quota_exceeded`
    +
    +If your provider returns a different phrase for daily-quota exhaustion and Hermes doesn't trigger fallback, that's a bug — open an issue with the exact error string.
    +
    +---
    +
     ## Context Compression Fallback
     
     Context compression uses the `auxiliary.compression` config block to control which model and provider handles summarization:
    ```

    ```diff
    @@ -378,14 +427,16 @@ See [Scheduled Tasks (Cron)](/docs/user-guide/features/cron) for full configurat
     | Feature | Fallback Mechanism | Config Location |
     |---------|-------------------|----------------|
     | Main agent model | `fallback_model` in config.yaml — per-turn failover on errors (primary restored each turn) | `fallback_model:` (top-level) |
    -| Vision | Auto-detection chain + internal OpenRouter retry | `auxiliary.vision` |
    -| Web extraction | Auto-detection chain + internal OpenRouter retry | `auxiliary.web_extract` |
    -| Context compression | Auto-detection chain, degrades to no-summary if unavailable | `auxiliary.compression` |
    -| Session search | Auto-detection chain | `auxiliary.session_search` |
    -| Skills hub | Auto-detection chain | `auxiliary.skills_hub` |
    -| MCP helpers | Auto-detection chain | `auxiliary.mcp` |
    -| Approval classification | Auto-detection chain | `auxiliary.approval` |
    -| Title generation | Auto-detection chain | `auxiliary.title_generation` |
    -| Triage specifier | Auto-detection chain | `auxiliary.triage_specifier` |
    +| Auxiliary tasks (any) — auto users | Full auto-detection chain (main agent model first, then provider chain) on capacity errors | `auxiliary.<task>.provider: auto` |
    +| Auxiliary tasks (any) — explicit provider | `fallback_chain` (if set) → main agent model → warn + raise, on capacity errors only | `auxiliary.<task>.fallback_chain` |
    +| Vision | Layered (see above) + internal OpenRouter retry | `auxiliary.vision` |
    +| Web extraction | Layered (see above) + internal OpenRouter retry | `auxiliary.web_extract` |
    +| Context compression | Layered (see above); degrades to no-summary if all layers unavailable | `auxiliary.compression` |
    +| Session search | Layered (see above) | `auxiliary.session_search` |
    +| Skills hub | Layered (see above) | `auxiliary.skills_hub` |
    +| MCP helpers | Layered (see above) | `auxiliary.mcp` |
    +| Approval classification | Layered (see above) | `auxiliary.approval` |
    +| Title generation | Layered (see above) | `auxiliary.title_generation` |
    +| Triage specifier | Layered (see above) | `auxiliary.triage_specifier` |
     | Delegation | Provider override only (no automatic fallback) | `delegation.provider` / `delegation.model` |
     | Cron jobs | Per-job provider override only (no automatic fallback) | Per-job `provider` / `model` |
    ```
- **#21190: fix(auxiliary): fallback on auth errors in auto mode**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `46e18804a`, `#53900`
- **#26998: feat(auxiliary): add configurable fallback chains for auxiliary tasks (#26882)**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `a57424683`, `#27625`, `#26811`
- **#32411: feat(auxiliary): add per-task fallback_providers config for transparent failover**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `6e1bfa4051932b78e76f209747689eb0c90c97e3`
- **#129725: feat(tts): opt-in provider fallback chain (tts.fallback_chain)**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`
  - files: `hermes_cli/config_defaults.py`, `tests/tools/test_tts_fallback_chain.py`, `tools/tts_tool.py`, `website/docs/user-guide/features/tts.md`

## Fix status

- Merged to main in PR #27625 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-05-18`. This confirmation is old and may be out of date (a revert/reopen would not have invalidated it here); re-verify.
- Subsystem: `agent`
- Kind: `feature` (from the open PRs' GitHub type labels).
