# NousResearch/hermes-agent · Gateway api_key config reading for custom providers

## Open now

- 0 issues, 1 PR open on GitHub.
- PR #18685: fix(gateway): pass config api key to model switch

These issues and PRs address a bug where the gateway's /model command and model listing probes fail to read api_key credentials from config when using custom endpoints or providers. Fixes involve using the credential pool and passing config api keys through the relevant handlers.

## TL;DR

- 5 member(s): 0 open issue(s), 1 closed issue(s), 1 open PR(s), 1 merged PR(s), 2 PR(s) closed without merging.
- A fix was merged to main in PR #22842. Verify it addresses your case.
- **Recommended:** read PR #22842 (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: `unresolved`. 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.40`: 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

- #18681: fix(gateway): /model command fails on custom providers — api_key not read from config

## Prior & competing PRs

- **#19683: fix(gateway): read api_key from model config in /model command handler**. closed without merge · fix tier `suggested`
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `f24db23458fdb2e0a14be4881d6eda5cfbf50991`, `#18685`
  - _suggested-tier fix detail withheld; re-request with `?tier=all` to include it._
- **#22842: fix: use credential_pool for custom endpoint model listing probes (salvage #22810)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `hermes_cli/model_switch.py`, `hermes_cli/runtime_provider.py`, `scripts/release.py`
  - fix hunks:
  - `hermes_cli/model_switch.py`

    ```diff
    @@ -889,10 +889,9 @@ def switch_model(
                 # "ollama-launch" that resolve_runtime_provider doesn't know), keep existing
                 # credentials. Otherwise use the resolved values (picks up credential rotation,
                 # base_url adjustments for OpenCode, etc.).
    -            if runtime.get("provider") != "custom":
    -                api_key = runtime.get("api_key", "")
    -                base_url = runtime.get("base_url", "")
    -                api_mode = runtime.get("api_mode", "")
    +            api_key = runtime.get("api_key", "")
    +            base_url = runtime.get("base_url", "")
    +            api_mode = runtime.get("api_mode", "")
             except Exception:
                 pass
     
    ```
  - `hermes_cli/runtime_provider.py`

    ```diff
    @@ -492,6 +492,13 @@ def _resolve_named_custom_runtime(
         requested_norm = (requested_provider or "").strip().lower()
         if requested_norm == "custom" and explicit_base_url:
             base_url = explicit_base_url.strip().rstrip("/")
    +        # Check credential pool first — mirrors the named-custom-provider path
    +        # so bare `provider: custom` with a configured custom_providers entry
    +        # also gets its api_key from the pool instead of env var fallbacks.
    +        pool_result = _try_resolve_from_custom_pool(base_url, "custom", None)
    +        if pool_result:
    +            pool_result["source"] = "direct-alias"
    +            return pool_result
             api_key_candidates = [
                 (explicit_api_key or "").strip(),
                 os.getenv("OPENAI_API_KEY", "").strip(),
    ```
  - `scripts/release.py`

    ```diff
    @@ -66,6 +66,7 @@
         "[redacted:email]": "qWaitCrypto",
         "44045911+kidonng@users.noreply.github.com": "kidonng",
         "[redacted:email]": "DanielLSM",
    +    "264291321+v1b3coder@users.noreply.github.com": "v1b3coder",
         "[redacted:email]": "Qwinty",
         "[redacted:email]": "CalmProton",
         "308068+mbac@users.noreply.github.com": "mbac",
    ```
- **#18685: fix(gateway): pass config api key to model switch**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`
  - files: `gateway/run.py`, `tests/gateway/test_model_command_custom_providers.py`
- **#22810: fix: use credential_pool for custom endpoint model listing probes**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#22842`

## Fix status

- Merged to main in PR #22842 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-05-10`.
- Subsystem: `gateway`
