mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-27 01:11:40 +00:00
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. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_auxiliary_client.py | ||
| test_context_compressor.py | ||
| test_display_emoji.py | ||
| test_external_skills.py | ||
| test_memory_plugin_e2e.py | ||
| test_memory_provider.py | ||
| test_model_metadata.py | ||
| test_models_dev.py | ||
| test_prompt_builder.py | ||
| test_prompt_caching.py | ||
| test_redact.py | ||
| test_skill_commands.py | ||
| test_smart_model_routing.py | ||
| test_subagent_progress.py | ||
| test_subdirectory_hints.py | ||
| test_title_generator.py | ||
| test_usage_pricing.py | ||