The auxiliary client is a centralized subsystem designed to handle LLM invocations for side tasks that are distinct from the primary conversation model. These side tasks include:
The auxiliary client system provides a unified provider resolution chain and client instantiation logic, enabling shared and consistent fallback behavior across different consumers. This shields main agent conversation workloads and their context windows from heavy summarization or specialized processing demands, offloading these to cheaper or task-specialized backends. agent/auxiliary_client.py3-6
It supports a wide variety of providers including OpenRouter, Nous Portal OAuth, local/self-hosted custom endpoints, OpenAI Codex OAuth, native Anthropic, and direct API-key providers such as Google Gemini, Kimi/Moonshot, and MiniMax. The system also handles transparent payment/credit exhaustion fallbacks by retrying with the next available provider. agent/auxiliary_client.py36-41
Sources: agent/auxiliary_client.py1-41 agent/auxiliary_client.py131-160
The auxiliary client provides a centralized provider routing and fallback system. Instead of each tool implementing its own provider and credential resolution, this system allows all auxiliary consumers to reuse a common resolution chain which selects the best available backend per task type and configured overrides.
This centralized routing enables:
config.yaml under the auxiliary: section (e.g., auxiliary.vision.provider, auxiliary.compression.model). agent/auxiliary_client.py32-34Auxiliary tasks specify their provider and model via configuration. The client employs the following steps for resolution:
_resolve_task_provider_model. agent/auxiliary_client.py113-132"auto", apply the automatic provider priority chain defined in _resolve_auto(). agent/auxiliary_client.py7-23 agent/auxiliary_client.py22-38resolve_provider_client. agent/auxiliary_client.py116-130Sources: agent/auxiliary_client.py7-41 agent/auxiliary_client.py113-132 agent/auxiliary_client.py116-130
The auxiliary client implements resolution chains that attempt the following provider priorities in order for text tasks:
| Priority | Provider | Credential / Config Source | Notes |
|---|---|---|---|
| 1 | Main Provider | _read_main_provider() | Uses the user's primary agent model/provider. agent/auxiliary_client.py8-9 |
| 2 | OpenRouter | OPENROUTER_API_KEY | Aggregated cloud API provider. agent/auxiliary_client.py10 |
| 3 | Nous Portal | ~/.hermes/auth.json | OAuth authentication via Nous Research. agent/auxiliary_client.py11 |
| 4 | Custom Endpoint | OPENAI_BASE_URL + OPENAI_API_KEY | For local/self-hosted endpoints. agent/auxiliary_client.py12 |
| 5 | Native Anthropic | ANTHROPIC_API_KEY | Direct SDK integration. agent/auxiliary_client.py13 |
| 6 | Direct API Key | z.ai, Kimi, MiniMax keys | Direct integration for specific families. agent/auxiliary_client.py14 |
Vision/Multimodal task provider resolution prioritize supported vision backends like OpenRouter, Nous Portal, and Native Anthropic. agent/auxiliary_client.py17-23
Sources: agent/auxiliary_client.py7-15 agent/auxiliary_client.py113-132
Hermes Agent includes a native adapter for Anthropic's Messages API in agent/anthropic_adapter.py. This adapter translates Hermes's internal OpenAI-style message format to Anthropic's message schema. agent/anthropic_adapter.py1-11
Highlights:
reasoning_effort levels to Anthropic's output_config.effort via THINKING_BUDGET and ADAPTIVE_EFFORT_MAP. agent/anthropic_adapter.py58-74_get_anthropic_max_output(). For example, claude-opus-4-8 is capped at 128,000 tokens. agent/anthropic_adapter.py126-150sk-ant-api*), OAuth setup-tokens (sk-ant-oat*), and Claude Code credentials. agent/anthropic_adapter.py7-11Sources: agent/anthropic_adapter.py58-74 agent/anthropic_adapter.py126-150 agent/anthropic_adapter.py179-182
For users authenticated via the OpenAI Codex OAuth flow, Hermes implements a shim to convert OpenAI-style chat completion requests into the Codex Responses API JSON format. This is handled by the _CodexCompletionsAdapter class in agent/auxiliary_client.py. agent/auxiliary_client.py25-30
Operation highlights:
chat/completions requests to the Codex transport. agent/auxiliary_client.py25-30_resolve_auto() chain. agent/auxiliary_client.py10-15Sources: agent/auxiliary_client.py25-30 agent/auxiliary_client.py10-15
Credential management and runtime provider instantiation leverage the CredentialPool and ProviderProfile systems:
_normalize_aux_provider() maps aliases like google to gemini or claude to anthropic to ensure consistent resolution. agent/auxiliary_client.py28-38CredentialPool to find valid, non-expired credentials for the target task. agent/credential_pool.py1-15resolve_provider() in hermes_cli/auth.py picks the active provider via a priority chain. hermes_cli/auth.py31-39When an auxiliary LLM call returns an HTTP 402 Payment Required or a credit exhaustion error, the system automatically retries with the next candidate provider in the auto-detection order via _try_payment_fallback(). agent/auxiliary_client.py36-41
Sources: agent/auxiliary_client.py36-41 hermes_cli/auth.py31-39
| Natural Language Task | Code Function / Class | Backend Implementation (Code File) |
|---|---|---|
| Auxiliary Routing | resolve_provider_client() | agent/auxiliary_client.py |
| Auth Chain | _resolve_auto() | agent/auxiliary_client.py |
| Anthropic Adaptation | build_anthropic_client() | agent/anthropic_adapter.py |
| Codex Mapping | _CodexCompletionsAdapter | agent/auxiliary_client.py |
| Credential Management | load_pool() | agent/credential_pool.py |
| Runtime Detection | _detect_api_mode_for_url() | hermes_cli/runtime_provider.py |
Sources: agent/auxiliary_client.py1-41 agent/anthropic_adapter.py1-11 hermes_cli/runtime_provider.py101-139
Refresh this wiki
This wiki was recently refreshed. Please wait 3 days to refresh again.