Skip to content

Make Bedrock a composite provider: Converse + Anthropic Messages API#82

Open
clutchski wants to merge 3 commits intomainfrom
matt/bedrock-composite
Open

Make Bedrock a composite provider: Converse + Anthropic Messages API#82
clutchski wants to merge 3 commits intomainfrom
matt/bedrock-composite

Conversation

@clutchski
Copy link

Summary

  • Bedrock now routes anthropic.* models through the Anthropic Messages API (/invoke, /invoke-with-response-stream) while non-Anthropic models (amazon., meta., etc.) continue using the Converse API
  • Router uses spec.format instead of provider.format() for request transformation, allowing a single provider to serve models with different formats via add_provider_for_format()
  • Updated catalog: all anthropic.* Bedrock models now have format "anthropic" instead of "converse"

Test plan

  • Unit tests: mode detection, URL generation, payload preparation, multi-format provider routing
  • cargo test and cargo clippy clean
  • Integration tests pass with gateway (35/35)

🤖 Generated with Claude Code

@clutchski clutchski force-pushed the matt/bedrock-composite branch from bb26d61 to 9f3cf0a Compare February 5, 2026 20:52
@clutchski clutchski requested review from knjiang and remh February 5, 2026 21:03
clutchski and others added 3 commits February 6, 2026 16:35
…sages API

Bedrock now routes anthropic.* models through the Anthropic Messages API
(/invoke, /invoke-with-response-stream) while non-Anthropic models continue
using the Converse API. This enables full Anthropic feature support (extended
thinking, prompt caching, etc.) for Claude models on Bedrock.

Key changes:
- Router uses spec.format instead of provider.format() for request transformation
- Add add_provider_for_format() to let one provider serve multiple formats
- BedrockProvider detects mode from model name and switches URL/payload accordingly
- New bedrock_messages_event_stream for invoke-with-response-stream decoding
- Update catalog: anthropic.* Bedrock models now have format "anthropic"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nding

- Add 7 unit tests for bedrock.rs: payload edge cases, APAC region prefix,
  substring false positives, is_anthropic_model, URL correctness
- Add 5 unit tests for streaming.rs: extract_bedrock_invoke_payload base64
  decoding, error cases, and real Anthropic event shapes
- Expand router integration test with Converse-format model routing and
  passthrough verification
- Remove dead `stream` binding in complete_stream (always true)
- Rename BEDROCK_MODEL to BEDROCK_ANTH_MODEL, add BEDROCK_CONVERSE_MODEL
  in payload test cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@clutchski clutchski force-pushed the matt/bedrock-composite branch from e3c34ba to 028bb3b Compare February 6, 2026 21:35
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.

1 participant