Skip to content

fix(bedrock): serve mantle default model and strip region prefix - #419

Open
cpsievert wants to merge 2 commits into
mainfrom
fix-bedrock-mantle-model-defaults
Open

fix(bedrock): serve mantle default model and strip region prefix#419
cpsievert wants to merge 2 commits into
mainfrom
fix-bedrock-mantle-model-defaults

Conversation

@cpsievert

Copy link
Copy Markdown
Collaborator

Fixes #411.

Two related bugs in ChatBedrock()'s mantle APIs (api="messages" / api="responses"):

  1. Default model 404s on mantle. DEFAULT_MODEL was "us.anthropic.claude-sonnet-4-6", which mantle's Anthropic endpoint does not serve. Bumped it to "us.anthropic.claude-sonnet-5", matching ellmer's default, which mantle does serve (and which Converse continues to serve too, so the default routing to "converse" is unaffected).

  2. Cross-region prefix leaks into mantle requests. CROSS_REGION_PREFIX was only stripped when looking up a model in the MODEL_APIS routing table, not from the model id actually sent in the request. Converse needs the prefix (it picks the inference profile), but mantle rejects it, so a prefixed model id that routes to mantle (e.g. model="us.openai.gpt-5.4") 404'd. Added bedrock_strip_region_prefix() and applied it to the model passed into BedrockResponsesProvider and BedrockMessagesProvider (the Converse path keeps the prefix, since it needs it).

Testing

  • Added regression tests in tests/test_provider_bedrock_mantle.py covering: the default model works when api="messages" is requested explicitly, and the cross-region prefix is stripped for both api="messages" and api="responses".
  • Updated tests/test_provider_bedrock_converse.py's default-model assertion to match the new default.
  • Full test suite passes locally (uv run pytest, uv run ruff check chatlas, uv run ruff format --check, uv run pyright on the touched files).

Note: my local sandbox had stale/expired ambient AWS_* env vars left over from a prior session, which makes AWS-credential-dependent tests fail regardless of this change (confirmed same failures on main). Unsetting them locally, the whole suite (1256 tests) passes.

cpsievert and others added 2 commits September 2, 2026 12:06
- Bump ChatBedrock()'s default model from us.anthropic.claude-sonnet-4-6
  to us.anthropic.claude-sonnet-5, which mantle's api="messages"
  endpoint actually serves (sonnet-4-6 404s there).
- Strip the cross-region inference prefix (us., eu., etc.) from the
  model id used in requests to api="messages" and api="responses".
  Converse needs the prefix to pick an inference profile, but mantle
  rejects it, so a prefixed model id that routes to mantle (e.g.
  model="us.openai.gpt-5.4") previously 404d.

Fixes #411
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ChatBedrock() mantle APIs: default model isn't served, and cross-region prefix isn't stripped from requests

1 participant