hermes - ✅(Solved) Fix [Bug]: Bedrock inference profile IDs broken by normalize_model_name() [1 pull requests, 1 comments, 2 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#12727Fetched 2026-04-20 12:17:14
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
commented ×1cross-referenced ×1labeled ×1referenced ×1

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root cause: normalize_model_name() unconditionally replaces . → - for Anthropic API compatibility (OpenRouter uses dots in versions, Anthropic uses hyphens). But Bedrock inference profile IDs use dots as namespace separators and are passed to the AnthropicBedrock SDK, which requires

Fix Action

Fixed

PR fix notes

PR #12759: fix(anthropic): preserve dots in Bedrock inference profile IDs

Description (problem / solution / changelog)

Fixes #12727

Problem

normalize_model_name() replaces all dots with hyphens, breaking Bedrock inference profile IDs like global.anthropic.claude-sonnet-4-6global-anthropic-claude-sonnet-4-6.

Solution

Added _is_bedrock_inference_profile() helper that detects Bedrock inference profile patterns (region prefixes + provider segments). When detected, dot-to-hyphen replacement is skipped. OpenRouter models continue normalizing as before.

Tests

Added tests for both cases. All 122 tests pass.

Changed files

  • agent/anthropic_adapter.py (modified, +23/-2)
  • tests/agent/test_anthropic_adapter.py (modified, +13/-0)

Code Example

**アップロード内容:**
    - Report (システム情報・ログ概要): https://paste.rs/zzZnO
    - agent.log (詳細ログ): https://paste.rs/6Y0hU

---
RAW_BUFFERClick to expand / collapse

Bug Description

Version: 0.10.0

Problem: When using Bedrock with an inference profile ID like global.anthropic.claude-sonnet-4-6, the normalize_model_name() function in agent/anthropic_adapter.py converts all dots to hyphens, producing the invalid ID global-anthropic-claude-sonnet-4-6. This causes HTTP 400: The provided model identifier is invalid.

The dots in Bedrock inference profile IDs (global., us., eu., ap., jp.) are namespace separators, not version separators, and must be preserved.

Steps to reproduce:

Set model.default: global.anthropic.claude-sonnet-4-6 and model.provider: bedrock in config.yaml Run hermes chat Get HTTP 400: The provided model identifier is invalid.

Root cause: normalize_model_name() unconditionally replaces . → - for Anthropic API compatibility (OpenRouter uses dots in versions, Anthropic uses hyphens). But Bedrock inference profile IDs use dots as namespace separators and are passed to the AnthropicBedrock SDK, which requires

Steps to Reproduce

1.Set model.default: global.anthropic.claude-3-5-sonnet-20240620-v1:0 (or any Bedrock ID with dots) in config.yaml. 2.Set model.provider: bedrock. 3.Run hermes chat.

Expected Behavior

The dots in Bedrock inference profile IDs (which act as namespace separators like global., us., etc.) should be preserved so the SDK can correctly identify the routing profile.

Actual Behavior

<img width="1291" height="547" alt="Image" src="https://github.com/user-attachments/assets/c37bc91e-c5a8-4e12-942f-38cf53bd8b4f" /> The normalize_model_name() function converts all dots to hyphens, producing an invalid identifier and causing the API call to fail with HTTP 400.

Affected Component

Configuration (config.yaml, .env, hermes setup)

Messaging Platform (if gateway-related)

Discord

Debug Report

**アップロード内容:**
    - Report (システム情報・ログ概要): https://paste.rs/zzZnO
    - agent.log (詳細ログ): https://paste.rs/6Y0hU

Operating System

Ubuntu 24.04

Python Version

3.11.15

Hermes Version

v0.10.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

In agent/anthropic_adapter.py, the normalize_model_name() function unconditionally replaces . with - to ensure compatibility between OpenRouter (uses dots) and Anthropic (uses hyphens).

However, Bedrock's regional/global prefixes use dots as essential namespace separators, not versioning separators, and must remain intact.

Proposed Fix (optional)

anthropic_adapter.py: def normalize_model_name(model: str, preserve_dots: bool = False) -> str: """Normalize a model name for the Anthropic API.

- Strips 'anthropic/' prefix (OpenRouter format, case-insensitive)
- Converts dots to hyphens in version numbers (OpenRouter uses dots,
  Anthropic uses hyphens: claude-opus-4.6 → claude-opus-4-6), unless
  preserve_dots is True (e.g. for Alibaba/DashScope: qwen3.5-plus).
- Preserves Bedrock inference profile IDs (global., us., eu., ap., jp.)
  which use dots as namespace separators, not version separators.
"""
lower = model.lower()
if lower.startswith("anthropic/"):
    model = model[len("anthropic/"):]
_BEDROCK_REGION_PREFIXES = ("global.", "us.", "eu.", "ap.", "jp.")
if any(lower.startswith(p) for p in _BEDROCK_REGION_PREFIXES):
    return model
if not preserve_dots:
    # OpenRouter uses dots for version separators (claude-opus-4.6),
    # Anthropic uses hyphens (claude-opus-4-6). Convert dots to hyphens.
    model = model.replace(".", "-")
return model

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The normalize_model_name() function in anthropic_adapter.py should be modified to preserve dots in Bedrock inference profile IDs by adding a conditional check for Bedrock region prefixes.

Guidance

  • Modify the normalize_model_name() function to include a preserve_dots parameter, which defaults to False, to conditionally replace dots with hyphens.
  • Add a check for Bedrock region prefixes (global., us., eu., ap., jp.) and return the original model name if a match is found.
  • Update the function to only replace dots with hyphens if preserve_dots is False and the model name does not start with a Bedrock region prefix.
  • Test the updated function with Bedrock inference profile IDs to ensure the dots are preserved.

Example

def normalize_model_name(model: str, preserve_dots: bool = False) -> str:
    # ...
    _BEDROCK_REGION_PREFIXES = ("global.", "us.", "eu.", "ap.", "jp.")
    if any(lower.startswith(p) for p in _BEDROCK_REGION_PREFIXES):
        return model
    if not preserve_dots:
        model = model.replace(".", "-")
    return model

Notes

The proposed fix assumes that the normalize_model_name() function is the only place where dots are replaced with hyphens. If there are other locations where this replacement occurs, additional modifications may be necessary.

Recommendation

Apply the proposed workaround by modifying the normalize_model_name() function to preserve dots in Bedrock inference profile IDs. This change will ensure that the AnthropicBedrock SDK receives the correct model identifier and prevent the HTTP 400 error.

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 - ✅(Solved) Fix [Bug]: Bedrock inference profile IDs broken by normalize_model_name() [1 pull requests, 1 comments, 2 participants]