From 7141cda967c489d1fec0e17740222db0e6ac6331 Mon Sep 17 00:00:00 2001 From: vominh1919 Date: Wed, 29 Apr 2026 12:29:36 +0700 Subject: [PATCH] fix: narrow Anthropic adapter dot-mangling to Claude models only The normalize_model_name() function unconditionally converted dots to hyphens in all model names. This caused non-Anthropic models (e.g. gpt-5.4) to be mangled to gpt-5-4 when routed through the Anthropic adapter path, resulting in HTTP 404 from the backend. Now only applies dot-to-hyphen conversion for models starting with "claude-" or "anthropic/", which are the actual Anthropic model IDs. Fixes NousResearch/hermes-agent#17171 Related: #7421, #13061, #16417 --- agent/anthropic_adapter.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/agent/anthropic_adapter.py b/agent/anthropic_adapter.py index b58535914b3..740986203d4 100644 --- a/agent/anthropic_adapter.py +++ b/agent/anthropic_adapter.py @@ -1076,9 +1076,12 @@ def normalize_model_name(model: str, preserve_dots: bool = False) -> str: # These must not be converted to hyphens. See issue #12295. if _is_bedrock_model_id(model): return model - # OpenRouter uses dots for version separators (claude-opus-4.6), - # Anthropic uses hyphens (claude-opus-4-6). Convert dots to hyphens. - model = model.replace(".", "-") + # Only convert dots to hyphens for Anthropic/Claude models. + # Non-Anthropic models (gpt-5.4, gemini-2.5, etc.) use dots + # as part of their canonical names. See issue #17171. + _lower = model.lower() + if _lower.startswith("claude-") or _lower.startswith("anthropic/"): + model = model.replace(".", "-") return model