diff --git a/tests/agent/test_nous_portal_anthropic_wire.py b/tests/agent/test_nous_portal_anthropic_wire.py index 8d3b941970..6172ba4134 100644 --- a/tests/agent/test_nous_portal_anthropic_wire.py +++ b/tests/agent/test_nous_portal_anthropic_wire.py @@ -144,7 +144,7 @@ class TestPoolRuntimeResolution: def _pool(self, entry): return SimpleNamespace( has_credentials=lambda: True, - select=lambda: entry, + select=lambda **_kw: entry, ) @pytest.fixture diff --git a/tests/hermes_cli/test_copilot_runtime_api_mode.py b/tests/hermes_cli/test_copilot_runtime_api_mode.py index 2a724fec2d..27c0914a2b 100644 --- a/tests/hermes_cli/test_copilot_runtime_api_mode.py +++ b/tests/hermes_cli/test_copilot_runtime_api_mode.py @@ -82,7 +82,7 @@ def test_resolver_routes_copilot_by_target_model_for_every_credential_path( ) pool = SimpleNamespace( has_credentials=lambda: True, - select=lambda: entry, + select=lambda **_kw: entry, ) monkeypatch.setattr(rp, "load_pool", lambda _provider: pool) elif credential_source == "explicit": diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/credential-pools.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/credential-pools.md index d232f43506..9e0c79e390 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/credential-pools.md +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/credential-pools.md @@ -139,6 +139,8 @@ credential_pool_strategies: `has_retried_429` 标志在每次成功的 API 调用后重置,因此单次瞬时 429 不会触发轮换。 +**Anthropic 的 429 按模型计算。** Anthropic 按模型执行速率限制,因此某个 Claude 模型的通用 429 只会让该凭证对*该模型*冷却——同一密钥仍可继续服务其他 Claude 模型;计费(`402`、用量上限)和认证(`401`)失败仍会冷却整个凭证。 + ## 自定义端点池 自定义 OpenAI 兼容端点(Together.ai、RunPod、本地服务器)拥有各自的池,以 `config.yaml` 中 `custom_providers` 的端点名称作为键。 @@ -202,7 +204,7 @@ Hermes 在启动时自动从多个来源发现凭证并初始化池: 凭证池集成于提供商解析层: -1. **`agent/credential_pool.py`** — 池管理器:存储、选择、轮换、冷却时间 +1. **`agent/credential_pool.py`** — 池管理器:存储、选择、轮换、冷却时间;**`agent/credential_pool_model_cooldowns.py`** 负责 Anthropic 按模型的 429 冷却 2. **`hermes_cli/auth_commands.py`** — CLI 命令和交互式向导 3. **`hermes_cli/runtime_provider.py`** — 感知池的凭证解析 4. **`run_agent.py`** — 错误恢复:429/402/401 → 池轮换 → 备用