Skip to content

feat(custom-endpoint): support Anthropic Messages protocol for custom endpoints - #17391

Closed
JanCong wants to merge 1 commit into
NousResearch:mainfrom
JanCong:feat/custom-endpoint-anthropic-protocol
Closed

feat(custom-endpoint): support Anthropic Messages protocol for custom endpoints#17391
JanCong wants to merge 1 commit into
NousResearch:mainfrom
JanCong:feat/custom-endpoint-anthropic-protocol

Conversation

@JanCong

@JanCong JanCong commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add API protocol selection (OpenAI / Anthropic) to the hermes model custom endpoint setup wizard, with auto-detection from URL patterns (e.g. /anthropic suffix)
  • Persist api_mode in custom_providers config entries so the protocol choice survives across sessions
  • Read api_mode from custom_providers in resolve_custom_provider() instead of hardcoding openai_chat transport
  • Generalize /v1 auto-stripping for Anthropic protocol to all providers (previously only applied to OpenCode) — the Anthropic SDK appends /v1/messages automatically, so a base_url ending in /v1 would produce .../v1/v1/messages (HTTP 404)

Motivation

The custom endpoint setup wizard only offered "OpenAI-compatible" endpoints. Users who needed the Anthropic Messages protocol (e.g. MiniMax /anthropic, LiteLLM proxies, custom gateways) had to manually edit config.yaml to add api_mode: anthropic_messages. This PR makes that a first-class option in the interactive setup flow.

Closes #12137, closes #6209

Test plan

  • hermes model → Custom endpoint → enter an Anthropic-protocol URL (e.g. https://api.minimaxi.com/anthropic) → verify auto-detection prompts "Anthropic Messages"
  • hermes model → Custom endpoint → enter a plain URL → verify manual protocol selection appears
  • Select Anthropic Messages with a /v1-suffixed URL → verify /v1 is auto-stripped with a note printed
  • Check ~/.hermes/config.yamlcustom_providers entry has api_mode: anthropic_messages
  • Check model.api_mode is correctly set in config
  • /model in-chat switch to a custom Anthropic endpoint → verify no /v1/v1/messages 404
  • Existing OpenAI-compatible custom endpoints continue to work unchanged

🤖 Generated with Claude Code

… endpoints

The custom endpoint setup wizard only supported OpenAI-compatible
endpoints. Users who needed Anthropic Messages protocol (e.g. MiniMax,
LiteLLM proxies, custom gateways) had to manually edit config.yaml.

Changes:
- Add API protocol selection step in `hermes model` custom endpoint
  setup (auto-detects from URL, falls back to manual choice)
- Persist `api_mode` in `custom_providers` config entries
- Read `api_mode` from custom_providers in `resolve_custom_provider()`
  instead of hardcoding `openai_chat` transport
- Generalize `/v1` stripping for Anthropic protocol to all providers
  (previously only applied to OpenCode); the Anthropic SDK appends
  `/v1/messages` automatically, so a base_url ending in `/v1` would
  produce `.../v1/v1/messages` (404)

Closes NousResearch#12137, closes NousResearch#6209

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@alt-glitch alt-glitch added type/feature New feature or request P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 29, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Closing as superseded by #25068.

Triage notes (high confidence):
Main hermes_cli/main.py:3659 already calls _prompt_custom_api_mode_selection for interactive api_mode picking in _model_flow_custom — landed via merged #25068 (feat(custom): prompt and persist explicit api_mode).

Thanks for the contribution — the underlying problem this PR addresses has been resolved by the linked PR on current main. If you believe this was closed in error, please comment and we'll reopen.

(Bulk-closed during a CLI PR triage sweep.)

@teknium1 teknium1 closed this May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/feature New feature or request

Projects

None yet

3 participants