litellm/tests/unit/integrations
maciej-berri 85f901c420
feat(messages): serve bedrock claude_platform messages on rust only (#52681)
* fix(bedrock): match Python's Claude Platform Messages call in the Rust adapter

The Rust Claude Platform adapter never saw the workspace or the
unsupported-params override, because the bridge only projects the
kwargs LitellmParams names. They are now a typed group on
LitellmParams, so every Claude Platform call reaches Rust with them.

The adapter now follows Python's order. An API key goes out as
x-api-key unless the caller forwarded one, and the caller's
Authorization stays beside it. Without a key the Bedrock bearer token
authenticates the call, as on Invoke and Mantle, then SigV4. A
configured workspace always replaces the caller's header, and a header
alone is no workspace. litellm.api_base is honoured before the env
bases. The model keeps its claude_platform/ route until it is sent, so
the call is billed on the bedrock/claude_platform rows instead of
logging a zero cost.

The bridge no longer runs Invoke's tool shaping on Claude Platform
calls, which stripped a tool's cache_control ttl from the wire. A
missing workspace or region raises AuthenticationError with what is
missing, an invalid region the bare ValueError, and a region refusal
logs the resolved call as Python does. Credential failures map from
the fixed class list Mantle uses instead of replaying Python's signing.

Signing over a forwarded Authorization stays a difference from Python,
which re-adds the caller's header over its own signature. The Mantle
routes on Rust do the same.

* feat(messages): serve Claude Platform on Rust only and route Bedrock Messages by provider

bedrock/claude_platform/ /v1/messages calls now run on Rust only, as
Bedrock Invoke and Mantle do. With all three Bedrock Messages routes on
Rust, a bedrock or bedrock_mantle call that has a native Messages config
always runs on Rust, so the per-route targets go away. BEDROCK_INVOKE,
BEDROCK_MANTLE and the class-to-target map are removed, and bedrock and
bedrock_mantle join the provider rule anthropic and azure_ai already use.
Converse and non-Claude Bedrock models still get no Messages config and
keep going through Python's completion adaptation.

The Rust Claude Platform tests check the wire request against what
Python's config sent, captured once in a JSON fixture, plus billing on
the bedrock/claude_platform rows and the exception class and status of
each refusal.

* refactor(bedrock): drop the Python Claude Platform Messages handler code

Rust sends every Claude Platform /v1/messages call, so the Python config
loses the environment validation and request transform only Python's
Messages handler called, along with their unit tests. The config stays
for provider lookups, the error class and the URL the Rust host names in
errors. The chat route keeps its own transformation.

* test(bedrock): type the Claude Platform billing and failure assertions

* test(bedrock): check the Rust Bedrock Invoke Messages route against captured Python output

The Invoke tests no longer run Python's Messages handler beside Rust, which
litellm/rust/AGENTS.md rules out. What Python's Invoke config sent, billed,
streamed, logged and warned is captured once in a JSON fixture and each test
checks Rust against it. Exception tests check the class and status only, and
every served call asserts it was served by Rust. The Claude Platform tests
assert the same.

* refactor(bedrock): drop the Python Bedrock Invoke Messages handler code

Rust sends every Bedrock Invoke /v1/messages call, so the Python config loses
what only Python's Messages handler called: the environment validation, the
native-output retry pair, the event-stream iterator and decoder, and the SSE
wrapper. The request transform stays because count_tokens and the Mantle
configs read it. The Python unit tests that drove Invoke Messages through
Python's handler go with it. Converse and Invoke chat keep their tests.

* test(bedrock): drop the Python Invoke Messages leg from the cache breakpoint hook test

Bedrock Invoke Messages runs on Rust only, so the hook test keeps its
completion and acompletion legs, which reach Bedrock through Converse.

* fix(bedrock): close the Claude Platform differences the A/B fuzz found

Differential fuzzing against the Mantle tip found three places where Rust's
Claude Platform route still differed from Python's.

SigV4 now signs in us-west-2 when no region is named anywhere, as botocore
does, instead of refusing the call. A missing region for the default endpoint
raises AuthenticationError naming no model, as Python's config raises it. Rust
now logs Python's warnings when it drops params the endpoint rejects, when it
ignores a claude_platform_unsupported_params that is not a list, and when it
drops a disabled thinking on an always-thinking model. For that last warning
the request model is sent without its claude_platform/ route again, and the
logged model carries the route so billing stays on the claude_platform rows.

* fix(messages): require Rust only for a native Messages target

The provider rule that makes anthropic, azure_ai, bedrock and bedrock_mantle
Rust-only had no target filter. When computing a call's target raises,
dispatch serves the call on Python and _checked_target hands the refusal
check target None, which matched the rule, so a non-Claude Bedrock call that
only Python can serve was refused as Rust-only. The rule now matches only
Target.MESSAGES, which a call gets exactly when its provider has a native
Messages config, so the Claude Bedrock routes stay Rust-only and a call with
no computed target falls back to Python as dispatch intends.
2026-11-19 14:34:02 -08:00
..
arize refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
azure_storage fix(spend)!: save streamed /v1/responses spend rows under the encrypted resp_ id the client received (#49493) 2026-11-02 14:13:17 -08:00
bitbucket refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
clickhouse fix(router): count a Responses WebSocket turn's tokens before the next turn is admitted (#50730) 2026-11-10 04:13:51 +00:00
cloudzero
code_interpreter_interception fix(tool_choice): accept the Responses API's flat allowed_tools layout on chat completions (#50467) 2026-11-10 13:04:06 -08:00
compression_interception perf(token_counter): memoize token counts of long texts per tokenizer (#51904) 2026-11-16 19:21:55 +00:00
custom_logger_v2 feat(model_capacity): replace the python dynamic rate limiter v3 with a rust callback (#51540) 2026-11-17 22:20:54 +00:00
datadog fix(datadog): send DD_TAGS on Datadog logs and LLM Observability spans (#52415) 2026-11-18 20:27:30 +00:00
dotprompt refactor(typing): clear 1181 basedpyright Any errors across 431 files (#47789) 2026-10-24 11:31:09 -07:00
email_alerting feat(alerts): add management controls and opt-in daily summaries (#51418) 2026-11-12 10:06:07 -08:00
focus feat(focus): upgrade FOCUS export to the 1.5 Cost and Usage schema (#52105) 2026-11-16 15:43:15 -08:00
gcs_bucket fix(spend)!: save streamed /v1/responses spend rows under the encrypted resp_ id the client received (#49493) 2026-11-02 14:13:17 -08:00
gcs_pubsub fix(vertex_ai): reuse one Google token across RAG Engine searches and cold bursts (#51239) 2026-11-14 03:12:09 -05:00
generic_api fix(logging): reuse the cached GenericAPILogger so config reloads stop leaking flush tasks (#50879) 2026-11-17 19:23:31 +00:00
gitlab
helicone
langfuse fix(otel v2): stop legacy langfuse loggers sending to refused key/team hosts (#51344) 2026-11-16 11:34:20 -08:00
levo
litellm_agent
mavvrik_focus
newrelic fix(anthropic)!: do not surface server_tool_use as client tool_calls (#48385) 2026-11-06 03:54:34 -08:00
open_telemetry fix(scim): answer every /scim/v2 error with the RFC 7644 SCIM Error schema (#51322) 2026-11-17 19:10:33 +00:00
opik refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
otel fix(otel): emit a span for every failed retry and fallback attempt (#50310) 2026-11-17 14:38:25 -08:00
pointfive
prompt_cache_alerts test: stabilize the flaky prompt cache detector unit tests (#52671) 2026-11-18 14:47:18 -08:00
s3_v2_golden fix(bedrock)!: split the OpenAI breakpoint and Bedrock cachePoint model flags (#52180) 2026-11-16 18:50:32 -08:00
SlackAlerting feat(alerts): add management controls and opt-in daily summaries (#51418) 2026-11-12 10:06:07 -08:00
ternary feat(focus): add ternary destination for FOCUS export (#46106) 2026-10-12 22:52:40 -07:00
vantage chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
vector_store_integrations ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
websearch_interception fix(openai): cap and bill web search rounds on Responses-pinned chat completions (#51802) 2026-11-14 14:36:10 -05:00
zerobus
__init__.py
conftest.py fix(spend)!: save streamed /v1/responses spend rows under the encrypted resp_ id the client received (#49493) 2026-11-02 14:13:17 -08:00
rubrik_test_helpers.py
s3_v2_rust_support.py refactor(s3-log): move the rust-backed s3 logger from s3_v3 to s3_v2 (#51893) 2026-11-14 22:24:23 -08:00
test_agentops.py fix(caching): key cached async clients by a per-loop token instead of id(loop) (#48877) 2026-10-29 13:14:48 -07:00
test_anthropic_cache_control_hook.py feat(messages): serve bedrock claude_platform messages on rust only (#52681) 2026-11-19 14:34:02 -08:00
test_argilla.py chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
test_athina.py
test_azure_sentinel.py
test_braintrust_logging.py
test_braintrust_span_name.py
test_custom_callback_input.py
test_custom_guardrail.py fix(guardrails): log requests that a guardrail blocks on /apply_guardrail (#51014) 2026-11-16 15:18:08 -08:00
test_custom_guardrail_post_call_once.py feat(custom-logger-v2): add types, dispatcher and route callback call sites (step 0) (#51214) 2026-11-13 22:08:05 +00:00
test_custom_guardrail_recursion.py
test_custom_logger.py feat(custom-logger-v2): add types, dispatcher and route callback call sites (step 0) (#51214) 2026-11-13 22:08:05 +00:00
test_custom_prompt_management.py
test_customer_budget_webhook.py fix(proxy): alert on customer org, customer team, and customer member budgets (#51579) 2026-11-13 09:16:33 -08:00
test_deepeval.py fix(spend)!: save streamed /v1/responses spend rows under the encrypted resp_ id the client received (#49493) 2026-11-02 14:13:17 -08:00
test_dynamodb.py fix(spend)!: save streamed /v1/responses spend rows under the encrypted resp_ id the client received (#49493) 2026-11-02 14:13:17 -08:00
test_email_alerting.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
test_galileo.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
test_guardrail_logging_sync.py
test_helicone.py refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
test_humanloop.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
test_lago.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
test_langfuse.py fix(logging): mark mirrored silent_model calls with is_silent_experiment in spend logs (#48888) 2026-10-29 05:12:50 -07:00
test_langfuse_otel.py fix(otel v2): stop legacy langfuse loggers sending to refused key/team hosts (#51344) 2026-11-16 11:34:20 -08:00
test_langsmith.py
test_langsmith_init.py
test_langtrace.py fix(otel): serialize pydantic Message objects in langfuse_otel, weave_otel and langtrace (#46845) 2026-11-10 14:50:39 -08:00
test_lunary.py fix(anthropic)!: do not surface server_tool_use as client tool_calls (#48385) 2026-11-06 03:54:34 -08:00
test_mlflow.py test(unit): wait on the work itself instead of fixed sleeps (#46261) 2026-10-13 12:41:06 -07:00
test_openmeter.py fix(spend)!: save streamed /v1/responses spend rows under the encrypted resp_ id the client received (#49493) 2026-11-02 14:13:17 -08:00
test_opentelemetry.py fix(otel): emit a span for every failed retry and fallback attempt (#50310) 2026-11-17 14:38:25 -08:00
test_opentelemetry_dynamic_imports.py
test_opentelemetry_request_spans.py
test_opik_utils.py
test_otel_guardrail_violation_spans.py
test_otel_team_attributes_matrix.py
test_performance_alert_notifications.py feat(alerts): add management controls and opt-in daily summaries (#51418) 2026-11-12 10:06:07 -08:00
test_posthog.py
test_prefix_block_hashes.py feat(proxy): opt-in prefix block hashes in spend logs for workload replay (#52120) 2026-11-16 22:52:42 -08:00
test_prometheus_api_promql_escape.py
test_prometheus_budget_metric_guard.py
test_prometheus_budget_metrics_db_lookups.py
test_prometheus_budget_metrics_timeout.py
test_prometheus_cache_metrics.py
test_prometheus_caller_identity.py
test_prometheus_carried_budget_state.py refactor(redis): delete the Python RedisBatch now that every request op is native (#51383) 2026-11-13 03:22:28 +00:00
test_prometheus_client_ip_user_agent.py
test_prometheus_custom_metadata_label_counts.py
test_prometheus_deployment_state_proxy_rejects.py fix(proxy)!: answer 400 for malformed tools on count_tokens instead of crashing (#46583) 2026-10-16 14:57:53 -07:00
test_prometheus_end_user_cardinality.py
test_prometheus_input_sequence_length_label.py
test_prometheus_invalid_key_filtering.py feat(github_copilot): support GitHub App authentication with PEM upload (#51427) 2026-11-14 10:33:20 -05:00
test_prometheus_labels.py feat(dynamic_rate_limiter_v3): prometheus share, borrowed and throttle metrics per team and model (#51417) 2026-11-12 15:28:51 -08:00
test_prometheus_mcp_tool_metrics.py
test_prometheus_media_generation_metrics.py
test_prometheus_metric_name_consistency.py chore: remove cookbook and preserve live assets (#50944) 2026-11-11 15:38:27 -08:00
test_prometheus_metrics_endpoint.py test(unit): wait on the work itself instead of fixed sleeps (#46261) 2026-10-13 12:41:06 -07:00
test_prometheus_missing_metrics.py
test_prometheus_none_metadata.py
test_prometheus_overhead_with_guardrails.py
test_prometheus_queue_guardrail_metrics.py
test_prometheus_rate_limit_labels.py fix(prometheus): skip custom metadata labels a metric already carries (#46267) 2026-10-13 18:20:52 -07:00
test_prometheus_remaining_tokens_router_fallback.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
test_prometheus_requested_model_cardinality.py
test_prometheus_series_cardinality.py
test_prometheus_service_tier_label.py fix(bedrock): answer 400 for service tiers Bedrock cannot serve, forward reserved (#50516) 2026-11-14 01:33:57 +00:00
test_prometheus_services.py
test_prometheus_spend_capture_rate.py
test_prometheus_spend_logs_metadata.py fix(logging): mark mirrored silent_model calls with is_silent_experiment in spend logs (#48888) 2026-10-29 05:12:50 -07:00
test_prometheus_stream_label.py
test_prometheus_token_detail_metrics.py
test_prometheus_user_team_metrics.py fix(proxy): show committed spend in the remaining budget gauges (#49199) 2026-11-09 20:05:37 +00:00
test_prometheus_zero_cost_metric.py
test_prompt_layer.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
test_prompt_manager_ssti.py
test_responses_background_cost.py fix(responses): send the billed background response cost to the creating key's and team's loggers (#47506) 2026-10-20 23:22:21 +00:00
test_rubrik.py feat(customer portal): set budgets per customer and gateway app (#52477) 2026-11-18 17:31:03 +00:00
test_s3.py
test_s3_v2_native.py refactor(s3-log): move the rust-backed s3 logger from s3_v3 to s3_v2 (#51893) 2026-11-14 22:24:23 -08:00
test_s3_v2_rust.py test(s3-log): wait for the async upload failure report before checking it (#52737) 2026-11-19 20:46:12 +00:00
test_s3_v2_strip_writer.py refactor(s3-log): move the rust-backed s3 logger from s3_v3 to s3_v2 (#51893) 2026-11-14 22:24:23 -08:00
test_shadow_eval_logger.py feat(shadow-eval): add optional rubric grades (#52321) 2026-11-17 12:04:31 -08:00
test_sqs.py test: migrate SDK and proxy-booting legacy CircleCI tests to their tiers (#45758) 2026-10-11 00:17:21 -07:00
test_wandb.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
test_weave_otel.py fix(otel): serialize pydantic Message objects in langfuse_otel, weave_otel and langtrace (#46845) 2026-11-10 14:50:39 -08:00