fix(providers): support Anthropic proxy v1 endpoints - #45842
Merged
teknium1 merged 1 commit intoJun 14, 2026
Conversation
helix4u
marked this pull request as ready for review
June 13, 2026 22:05
Contributor
|
Verified clean. Reviewed the full diff across all 8 files:
No dead variables, no broad exception catches hiding issues, no missing None guards. |
This was referenced Jul 12, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Supports Anthropic-compatible proxy base URLs that already include the version segment, such as
http://localhost:6655/anthropic/v1.Hermes already supports custom/proxy endpoints and Anthropic Messages transport, but auto-detection only recognized URLs whose path ended exactly in
/anthropic. Versioned proxy base URLs fell through to OpenAI chat-completions routing, which builds requests like/anthropic/v1/chat/completionsinstead of using the Anthropic Messages client.This also makes model discovery respect the configured Anthropic/custom proxy base URL and Desktop-saved
model.api_key, so the picker can query/anthropic/v1/modelson the proxy instead of public Anthropic or an OpenAI-style catalog probe.Adjacent PRs checked before this change: #43988, #37656, #30232, #37705. Those cover related URL/probe/base-url handling, but not the combined
/anthropic/v1transport detection plus configured proxy model catalog path fixed here.Related Issue
None filed from the support thread.
Type of Change
Changes Made
hermes_cli/runtime_provider.py: detect/anthropic/v1base URLs asanthropic_messageswhile keeping deeper subpaths like/anthropic/v1/modelsout of transport detection.agent/auxiliary_client.py: mirror the same detection for auxiliary clients.agent/anthropic_adapter.py: strip a trailing/v1before constructing the regular Anthropic SDK client, matching the bearer-hook path, so SDK requests still land on/anthropic/v1/messagesrather than/anthropic/v1/v1/messages.hermes_cli/models.py: let Anthropic model discovery use configuredmodel.base_url/model.api_key, and let custom provider discovery passapi_mode="anthropic_messages"for/anthropic/v1proxy catalogs.How to Test
http://localhost:6655/anthropic/v1.api_mode: anthropic_messages.http://localhost:6655/anthropic/v1/modelswith the saved key.scripts/run_tests.sh -j 4 tests/hermes_cli/test_detect_api_mode_for_url.py tests/agent/test_auxiliary_transport_autodetect.py tests/agent/test_anthropic_adapter.py tests/hermes_cli/test_model_validation.py -- -q.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) - or N/Acli-config.yaml.exampleif I added/changed config keys - or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows - or N/AScreenshots / Logs
Focused test run:
scripts/run_tests.sh -j 4 tests/hermes_cli/test_detect_api_mode_for_url.py tests/agent/test_auxiliary_transport_autodetect.py tests/agent/test_anthropic_adapter.py tests/hermes_cli/test_model_validation.py -- -qResult: 4 files, 279 tests passed, 0 failed.