Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cecli/helpers/llms/domains/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def bedrock_endpoint(resolved: Dict[str, Any]) -> str:
)

route = resolved["route"]
return f"https://bedrock-runtime.{region}.amazonaws.com/model/{route}/converse"
return f"{resolved['api_base']}/model/{route}/converse"


def _signed_headers(
Expand Down
15 changes: 15 additions & 0 deletions tests/helpers/test_llms_hyperscalers.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,21 @@ def test_bedrock_endpoint_requires_region():
raise AssertionError("expected ValueError without a region")


def test_bedrock_endpoint_built_from_resolved_api_base(monkeypatch):
# The Converse URL is assembled from resolved["api_base"] verbatim rather
# than a hardcoded public host, so a custom endpoint (VPC endpoint, proxy,
# LocalStack, ...) resolved onto api_base is honored.
monkeypatch.setenv("AWS_REGION_NAME", "us-east-1")
resolved = {
"route": "anthropic.claude-sonnet",
"api_base": "https://bedrock.internal.example.com",
}
url = bedrock_endpoint(resolved)
assert url == (
"https://bedrock.internal.example.com/model/anthropic.claude-sonnet/converse"
)


# ---------------------------------------------------------------------------
# Chat-family wiring: signer hook + extra_query
# ---------------------------------------------------------------------------
Expand Down
Loading