hermes-agent/agent
Teknium da02a4e283
fix: auxiliary client payment fallback — retry with next provider on 402 (#5599)
When a user runs out of OpenRouter credits and switches to Codex (or any
other provider), auxiliary tasks (compression, vision, web_extract) would
still try OpenRouter first and fail with 402.  Two fixes:

1. Payment fallback in call_llm(): When a resolved provider returns HTTP 402
   or a credit-related error, automatically retry with the next available
   provider in the auto-detection chain.  Skips the depleted provider and
   tries Nous → Custom → Codex → API-key providers.

2. Remove hardcoded OpenRouter fallback: The old code fell back specifically
   to OpenRouter when auto/custom resolution returned no client.  Now falls
   back to the full auto-detection chain, which handles any available
   provider — not just OpenRouter.

Also extracts _get_provider_chain() as a shared function (replaces inline
tuple in _resolve_auto and the new fallback), built at call time so test
patches on _try_* functions remain visible.

Adds 16 tests covering _is_payment_error(), _get_provider_chain(),
_try_payment_fallback(), and call_llm() integration with 402 retry.
2026-04-06 12:41:40 -07:00
..
__init__.py Refactor Terminal and AIAgent cleanup 2026-02-21 22:31:43 -08:00
anthropic_adapter.py fix: preserve Anthropic thinking block signatures across tool-use turns 2026-04-02 10:30:32 -07:00
auxiliary_client.py fix: auxiliary client payment fallback — retry with next provider on 402 (#5599) 2026-04-06 12:41:40 -07:00
builtin_memory_provider.py feat(memory): pluggable memory provider interface with profile isolation, review fixes, and honcho CLI restoration (#4623) 2026-04-02 15:33:51 -07:00
context_compressor.py fix: cap percentage displays at 100% in stats, gateway, and memory tool (#3599) 2026-03-28 14:55:18 -07:00
context_references.py fix(security): add .config/gh to read protection for @file references (#4327) 2026-03-31 12:48:30 -07:00
copilot_acp_client.py fix: bridge tool-calls in copilot-acp adapter 2026-04-06 01:47:57 -07:00
credential_pool.py feat: centralized logging, instrumentation, hermes logs CLI, gateway noise fix (#5430) 2026-04-06 00:08:20 -07:00
display.py feat: add inline diff previews for write actions 2026-04-01 02:13:57 -07:00
insights.py fix(insights): show cache tokens in overview so total adds up (#4428) 2026-04-01 03:06:47 -07:00
memory_manager.py fix: mem0 API v2 compat, prefetch context fencing, secret redaction (#5423) 2026-04-05 22:43:33 -07:00
memory_provider.py feat(memory): pluggable memory provider interface with profile isolation, review fixes, and honcho CLI restoration (#4623) 2026-04-02 15:33:51 -07:00
model_metadata.py fix: update Gemini model catalog + wire models.dev as live model source 2026-04-06 10:28:03 -07:00
models_dev.py fix: update Gemini model catalog + wire models.dev as live model source 2026-04-06 10:28:03 -07:00
prompt_builder.py feat: add grok to TOOL_USE_ENFORCEMENT_MODELS for direct xAI usage (#5595) 2026-04-06 11:22:07 -07:00
prompt_caching.py fix(prompt-caching): skip top-level cache_control on role:tool for OpenRouter 2026-03-21 16:54:43 -07:00
redact.py fix: mem0 API v2 compat, prefetch context fencing, secret redaction (#5423) 2026-04-05 22:43:33 -07:00
skill_commands.py fix: sanitize Telegram command names to strip invalid characters 2026-04-06 11:27:28 -07:00
skill_utils.py fix: respect per-platform disabled skills in Telegram menu and gateway dispatch (#4799) 2026-04-03 10:10:53 -07:00
smart_model_routing.py Merge branch 'main' into rewbs/tool-use-charge-to-subscription 2026-04-02 11:00:35 +11:00
subdirectory_hints.py feat: progressive subdirectory hint discovery (#5291) 2026-04-05 12:33:47 -07:00
title_generator.py feat(agent): configurable timeouts for auxiliary LLM calls via config.yaml (#3597) 2026-03-28 14:35:28 -07:00
trajectory.py Refactor Terminal and AIAgent cleanup 2026-02-21 22:31:43 -08:00
usage_pricing.py fix: status bar shows 26K instead of 260K for token counts with trailing zeros (#3024) 2026-03-25 12:45:58 -07:00