The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(bedrock): route GPT-6 family and prefixed OpenAI inference profiles, size their 1M window (#133573)
victor-kyriazakos5da149b45f90
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.pyindex d2ecf7c8341..da60396808e 100644--- a/agent/auxiliary_client.py+++ b/agent/auxiliary_client.py@@ -4805,12 +4805,12 @@ def _named_custom_api_key(custom_entry: Dict[str, Any], provider: str, custom_badef _build_bedrock_client(provider: str, model: Optional[str], *, raw_codex: bool) -> Tuple[Optional[Any], Optional[str]]:- """AWS Bedrock: Claude → Anthropic Bedrock SDK (prompt caching, thinking); OpenAI models- (GPT-5.5/5.6) → Bedrock Mantle's OpenAI Responses endpoint; everything else → Converse API."""+ """AWS Bedrock: Claude → Anthropic Bedrock SDK (prompt caching, thinking); bare in-Region OpenAI IDs+ → Mantle Responses; everything else, incl. OpenAI ``us.``/``global.`` profiles, → Converse API."""try:from agent.bedrock_adapter import (has_aws_credentials, is_anthropic_bedrock_model, resolve_bedrock_runtime_region,- is_openai_bedrock_model, bedrock_openai_base_url, resolve_bedrock_bearer_token,+ bedrock_openai_uses_mantle, bedrock_openai_base_url, resolve_bedrock_bearer_token,configure_bedrock_openai_client_kwargs,)from agent.anthropic_adapter import build_anthropic_bedrock_client@@ -4826,7 +4826,7 @@ def _build_bedrock_client(provider: str, model: Optional[str], *, raw_codex: booregion = resolve_bedrock_runtime_region()default_model = "anthropic.claude-haiku-4-5-20251001-v1:0"final_model = _normalize_resolved_model(model or default_model, provider) or default_model- if is_openai_bedrock_model(final_model):+ if bedrock_openai_uses_mantle(final_model):# Module-level lazy ``OpenAI`` proxy on purpose so tests can patch("agent.auxiliary_client.OpenAI").client_kwargs: Dict[str, Any] = {"api_key": resolve_bedrock_bearer_token() or "aws-sdk",diff --git a/agent/bedrock_adapter.py b/agent/bedrock_adapter.pyindex a6e53c904d3..da783abbe67 100644--- a/agent/bedrock_adapter.py+++ b/agent/bedrock_adapter.py@@ -72,11 +72,19 @@ def scoped_aws_session_kwargs() -> Dict[str, str]:)return kwargs-# Bedrock-hosted GPT-5.x models are served from the Bedrock Mantle OpenAI-compatible endpoint, not-# Converse. Narrow allowlist so GPT-OSS models stay on the native path.+# Geo/global cross-Region inference-profile prefixes Bedrock prepends to a model ID.+_BEDROCK_PROFILE_PREFIXES: Tuple[str, ...] = ("global", "us", "eu", "apac", "ap", "au", "jp", "ca", "sa", "me", "af")+# The GPT-5.6 Terra/Luna cards also document India geo profiles (``in.openai.gpt-5.6-terra``).+_BEDROCK_OPENAI_PROFILE_PREFIXES: Tuple[str, ...] = _BEDROCK_PROFILE_PREFIXES + ("in",)++# Bedrock-hosted OpenAI GPT models (bare in-Region IDs). The bare ID is served by the Bedrock Mantle+# OpenAI-compatible endpoint; its geo/global profile form is served by bedrock-runtime, where these+# cards list Converse as supported. Narrow allowlist so GPT-OSS models stay on the native path.BEDROCK_OPENAI_RESPONSES_MODEL_IDS: Tuple[str, ...] = (+ "openai.gpt-6-astra", "openai.gpt-6.1-sol", "openai.gpt-6-sol", "openai.gpt-6-luna","openai.gpt-5.5", "openai.gpt-5.6-sol", "openai.gpt-5.6-terra", "openai.gpt-5.6-luna",)+_BEDROCK_OPENAI_MODEL_IDS_LOWER = frozenset(m.lower() for m in BEDROCK_OPENAI_RESPONSES_MODEL_IDS)_BEDROCK_OPENAI_HOST_RE = re.compile(r"^bedrock-mantle\.([a-z0-9-]+)\.api\.aws$", re.IGNORECASE)# Bedrock-hosted xAI Grok (any regional inference-profile prefix) rejects temperature/topP in Converse# with a hard 400 ("This model doesn't support the temperature field"); reasoning-first, same@@ -149,6 +157,7 @@ def reset_client_cache():_bedrock_control_client_cache.clear()_bedrock_clients_by_home.clear()_inference_profile_model_cache.clear()+ _DEFAULT_WINDOW_WARNED.clear()def invalidate_runtime_client(region: str) -> bool:@@ -162,9 +171,28 @@ def invalidate_runtime_client(region: str) -> bool:# --- Bedrock Mantle / OpenAI Responses support ---+def parse_bedrock_openai_model_id(model_id: str) -> Optional[Tuple[str, str]]:+ """``(bare_id, profile_prefix)`` for a Bedrock-hosted OpenAI model, else None. ``profile_prefix``+ is ``""`` for the bare in-Region ID and e.g. ``"us"`` / ``"global"`` for a cross-Region profile."""+ normalized = str(model_id or "").strip().lower()+ prefix, sep, rest = normalized.partition(".")+ if sep and prefix in _BEDROCK_OPENAI_PROFILE_PREFIXES and rest.startswith("openai."):+ normalized = rest+ else:+ prefix = ""+ return (normalized, prefix) if normalized in _BEDROCK_OPENAI_MODEL_IDS_LOWER else None++def is_openai_bedrock_model(model_id: str) -> bool:- """True for Bedrock-hosted OpenAI models that require Mantle (GPT-OSS excluded)."""- return str(model_id or "").strip().lower() in {m.lower() for m in BEDROCK_OPENAI_RESPONSES_MODEL_IDS}+ """True for Bedrock-hosted OpenAI GPT models in any endpoint form (GPT-OSS excluded)."""+ return parse_bedrock_openai_model_id(model_id) is not None+++def bedrock_openai_uses_mantle(model_id: str) -> bool:+ """True when the model is served by Mantle's OpenAI Responses endpoint: the bare in-Region ID.+ A geo/global profile ID is a bedrock-runtime ID (Mantle rejects it) and rides Converse."""+ parsed = parse_bedrock_openai_model_id(model_id)+ return parsed is not None and not parsed[1]def merge_bedrock_openai_model_ids(model_ids: List[str]) -> List[str]:@@ -625,7 +653,7 @@ def recover_from_redacted_reasoning_rejection(exc, kwargs):# One optional regional/global inference-profile prefix, then the Claude model family._ANTHROPIC_BEDROCK_MODEL_RE = re.compile(- r"^(?:(?:global|us|eu|apac|ap|au|jp|ca|sa|me|af)\.)?anthropic\.claude", re.IGNORECASE,+ rf"^(?:(?:{'|'.join(_BEDROCK_PROFILE_PREFIXES)})\.)?anthropic\.claude", re.IGNORECASE,)@@ -1188,11 +1216,18 @@ BEDROCK_CONTEXT_LENGTHS: Dict[str, int] = {**dict.fromkeys(("meta.llama4-maverick", "meta.llama4-scout", "meta.llama3-3-70b-instruct", "mistral.mistral-large", "deepseek.v3",), 128_000),- # OpenAI on Bedrock (Mantle/Responses route): docs.aws.amazon.com/bedrock/latest/userguide/model-cards-openai.html- **dict.fromkeys(BEDROCK_OPENAI_RESPONSES_MODEL_IDS, 272_000),+ # OpenAI on Bedrock: docs.aws.amazon.com/bedrock/latest/userguide/model-cards-openai.html. GPT-6.1 Sol's+ # card states "1M tokens"; the other cards state 1,050,000. 272K is the long-context PRICING tier+ # boundary on these cards, not the window. Each entry stays <= model_metadata.DEFAULT_CONTEXT_LENGTHS.+ "openai.gpt-6.1-sol": 1_000_000,+ **dict.fromkeys((+ "openai.gpt-6-astra", "openai.gpt-6-sol", "openai.gpt-6-luna",+ "openai.gpt-5.5", "openai.gpt-5.6-sol", "openai.gpt-5.6-terra", "openai.gpt-5.6-luna",+ ), 1_050_000),}BEDROCK_DEFAULT_CONTEXT_LENGTH = 128_000 # unknown Bedrock models+_DEFAULT_WINDOW_WARNED: set = set() # one fallback WARNING per model id per process# Probe padding tiers (tokens): a wildly oversized payload yields an opaque InternalServerException# instead of a clean ValidationException.@@ -1250,6 +1285,13 @@ def get_bedrock_context_length(model_id: str, region: str = "", probe: bool = Trprofile_arn,f"{BEDROCK_DEFAULT_CONTEXT_LENGTH:,}",)+ elif model_id not in _DEFAULT_WINDOW_WARNED:+ _DEFAULT_WINDOW_WARNED.add(model_id)+ logger.warning(+ "Bedrock model %s has no known context window; using the static %s-token fallback "+ "(not a detected limit). Set model.context_length in config.yaml if the model's window is larger.",+ model_id, f"{BEDROCK_DEFAULT_CONTEXT_LENGTH:,}",+ )return BEDROCK_DEFAULT_CONTEXT_LENGTHdiff --git a/hermes_cli/models_catalog_static.py b/hermes_cli/models_catalog_static.pyindex d02909a6395..b974c740b6a 100644--- a/hermes_cli/models_catalog_static.py+++ b/hermes_cli/models_catalog_static.py@@ -284,6 +284,7 @@ _PROVIDER_MODELS: dict[str, list[str]] = {"us.anthropic.claude-sonnet-5", "us.anthropic.claude-opus-5-5", "us.anthropic.claude-sonnet-4-6","us.anthropic.claude-opus-4-6-v1","us.anthropic.claude-haiku-4-5-20251001-v1:0", "us.anthropic.claude-sonnet-4-5-20250929-v1:0",+ "openai.gpt-6-astra", "openai.gpt-6.1-sol", "openai.gpt-6-sol", "openai.gpt-6-luna","openai.gpt-5.5", "openai.gpt-5.6-sol", "openai.gpt-5.6-terra", "openai.gpt-5.6-luna","us.amazon.nova-pro-v1:0", "us.amazon.nova-lite-v1:0", "us.amazon.nova-micro-v1:0", "deepseek.v3.2","us.meta.llama4-maverick-17b-instruct-v1:0", "us.meta.llama4-scout-17b-instruct-v1:0",diff --git a/hermes_cli/runtime_provider_backends.py b/hermes_cli/runtime_provider_backends.pyindex 090a9517ea1..f257277bcf4 100644--- a/hermes_cli/runtime_provider_backends.py+++ b/hermes_cli/runtime_provider_backends.py@@ -203,12 +203,13 @@ def _resolve_openrouter_runtime(def _resolve_bedrock_runtime(requested_provider: str, model_cfg: Dict[str, Any], target_model: Optional[str]) -> Dict[str, Any]:- """AWS Bedrock with triple-path routing: OpenAI models → Bedrock Mantle's Responses endpoint;+ """AWS Bedrock with triple-path routing: bare in-Region OpenAI IDs → Bedrock Mantle's Responses+ endpoint (their ``us.``/``global.`` profile IDs are bedrock-runtime IDs and take Converse);Claude → AnthropicBedrock SDK (prompt caching, thinking budgets); others → Converse API.AWS_BEARER_TOKEN_BEDROCK auth is unsupported by AnthropicBedrock (SigV4 only), so bearer usersgo through Converse regardless of model."""- from agent.bedrock_adapter import (bedrock_openai_base_url, has_aws_credentials, is_anthropic_bedrock_model,- is_openai_bedrock_model, resolve_aws_auth_env_var, resolve_bedrock_bearer_token,+ from agent.bedrock_adapter import (bedrock_openai_base_url, bedrock_openai_uses_mantle, has_aws_credentials,+ is_anthropic_bedrock_model, resolve_aws_auth_env_var, resolve_bedrock_bearer_token,resolve_bedrock_runtime_region, bedrock_guardrail_config)from hermes_cli.config import load_config # direct (not the origin delegate), as beforerp = _rp()@@ -233,7 +234,7 @@ def _resolve_bedrock_runtime(requested_provider: str, model_cfg: Dict[str, Any],has_bearer_token = bool(os.environ.get("AWS_BEARER_TOKEN_BEDROCK", "").strip())runtime = rp._runtime("bedrock", "bedrock_converse", f"https://bedrock-runtime.{region}.amazonaws.com", "aws-sdk",source=auth_source, region=region, requested_provider=requested_provider)- if is_openai_bedrock_model(current_model):+ if bedrock_openai_uses_mantle(current_model):bearer = resolve_bedrock_bearer_token()runtime.update(api_mode="codex_responses", base_url=bedrock_openai_base_url(region), api_key=bearer or "aws-sdk",source="AWS_BEARER_TOKEN_BEDROCK" if bearer else auth_source, model=current_model, bedrock_openai=True)diff --git a/tests/agent/test_bedrock_adapter.py b/tests/agent/test_bedrock_adapter.pyindex 36ef2d072e4..ec18ddb8c94 100644--- a/tests/agent/test_bedrock_adapter.py+++ b/tests/agent/test_bedrock_adapter.py@@ -1064,14 +1064,92 @@ class TestGuardrailConfig:# Error classification# ---------------------------------------------------------------------------+def _openai_bedrock_id_forms():+ from agent.bedrock_adapter import BEDROCK_OPENAI_RESPONSES_MODEL_IDS+ return [f"{prefix}{model_id}" for model_id in BEDROCK_OPENAI_RESPONSES_MODEL_IDS+ for prefix in ("", "us.", "global.")]+++class TestOpenAIBedrockClassifier:+ """Bedrock-hosted OpenAI models are addressed by a bare in-Region ID (Mantle) or a geo/global+ inference-profile ID (bedrock-runtime); both are the same model and both must be recognised."""++ @pytest.mark.parametrize("model_id", _openai_bedrock_id_forms())+ def test_every_allowlisted_id_form_is_a_bedrock_openai_model(self, model_id):+ from agent.bedrock_adapter import is_openai_bedrock_model+ assert is_openai_bedrock_model(model_id) is True++ @pytest.mark.parametrize("model_id", [+ "openai.gpt-6-astra", "openai.gpt-6-sol", "openai.gpt-6-luna", "openai.gpt-6.1-sol",+ ])+ def test_gpt6_generation_is_allowlisted(self, model_id):+ from agent.bedrock_adapter import is_openai_bedrock_model+ assert is_openai_bedrock_model(model_id) is True++ @pytest.mark.parametrize("model_id", [+ "openai.gpt-oss-120b", "us.openai.gpt-oss-120b-1:0", "anthropic.claude-opus-5",+ "us.anthropic.claude-opus-5", "openai.gpt-99", "bogus.openai.gpt-6.1-sol", "", None,+ ])+ def test_non_allowlisted_ids_stay_off_the_openai_route(self, model_id):+ from agent.bedrock_adapter import is_openai_bedrock_model+ assert is_openai_bedrock_model(model_id) is False++class TestBedrockContextLength:"""Test Bedrock model context length lookup."""+ def setup_method(self):+ from agent import bedrock_adapter+ bedrock_adapter.reset_client_cache()def test_unknown_model_gets_default(self):from agent.bedrock_adapter import get_bedrock_context_length, BEDROCK_DEFAULT_CONTEXT_LENGTHassert get_bedrock_context_length("unknown.model-v1:0") == BEDROCK_DEFAULT_CONTEXT_LENGTH+ def test_unknown_model_fallback_is_reported_once_with_the_override(self, caplog):+ """A silent 128K fallback turned a 1M model into a 96K compression trigger; the static+ fallback must say so, name the model and the override, and not repeat every resolution."""+ from agent.bedrock_adapter import get_bedrock_context_length, BEDROCK_DEFAULT_CONTEXT_LENGTH+ with caplog.at_level("WARNING", logger="agent.bedrock_adapter"):+ assert get_bedrock_context_length("openai.gpt-99", probe=False) == BEDROCK_DEFAULT_CONTEXT_LENGTH+ assert get_bedrock_context_length("openai.gpt-99", probe=False) == BEDROCK_DEFAULT_CONTEXT_LENGTH+ warnings = [r.getMessage() for r in caplog.records if r.levelname == "WARNING"]+ assert len(warnings) == 1, warnings+ assert "openai.gpt-99" in warnings[0]+ assert "model.context_length" in warnings[0]+ assert f"{BEDROCK_DEFAULT_CONTEXT_LENGTH:,}" in warnings[0]++ def test_known_model_does_not_warn(self, caplog):+ from agent.bedrock_adapter import get_bedrock_context_length+ with caplog.at_level("WARNING", logger="agent.bedrock_adapter"):+ get_bedrock_context_length("us.anthropic.claude-sonnet-4-6", probe=False)+ assert not [r for r in caplog.records if r.levelname == "WARNING"]++ @pytest.mark.parametrize("model_id", _openai_bedrock_id_forms())+ def test_profile_prefixed_openai_ids_resolve_like_the_bare_id(self, model_id):+ from agent.bedrock_adapter import get_bedrock_context_length+ bare = model_id.split(".", 1)[1] if not model_id.startswith("openai.") else model_id+ assert get_bedrock_context_length(model_id, probe=False) == get_bedrock_context_length(bare, probe=False)++ def test_gpt61_sol_profile_gets_the_card_window(self):+ # model-card-openai-gpt-6-1-sol: "Context window: 1M tokens" (272K is the pricing tier).+ from agent.bedrock_adapter import get_bedrock_context_length+ assert get_bedrock_context_length("us.openai.gpt-6.1-sol", probe=False) == 1_000_000++ def test_gpt61_sol_profile_compression_trigger_honours_the_configured_cap(self):+ """Field report: a 400K-capped session on us.openai.gpt-6.1-sol compressed at 96,000+ (128K fallback x the small-window 75% floor). Through the real resolver and compressor,+ with the live probe unavailable, the trigger is the operator's cap."""+ from agent.context_compressor import ContextCompressor+ compressor = ContextCompressor(+ model="us.openai.gpt-6.1-sol", provider="bedrock", threshold_percent=0.5,+ base_url="https://bedrock-runtime.us-east-1.amazonaws.com", api_key="aws-sdk",+ threshold_tokens_cap=400_000, quiet_mode=True,+ )+ with patch("agent.bedrock_adapter.probe_bedrock_context_length", return_value=None):+ assert compressor.context_length == 1_000_000+ assert compressor.threshold_tokens == 400_000+def test_no_region_skips_probe_uses_table(self):# Default call (no region) must NOT hit the network — returns the@@ -1127,6 +1205,25 @@ class TestBedrockContextLength:assert not mismatched, f"1M Claude entries missing from BEDROCK_CONTEXT_LENGTHS: {mismatched}"+ def test_openai_entries_are_sized_and_never_exceed_the_direct_api_window(self):+ """Every allowlisted Bedrock OpenAI model resolves from the Bedrock table (not the 128K+ default) to a hosted window no larger than the direct-API window DEFAULT_CONTEXT_LENGTHS+ holds for the same slug. Hosted limits come from the AWS cards and may be lower; they may+ never silently borrow the direct-API value."""+ from agent.bedrock_adapter import (+ BEDROCK_DEFAULT_CONTEXT_LENGTH, BEDROCK_OPENAI_RESPONSES_MODEL_IDS, get_bedrock_context_length,+ )+ from agent.model_metadata import DEFAULT_CONTEXT_LENGTHS, _longest_key_match++ violations = []+ for model_id in BEDROCK_OPENAI_RESPONSES_MODEL_IDS:+ hit = _longest_key_match(DEFAULT_CONTEXT_LENGTHS, model_id.split(".", 1)[1])+ direct = hit[1] if hit else None+ hosted = get_bedrock_context_length(model_id, probe=False)+ if direct is None or not BEDROCK_DEFAULT_CONTEXT_LENGTH < hosted <= direct:+ violations.append((model_id, hosted, direct))+ assert not violations, f"Bedrock OpenAI windows unsized or above the direct API: {violations}"+class TestInferenceProfileContextLength:"""Application-inference-profile ARNs name no model, so the window must come from the model thediff --git a/tests/agent/test_bedrock_integration.py b/tests/agent/test_bedrock_integration.pyindex 9a221c1d306..07af3bf9db8 100644--- a/tests/agent/test_bedrock_integration.py+++ b/tests/agent/test_bedrock_integration.py@@ -173,6 +173,29 @@ class TestRuntimeProvider:assert result["api_key"] == "aws-sdk"assert result["bedrock_openai"] is True, model_id+ def test_bedrock_openai_profile_ids_route_to_runtime_converse(self, monkeypatch):+ """``us.``/``global.`` OpenAI IDs are bedrock-runtime cross-Region profiles; Mantle rejects+ them ("Geo/Global inference ID: Not supported" on every OpenAI card). They ride the+ Converse wire on bedrock-runtime, never the Mantle Responses base URL."""+ from agent.bedrock_adapter import BEDROCK_OPENAI_RESPONSES_MODEL_IDS+ from hermes_cli.runtime_provider import resolve_runtime_provider++ monkeypatch.setenv("AWS_ACCESS_KEY_ID", "AKIAIOSFODNN7EXAMPLE")+ monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY")+ monkeypatch.setenv("AWS_REGION", "us-east-2")++ for model_id in BEDROCK_OPENAI_RESPONSES_MODEL_IDS:+ for profile_id in (f"us.{model_id}", f"global.{model_id}"):+ with patch("hermes_cli.runtime_provider.resolve_provider", return_value="bedrock"), \+ patch("hermes_cli.runtime_provider._get_model_config", return_value={+ "provider": "bedrock", "default": profile_id,+ }):+ result = resolve_runtime_provider(requested="bedrock")++ assert result["api_mode"] == "bedrock_converse", profile_id+ assert result["base_url"] == "https://bedrock-runtime.us-east-2.amazonaws.com", profile_id+ assert not result.get("bedrock_openai"), profile_id+def test_bedrock_openai_models_do_not_fall_back_to_default_context(self):"""The Mantle OpenAI models have a larger window than the genericdefault; make sure they never fall back to it."""@@ -507,3 +530,21 @@ class TestAuxiliaryClientBedrockResolution:assert kwargs["api_key"] == "aws-sdk"assert kwargs["base_url"] == "https://bedrock-mantle.us-east-2.api.aws/openai/v1"assert "http_client" in kwargs++ @pytest.mark.parametrize("profile_id", ["us.openai.gpt-6.1-sol", "global.openai.gpt-6-astra",+ "us.openai.gpt-5.6-terra"])+ def test_bedrock_openai_profile_aux_uses_runtime_converse(self, monkeypatch, profile_id):+ """Auxiliary calls (compression) on a cross-Region OpenAI profile take the same wire as the+ primary turn: Converse on bedrock-runtime, model ID unchanged, no Mantle client built."""+ monkeypatch.setenv("AWS_ACCESS_KEY_ID", "AKIAIOSFODNN7EXAMPLE")+ monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY")+ monkeypatch.setenv("AWS_REGION", "us-east-2")++ with patch("agent.auxiliary_client.OpenAI") as mock_openai:+ from agent.auxiliary_client import resolve_provider_client, BedrockAuxiliaryClient+ client, model = resolve_provider_client("bedrock", profile_id)++ assert model == profile_id+ assert isinstance(client, BedrockAuxiliaryClient)+ assert client.base_url == "https://bedrock-runtime.us-east-2.amazonaws.com"+ mock_openai.assert_not_called()diff --git a/website/docs/guides/aws-bedrock.md b/website/docs/guides/aws-bedrock.mdindex 1ebb312223d..a22526d19fa 100644--- a/website/docs/guides/aws-bedrock.md+++ b/website/docs/guides/aws-bedrock.md@@ -17,7 +17,8 @@ Hermes routes each model family through the API that serves it best:| Model family | API route | Why ||---|---|---|| Anthropic Claude | Anthropic SDK (`AnthropicBedrock`) | Prompt caching, thinking budgets, adaptive thinking — features not exposed via Converse |-| OpenAI GPT-5.5 / GPT-5.6 (Sol, Terra, Luna) | Bedrock Mantle **OpenAI Responses** endpoint (`bedrock-mantle.<region>.api.aws/openai/v1`) | These models are Mantle-only — their model cards list bedrock-runtime/Converse as unsupported |+| OpenAI GPT-6 (Astra, Sol, Luna), GPT-6.1 Sol, GPT-5.6 (Sol, Terra, Luna), GPT-5.5 with a bare `openai.*` ID | Bedrock Mantle **OpenAI Responses** endpoint (`bedrock-mantle.<region>.api.aws/openai/v1`) | Bedrock Mantle serves the bare in-Region ID. `bedrock-runtime` does not accept it |+| The same OpenAI models with a `us.` or `global.` inference-profile ID | Native **Converse API** (`bedrock-runtime`) | Cross-Region profiles exist only on `bedrock-runtime`, and the model cards list Converse as supported there || Everything else (Nova, DeepSeek, Llama, GPT-OSS, …) | Native **Converse API** (`bedrock-runtime`) | Full Bedrock feature set: Guardrails, inference profiles, streaming |All three routes share the same AWS credential chain and region resolution — no separate configuration is needed. Requests to the Mantle endpoint are authenticated with `AWS_BEARER_TOKEN_BEDROCK` when set, or SigV4-signed via the standard boto3 credential chain otherwise.@@ -93,7 +94,7 @@ bedrock:The guardrail is attached on the Converse route (`guardrailConfig`) and on the Claude route (InvokeModel headers via the Anthropic Bedrock SDK, so prompt caching and thinking are kept). A blocked request surfaces as a content-filter refusal rather than as model text. `stream_processing_mode` only applies to Converse.-AWS does not apply Guardrails to the Mantle Responses endpoint used by `openai.gpt-5.x` models ([AWS docs](https://docs.aws.amazon.com/bedrock/latest/userguide/bedrock-mantle.html)); use a Converse-served model when a guardrail is required.+AWS does not apply Guardrails to the Mantle Responses endpoint used by bare `openai.gpt-*` IDs ([AWS docs](https://docs.aws.amazon.com/bedrock/latest/userguide/bedrock-mantle.html)). Use a Converse-served model, such as a `us.` or `global.` OpenAI inference profile, when a guardrail is required.### Model Discovery@@ -115,6 +116,8 @@ Hermes automatically applies prompt caching on the Bedrock **Converse API** pathFor models whose context window isn't in Hermes' static table, Hermes can probe the real limit by sending oversized requests at fixed tiers (~1.3M and ~2.2M tokens) and parsing the `maximum` reported in Bedrock's length-validation error. Probed values feed the same metadata cache as the static table; stale cached entries that under-report a model's window (e.g. entries seeded before a model's 1M window went GA) are dropped automatically in favor of the larger known value.+When neither the probe nor the static table knows a model, Hermes uses a 128,000-token fallback and logs a WARNING naming the model. Set `model.context_length` in `config.yaml` to the model's real window.+**Application inference profiles.** An ARN such as `arn:aws:bedrock:us-west-2:123456789012:application-inference-profile/abcdef123456` names no model, so neither the probe nor the static table can size it. Hermes calls `bedrock:GetInferenceProfile` in the ARN's region and sizes the window from the model the profile wraps (1M for a profile wrapping Claude Sonnet 4.6). Without that permission the 128,000-token default applies and a WARNING names the profile; set `model.context_length` explicitly to override either way.## Available Models@@ -126,17 +129,23 @@ Bedrock models use **inference profile IDs** for on-demand invocation. The `herm| Claude Sonnet 4.6 | `us.anthropic.claude-sonnet-4-6` | Recommended — best balance of speed and capability || Claude Opus 4.6 | `us.anthropic.claude-opus-4-6-v1` | Most capable || Claude Haiku 4.5 | `us.anthropic.claude-haiku-4-5-20251001-v1:0` | Fastest Claude |-| OpenAI GPT-5.6 Sol | `openai.gpt-5.6-sol` | OpenAI frontier model (via Bedrock Mantle) |-| OpenAI GPT-5.6 Terra | `openai.gpt-5.6-terra` | Balanced (via Bedrock Mantle) |-| OpenAI GPT-5.6 Luna | `openai.gpt-5.6-luna` | Fast, affordable (via Bedrock Mantle) |-| OpenAI GPT-5.5 | `openai.gpt-5.5` | Previous OpenAI flagship (via Bedrock Mantle) |+| OpenAI GPT-6 Astra | `openai.gpt-6-astra` | Most capable OpenAI model, 1,050,000-token window |+| OpenAI GPT-6.1 Sol | `openai.gpt-6.1-sol` | 1M-token window. Mantle in-Region access is `us-east-1` only |+| OpenAI GPT-6 Sol | `openai.gpt-6-sol` | Coding and agentic work, 1,050,000-token window |+| OpenAI GPT-6 Luna | `openai.gpt-6-luna` | Focused, high-volume tasks, 1,050,000-token window |+| OpenAI GPT-5.6 Sol | `openai.gpt-5.6-sol` | 1,050,000-token window |+| OpenAI GPT-5.6 Terra | `openai.gpt-5.6-terra` | Balanced, 1,050,000-token window |+| OpenAI GPT-5.6 Luna | `openai.gpt-5.6-luna` | Fast, affordable, 1,050,000-token window |+| OpenAI GPT-5.5 | `openai.gpt-5.5` | Mantle only, no inference profiles || Amazon Nova Pro | `us.amazon.nova-pro-v1:0` | Amazon's flagship || Amazon Nova Micro | `us.amazon.nova-micro-v1:0` | Fastest, cheapest || DeepSeek V3.2 | `deepseek.v3.2` | Strong open model || Llama 4 Scout 17B | `us.meta.llama4-scout-17b-instruct-v1:0` | Meta's latest |:::info Cross-Region Inference-Models prefixed with `us.` use cross-region inference profiles, which provide better capacity and automatic failover across AWS regions. Models prefixed with `global.` route across all available regions worldwide. OpenAI `openai.*` model IDs are served by Bedrock Mantle in the configured region and don't use inference-profile prefixes.+Models prefixed with `us.` use cross-region inference profiles, which provide better capacity and automatic failover across AWS regions. Models prefixed with `global.` route across all available regions worldwide.++OpenAI models have two endpoint forms. The bare `openai.*` ID is in-Region and Hermes sends it to Bedrock Mantle's Responses endpoint in the configured region. The `us.openai.*` and `global.openai.*` IDs are cross-Region inference profiles. Hermes sends them to `bedrock-runtime` through the Converse API, the same path as other inference profiles. Each AWS model card lists the profiles a model offers and the regions Mantle serves it in.:::## Switching Models Mid-Session