# NousResearch/hermes-agent · Fix auxiliary task base_url/api_key ignored with explicit provider

## Open now

- Nothing open on GitHub.

These issues and PRs address a bug where auxiliary task configuration (base_url and api_key) is not honored when a provider is passed explicitly. The fix ensures those settings are respected in that code path.

## TL;DR

- 3 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 1 PR(s) closed without merging.
- A fix was merged to main in PR #59140. Verify it addresses your case.
- **Recommended:** read PR #59140 (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: `resolved` · deciding PR(s): `pr-59140`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.67`: 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

- #58515: _resolve_task_provider_model ignores auxiliary.<task>.base_url when provider passed explicitly

## Prior & competing PRs

- **#59140: fix(agent): honor auxiliary.<task>.base_url/api_key when provider is passed explicitly**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `agent/auxiliary_client.py`, `tests/agent/test_auxiliary_client.py`
  - fix hunks:
  - `agent/auxiliary_client.py`

    ```diff
    @@ -5532,6 +5532,18 @@ def _preserve_provider_with_base_url(prov: Optional[str]) -> bool:
         if cfg_provider:
             cfg_provider, cfg_base_url = _expand_direct_api_alias(cfg_provider, cfg_base_url)
     
    +    # An explicit provider arg without an explicit base_url must not bypass
    +    # the task's configured endpoint: adopt auxiliary.<task>.base_url/api_key
    +    # when the config targets the same provider (or names none), so the
    +    # early `if provider:` return below carries the configured endpoint
    +    # instead of falling through to main-runtime resolution (#58515).
    +    # An explicit "auto" is excluded — it means "inherit / auto-detect" and
    +    # must keep flowing through the existing auto-resolution chain.
    +    if provider and provider != "auto" and not base_url and cfg_base_url and cfg_provider in (None, provider):
    +        base_url = cfg_base_url
    +        if not api_key:
    +            api_key = [redacted:secret-assignment]
    +
         if base_url and _preserve_provider_with_base_url(provider):
             return provider, resolved_model, base_url, api_key, resolved_api_mode
         if base_url:
    ```
  - `tests/agent/test_auxiliary_client.py`

    ```diff
    @@ -168,6 +168,112 @@ def test_direct_openai_alias_with_base_url_still_routes_as_custom(self):
             assert api_key == "sk-test"
             assert api_mode is None
     
    +    def test_explicit_provider_adopts_configured_task_endpoint(self):
    +        """Explicit provider matching the configured one must not bypass
    +        auxiliary.<task>.base_url/api_key (#58515)."""
    +        task_config = {
    +            "provider": "custom",
    +            "model": "meta/llama-3.2-11b-vision-instruct",
    +            "base_url": "https://integrate.api.nvidia.com/v1",
    +            "api_key": "[redacted:secret-assignment]",
    +        }
    +        with patch("agent.auxiliary_client._get_auxiliary_task_config", return_value=task_config):
    +            resolved_provider, model, base_url, api_key, api_mode = _resolve_task_provider_model(
    +                task="vision",
    +                provider="custom",
    +                model="meta/llama-3.2-11b-vision-instruct",
    +            )
    +
    +        assert resolved_provider == "custom"
    +        assert base_url == "https://integrate.api.nvidia.com/v1"
    +        assert api_key == "nvapi-secret"
    +        assert model == "meta/llama-3.2-11b-vision-instruct"
    +        assert api_mode is None
    +
    +    def test_explicit_provider_adopts_endpoint_when_config_names_no_provider(self):
    +        task_config = {
    +            "base_url": "https://nim.example/v1",
    +            "api_key": "[redacted:secret-assignment]",
    +        }
    +        with patch("agent.auxiliary_client._get_auxiliary_task_config", return_value=task_config):
    +            resolved_provider, model, base_url, api_key, api_mode = _resolve_task_provider_model(
    +                task="vision",
    +                provider="custom",
    +            )
    +
    +        assert resolved_provider == "custom"
    +        assert base_url == "https://nim.example/v1"
    +        assert api_key == "cfg-key"
    +
    +    def test_explicit_first_class_provider_with_matching_config_keeps_identity(self):
    +        task_config = {
    +            "provider": "anthropic",
    +            "base_url": "https://anthropic-proxy.example/v1",
    +            "api_key": "[redacted:secret-assignment]",
    +        }
    +        with patch("agent.auxiliary_client._get_auxiliary_task_config", return_value=task_config):
    +            resolved_provider, model, base_url, api_key, api_mode = _resolve_task_provider_model(
    +                task="compression",
    +                provider="anthropic",
    +            )
    +
    +        assert resolved_provider == "anthropic"
    +        assert base_url == "https://anthropic-proxy.example/v1"
    +        assert api_key == "cfg-key"
    +
    +    def test_explicit_auto_provider_keeps_auto_resolution(self):
    +        """provider="auto" is a sentinel for "inherit / auto-detect" and must
    +        not adopt the configured endpoint — the auto chain owns resolution."""
    +        task_config = {
    +            "base_url": "https://nim.example/v1",
    +            "api_key": "[redacted:secret-assignment]",
    +        }
    +        with patch("agent.auxiliary_client._get_auxiliary_task_config", return_value=task_config):
    +            resolved_provider, model, base_url, api_key, api_mode = _resolve_task_provider_model(
    +                task="vision",
    +                provider="auto",
    +            )
    +
    +        assert resolved_provider == "auto"
    +        assert base_url is None
    +        assert api_key is None
    +
    +    def test_explicit_provider_differing_from_config_ignores_config_endpoint(self):
    +        """A caller forcing a different provider keeps full explicit-arg
    +        priority — the configured endpoint belongs to cfg_provider only."""
    +        task_config = {
    +            "provider": "custom",
    +            "base_url": "https://nim.example/v1",
    +            "api_key": "[redacted:secret-assignment]",
    +        }
    +        with patch("agent.auxiliary_client._get_auxiliary_task_config", return_value=task_config):
    +            resolved_provider, model, base_url, api_key, api_mode = _resolve_task_provider_model(
    +                task="vision",
    +                provider="nous",
    +            )
    +
    +        assert resolved_provider == "nous"
    +        assert base_url is None
    +        assert api_key is None
    +
    +    def test_explicit_provider_and_base_url_still_win_over_config(self):
    +        task_config = {
    +            "provider": "custom",
    +            "base_url": "https://configured.example/v1",
    +            "api_key": "[redacted:secret-assignment]",
    +        }
    +        with patch("agent.auxiliary_client._get_auxiliary_task_config", return_value=task_config):
    +            resolved_provider, model, base_url, api_key, api_mode = _resolve_task_provider_model(
    +                task="vision",
    +                provider="custom",
    +                base_url="https://explicit.example/v1",
    +                api_key="[redacted:secret-assignment]",
    +            )
    +
    +        assert resolved_provider == "custom"
    +        assert base_url == "https://explicit.example/v1"
    +        assert api_key == "explicit-key"
    +
     
     class TestBuildCallKwargsMaxTokens:
         """_build_call_kwargs should not cap output by default (#34530).
    ```
- **#58520: fix(agent): honor auxiliary.<task>.base_url/api_key when provider is passed explicitly**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `9ad912a79`, `#59140`

## Fix status

- Merged to main in PR #59140 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-07-05`.
