Skip to content

Conversation

@clutchski
Copy link

@clutchski clutchski commented Feb 11, 2026

Summary

  • Change bedrock anthropic models in model_list.json from format: "converse" to format: "anthropic", letting the standard Anthropic adapter handle translation instead of special-casing in transform_request
  • Router now uses spec.format (from model catalog) instead of provider.format() to drive request transformation
  • Resolver routes bedrock anthropic models to the bedrock provider despite having anthropic format
  • BedrockProvider dispatches anthropic-format models to the invoke/invoke-with-response-stream endpoints with SSE streaming, while converse-format models use existing converse endpoints with binary event streams

Test plan

  • cargo test -p lingua --features bedrock,anthropic,openai -- 498 tests pass
  • cargo test -p braintrust-llm-router -- 29 tests pass
  • cargo clippy -p lingua -p braintrust-llm-router -- clean, no warnings
  • E2E: validate.ts --format bedrock-anthropic

🤖 Generated with Claude Code

Route Bedrock-hosted Anthropic models (anthropic.* / *.anthropic.*)
through the native Anthropic Messages API via the invoke endpoint
instead of the lossy Converse API translation.

- Add is_bedrock_anthropic_model() detection utility
- Add bedrock::anthropic module for invoke endpoint request preparation
- Integrate into transform_request: swap target adapter to Anthropic
  when model is bedrock anthropic, then prepare for invoke endpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@clutchski clutchski force-pushed the matt/bedrock-anthropic-invoke branch from 90ade23 to 9619c30 Compare February 11, 2026 03:32
…ormat

Instead of special-casing bedrock anthropic models in lingua's
transform_request, declare them as format "anthropic" in model_list.json
and let the standard adapter pipeline handle translation. The router
uses spec.format (not provider.format()) to drive transformation, and
the resolver routes bedrock anthropic models to the bedrock provider
despite having anthropic format. BedrockProvider dispatches to the
invoke/invoke-with-response-stream endpoints for anthropic-format
models, using SSE streaming instead of binary event streams.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@clutchski clutchski changed the title Add Bedrock Anthropic invoke endpoint support Route bedrock anthropic models via invoke endpoint Feb 11, 2026
clutchski and others added 3 commits February 10, 2026 22:32
Avoid double-parsing by running convert_to_anthropic inside
transform_request where the Value is already in hand. BedrockProvider
now only selects the URL (invoke vs converse), no payload manipulation.

- Rename prepare_request -> convert_to_anthropic
- Add is_bedrock_anthropic_target one-liner for format+model check
- Extract needs_provider_post_processing / provider_post_process helpers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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