Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(llm-gateway): correct Bedrock model id for claude-opus-4-7 (#59032)

Joshua Snyder574dc50d602d
diff --git a/services/llm-gateway/src/llm_gateway/api/anthropic.py b/services/llm-gateway/src/llm_gateway/api/anthropic.py
index fd999dcbbb6f..e8ccadb0aab8 100644
--- a/services/llm-gateway/src/llm_gateway/api/anthropic.py
+++ b/services/llm-gateway/src/llm_gateway/api/anthropic.py
@@ -94,7 +94,7 @@ async def _send_bedrock_messages(
data = dict(request_data)
bedrock_model = map_to_bedrock_model(data["model"], region_name=bedrock_region_name)
# litellm can't infer the bedrock provider from regional inference profile
- # ids like "us.anthropic.claude-opus-4-7-v1", so prefix explicitly.
+ # ids like "us.anthropic.claude-opus-4-7", so prefix explicitly.
data["model"] = f"bedrock/{bedrock_model}"
anthropic_beta = request.headers.get("anthropic-beta")
diff --git a/services/llm-gateway/src/llm_gateway/bedrock.py b/services/llm-gateway/src/llm_gateway/bedrock.py
index 550b23123153..26e49a170d47 100644
--- a/services/llm-gateway/src/llm_gateway/bedrock.py
+++ b/services/llm-gateway/src/llm_gateway/bedrock.py
@@ -41,8 +41,8 @@ ANTHROPIC_TO_BEDROCK_MODEL_MAP: Final[dict[str, dict[str, str]]] = {
"eu": "eu.anthropic.claude-opus-4-6-v1",
},
"claude-opus-4-7": {
- "us": "us.anthropic.claude-opus-4-7-v1",
- "eu": "eu.anthropic.claude-opus-4-7-v1",
+ "us": "us.anthropic.claude-opus-4-7",
+ "eu": "eu.anthropic.claude-opus-4-7",
},
"claude-sonnet-4-5": {
"us": "us.anthropic.claude-sonnet-4-5-20250929-v1:0",
diff --git a/services/llm-gateway/tests/test_bedrock.py b/services/llm-gateway/tests/test_bedrock.py
index 45bef60a8bab..60f5202b439d 100644
--- a/services/llm-gateway/tests/test_bedrock.py
+++ b/services/llm-gateway/tests/test_bedrock.py
@@ -115,7 +115,7 @@ class TestBedrockSpecific:
"model,expected_litellm_model",
[
pytest.param("claude-sonnet-4-6", "bedrock/us.anthropic.claude-sonnet-4-6", id="anthropic_name_mapped"),
- pytest.param("claude-opus-4-7", "bedrock/us.anthropic.claude-opus-4-7-v1", id="opus_4_7_inference_profile"),
+ pytest.param("claude-opus-4-7", "bedrock/us.anthropic.claude-opus-4-7", id="opus_4_7_inference_profile"),
pytest.param(
"us.anthropic.claude-sonnet-4-6", "bedrock/us.anthropic.claude-sonnet-4-6", id="already_bedrock_id"
),
@@ -133,7 +133,7 @@ class TestBedrockSpecific:
expected_litellm_model: str,
) -> None:
# Regression: litellm needs the "bedrock/" prefix to route requests; without
- # it, regional inference profile ids (e.g. "us.anthropic.claude-opus-4-7-v1")
+ # it, regional inference profile ids (e.g. "us.anthropic.claude-opus-4-7")
# don't match litellm's pattern matchers and the request 400s with
# "LLM Provider NOT provided" before leaving the gateway.
mock_response = MagicMock()