hermes - 💡(How to fix) Fix custom_providers with anthropic_messages mangles dotted model names → 502 from local proxies [4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#17452Fetched 2026-04-30 06:47:34
View on GitHub
Comments
4
Participants
3
Timeline
12
Reactions
0
Timeline (top)
commented ×4labeled ×4mentioned ×2subscribed ×2

Error Message

Proxy responds 502 {"error":{"message":"unknown provider for model gpt-5-4"}}, Hermes retries 3× then falls back.

Root Cause

_anthropic_preserve_dots() in run_agent.py (line 8023 on main) gates dot-preservation on a hardcoded provider/base_url allowlist:

if (getattr(self, "provider", "") or "").lower() in {
    "alibaba", "minimax", "minimax-cn",
    "opencode-go", "opencode-zen",
    "zai", "bedrock",
}:
    return True
base = (getattr(self, "base_url", "") or "").lower()
return (
    "dashscope" in base
    or "aliyuncs" in base
    or "minimax" in base
    or "opencode.ai/zen/" in base
    or "bigmodel.cn" in base
    or "bedrock-runtime." in base
)

A user-defined custom_provider pointing at 127.0.0.1 / localhost / a private domain will never match, so normalize_model_name() falls back to model.replace(".", "-").

Fix Action

Fix / Workaround

Workaround (local patch)

Code Example

model:
  default: gpt-5.4
  provider: codex

custom_providers:
- name: codex
  base_url: http://127.0.0.1:8317/api/provider/codex
  api_key: ccs-internal-managed
  api_mode: anthropic_messages
  model: gpt-5.4

---

{ "model": "gpt-5-4", ... }

---

if (getattr(self, "provider", "") or "").lower() in {
    "alibaba", "minimax", "minimax-cn",
    "opencode-go", "opencode-zen",
    "zai", "bedrock",
}:
    return True
base = (getattr(self, "base_url", "") or "").lower()
return (
    "dashscope" in base
    or "aliyuncs" in base
    or "minimax" in base
    or "opencode.ai/zen/" in base
    or "bigmodel.cn" in base
    or "bedrock-runtime." in base
)

---

custom_providers:
   - name: codex
     base_url: http://127.0.0.1:8317/api/provider/codex
     api_mode: anthropic_messages
     preserve_model_dots: true
RAW_BUFFERClick to expand / collapse

Environment

  • Hermes version: v0.11.0 (2026.4.23) (note: my install is 154 commits behind, but the affected code is unchanged on main as of ff687c019 — see line 8023 in run_agent.py)
  • OS: macOS 15.4
  • Setup: local proxy (CCS / cliproxy) at http://127.0.0.1:8317 translating Anthropic API → Codex backend

Problem

When configuring a custom_provider that uses api_mode: anthropic_messages, dots in the model name are silently replaced with hyphens before the request is sent. This breaks any local/self-hosted proxy that expects the model name to be passed through verbatim (e.g. gpt-5.4, glm-4.6, etc.).

Repro

~/.hermes/config.yaml:

model:
  default: gpt-5.4
  provider: codex

custom_providers:
- name: codex
  base_url: http://127.0.0.1:8317/api/provider/codex
  api_key: ccs-internal-managed
  api_mode: anthropic_messages
  model: gpt-5.4

Outgoing request body (captured at the proxy):

{ "model": "gpt-5-4", ... }

Proxy responds 502 {"error":{"message":"unknown provider for model gpt-5-4"}}, Hermes retries 3× then falls back.

Root cause

_anthropic_preserve_dots() in run_agent.py (line 8023 on main) gates dot-preservation on a hardcoded provider/base_url allowlist:

if (getattr(self, "provider", "") or "").lower() in {
    "alibaba", "minimax", "minimax-cn",
    "opencode-go", "opencode-zen",
    "zai", "bedrock",
}:
    return True
base = (getattr(self, "base_url", "") or "").lower()
return (
    "dashscope" in base
    or "aliyuncs" in base
    or "minimax" in base
    or "opencode.ai/zen/" in base
    or "bigmodel.cn" in base
    or "bedrock-runtime." in base
)

A user-defined custom_provider pointing at 127.0.0.1 / localhost / a private domain will never match, so normalize_model_name() falls back to model.replace(".", "-").

Workaround (local patch)

Adding 127.0.0.1 and localhost to the base_url allowlist works for my case, but it's not a general solution — some users may genuinely want the dot→hyphen behavior on their local proxy.

Proposed fix — would like maintainer guidance

Two options, would like to know which you prefer before opening a PR:

  1. URL allowlist extension (minimal): treat 127.0.0.1, localhost, and any host that resolves to a private/loopback range as dot-preserving by default. ~5 LoC.

  2. Config-driven (more general): add an explicit preserve_model_dots: bool field on custom_providers entries, defaulting to false for backward compat. Lets users opt in regardless of host.

    custom_providers:
    - name: codex
      base_url: http://127.0.0.1:8317/api/provider/codex
      api_mode: anthropic_messages
      preserve_model_dots: true

Happy to send a PR for whichever approach you'd like.

extent analysis

TL;DR

The issue can be fixed by either extending the URL allowlist to include private hosts or adding a config-driven option to preserve model dots in custom providers.

Guidance

  • The root cause of the issue is the hardcoded provider/base_url allowlist in _anthropic_preserve_dots() that gates dot-preservation.
  • To verify the issue, capture the outgoing request body at the proxy and check if the model name has been modified.
  • Two possible solutions are proposed: extending the URL allowlist or adding a config-driven option to preserve model dots.
  • The config-driven option allows users to opt-in to preserving model dots regardless of the host, providing more flexibility.

Example

# Proposed config-driven solution
custom_providers:
- name: codex
  base_url: http://127.0.0.1:8317/api/provider/codex
  api_mode: anthropic_messages
  preserve_model_dots: true

Notes

The proposed solutions assume that the issue is specific to the _anthropic_preserve_dots() function and the normalize_model_name() fallback behavior. The solutions may not apply if there are other factors at play.

Recommendation

Apply the config-driven workaround by adding an explicit preserve_model_dots: bool field on custom_providers entries, defaulting to false for backward compatibility. This approach provides more flexibility and allows users to opt-in to preserving model dots regardless of the host.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix custom_providers with anthropic_messages mangles dotted model names → 502 from local proxies [4 comments, 3 participants]