litellm/tests/unit/llms/bedrock
mika-lt c87362fe11
fix(bedrock): send native chat and Responses calls to aws_bedrock_runtime_endpoint like Converse (#50582)
* fix(bedrock): send native chat and responses calls to aws_bedrock_runtime_endpoint like converse

A deployment that set both api_base and aws_bedrock_runtime_endpoint sent
Converse calls to the runtime endpoint but native Chat Completions calls to a
full chat/completions api_base, and Responses calls to any api_base. Both
native routes now take the host from get_runtime_endpoint, so the runtime
endpoint (deployment value, else AWS_BEDROCK_RUNTIME_ENDPOINT) wins on every
route. With no runtime endpoint, api_base works as before.

Responses also strips a chat/completions suffix from the host, so a full chat
URL api_base reaches /openai/v1/responses on that host instead of a doubled
path that AWS answers with UnknownOperationException.

* fix(bedrock): keep the env runtime endpoint behind api_base, treat an empty endpoint as unset, trim a responses route on native chat

Only the deployment's own aws_bedrock_runtime_endpoint now wins over api_base on native chat and Responses. The AWS_BEDROCK_RUNTIME_ENDPOINT env var keeps the rank each route gave it before, so a full chat/completions api_base still wins over it on native chat and any api_base wins over it on Responses

An empty aws_bedrock_runtime_endpoint counts as unset on native chat, as it already did on Responses, and a runtime endpoint ending in a responses route is trimmed before native chat adds its chat/completions path

* fix(bedrock): name the host a Bedrock call went to in the api base header

x-litellm-model-api-base now names the scheme and host of the URL a Bedrock
call went to when that host differs from api_base, and keeps api_base
otherwise. Adds tests that a caller api_base never moves a deployment pinned
to aws_bedrock_runtime_endpoint and that native chat skips an unused region
when api_base is set

* fix(bedrock): trim a full route URL api_base before adding the Converse path

* test(bedrock): type the runtime endpoint tests

* fix(bedrock): trim an /openai/v1 api_base on the Converse fallback and keep credentials out of the reported host

A json_object request on a Bedrock GPT deployment whose api_base ends in /openai/v1 fell back to Converse at /openai/v1/model/<id>/converse and failed. Converse now trims that base path too.

The reported api_base origin drops any user and password from the runtime endpoint URL.

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-19 16:40:23 -08:00
..
batches fix(bedrock): send batch jobs to a configured control-plane endpoint (#47260) 2026-10-20 12:30:16 -07:00
chat fix(bedrock): send native chat and Responses calls to aws_bedrock_runtime_endpoint like Converse (#50582) 2026-11-19 16:40:23 -08:00
count_tokens fix(bedrock): stop the prefill 400 when the last user message is empty (#50701) 2026-11-18 03:44:11 +00:00
embed fix(embeddings): let extra_body replace Bedrock embedding defaults and combine nested objects (#51710) 2026-11-16 18:48:47 +00:00
files fix(bedrock): send guarded_text parts in system and assistant messages as Converse guardContent (#51776) 2026-11-16 19:11:35 -08:00
image test: move 81 legacy live tests in pass-through, spend, batches, audio, search, guardrails, image and ocr dirs offline (#45288) 2026-10-08 02:38:12 -07:00
image_edit refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
image_generation test: move the unit half of 126 mixed legacy files into tests/unit (#45090) 2026-10-07 14:07:43 -07:00
invoke_agent refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
messages feat(messages): serve bedrock claude_platform messages on rust only (#52681) 2026-11-19 14:34:02 -08:00
passthrough fix(bedrock): bill ConverseStream at the served tier (#52565) 2026-11-18 13:04:27 -08:00
realtime fix(bedrock): run realtime guardrails on Nova Sonic sessions (#49833) 2026-11-06 13:18:48 -08:00
rerank refactor(types): replace Any with proven types in 137 files (#44478) 2026-10-05 11:01:45 -07:00
responses fix(bedrock): send native chat and Responses calls to aws_bedrock_runtime_endpoint like Converse (#50582) 2026-11-19 16:40:23 -08:00
search fix(streaming): keep merged think tags balanced and split SSE lines only on CR/LF (#48755) 2026-10-28 17:00:29 -07:00
vector_stores fix(bedrock): map OpenAI vector store search filters to AWS RetrievalFilter (#51291) 2026-11-14 13:39:43 -05:00
__init__.py test(unit): make every tests/unit directory a package so pytest collection is unique 2026-09-20 11:50:59 +00:00
event_loop_probe.py test(bedrock): detect Vault reads on the event-loop thread (#47597) 2026-10-20 10:45:04 -07:00
slow_upstream.py fix(router)!: bound fake-streamed calls by the request timeout, not stream_timeout (#47162) 2026-10-17 22:08:02 +00:00
test_anthropic_beta_support.py refactor(llms): rename model-version transformation files to family names (#48509) 2026-10-26 18:53:16 -07:00
test_base_aws_llm.py fix(bedrock): route bedrock/<region>/<model> to that region on /v1/messages (#52136) 2026-11-16 19:58:53 -08:00
test_bedrock_common_utils.py fix(bedrock)!: split the OpenAI breakpoint and Bedrock cachePoint model flags (#52180) 2026-11-16 18:50:32 -08:00
test_bedrock_model_listing.py fix(bedrock): list the account's invocable models behind bedrock/* when check_provider_endpoint is on (#43981) 2026-10-09 14:14:17 -07:00
test_bedrock_ssl_verify.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_claude_platform_provider.py feat(messages): serve bedrock claude_platform messages on rust only (#52681) 2026-11-19 14:34:02 -08:00
test_converse_context_management.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_cost_calculation.py fix(bedrock): price claude_platform calls from their own cost map rows (#48150) 2026-10-24 13:54:18 -07:00
test_cross_region_inference_profile_mapping.py feat(bedrock): serve gpt-5.6+ chat completions natively by default, with chat_completions/ opt-in for gpt-oss and grok (#44307) 2026-10-02 19:55:54 -07:00
test_guardrail_attachments.py fix(guardrails): scan or refuse attachments in the bedrock guardrail (#43383) 2026-10-10 16:48:37 -07:00
test_mantle.py feat(messages): serve bedrock mantle messages on rust only (#52328) 2026-11-18 17:36:06 -08:00
test_nova_imported_models.py fix(bedrock): route a Bedrock model id with no Invoke provider to Converse (#43290) 2026-10-30 06:27:59 -07:00
test_request_metadata.py feat(messages): serve bedrock claude_platform messages on rust only (#52681) 2026-11-19 14:34:02 -08:00
test_web_identity_session_policy.py feat(s3-log): replace the python s3_v2 logger with a rust callback (#51539) 2026-11-14 23:03:58 +00:00