Skip to content

fix(bedrock): treat an empty api_base or runtime endpoint as unset on lts/1.108.x - #50449

Merged
mateo-berri merged 2 commits into
lts/1.108.xfrom
litellm_backport_bedrock_empty_api_base_lts_1_108_x
Nov 7, 2026
Merged

mateo-berri merged 2 commits into
lts/1.108.xfrom
litellm_backport_bedrock_empty_api_base_lts_1_108_x

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Handwritten 1-3 sentence description

This brings the empty api_base fix for Bedrock to the 1.108 LTS line. A Bedrock model set up with api_base: "" crashed with "'NoneType' object has no attribute 'split'", a 500 on /v1/messages/count_tokens, and now those requests go to the region's default Bedrock host, the same as when api_base is left out. The main forward-port is tracked in #51244. This LTS PR historically merged first, and that ordering remains recorded

Details

Link to Devin session: https://app.devin.ai/sessions/b02b146468e1400f8108b20364bb5708
Open in Devin Desktop: https://app.devin.ai/desktop/session/b02b146468e1400f8108b20364bb5708?variant=devin
Requested by: @mateo-berri

TLDR

Fix for lts/1.108.x, historically merged before its main twin #51244

Problem this solves:

  • A Bedrock deployment with api_base: "" failed every request
  • count_tokens and /v1/messages answered 500, other routes 400

How it solves it:

  • An empty api_base or aws_bedrock_runtime_endpoint now counts as unset
  • Requests then go to the region's default Bedrock runtime host

Backport checklist

  • 9bcb039ac2 from the unmerged litellm_fix_bedrock_empty_api_base branch, picked as 534aeb2d88 with its author and a provenance line. Its main forward-port is fix(bedrock): treat an empty api_base or runtime endpoint as unset #51244, with the earlier LTS landing preserved as a historical finding
  • ec312bb5e9 from the same branch, picked as 03fc76ed8d, keeps skipping a non-string runtime endpoint as the line did before
  • Both applied clean, with no conflicts
  • The 8 picked test cases pass on the line, and all 8 fail with the line's old code
  • No dependency bumps. Every lock finding on this line is also on main or has no fixed release
  • No enterprise/ or litellm-proxy-extras/ change, so no package bump
  • Gauntlet-mini: SURVIVED, 5/5 lenses, 0 confirmed (all fixed), run c78dff89215d, reviewed 534aeb2
    • Strongest dissent, rejected at first and then confirmed by CI: a non-string aws_bedrock_runtime_endpoint was used as the host instead of skipped. Two Bedrock image tests failed on it, and the second pick restores the old check
    • Rejected: a whitespace-only api_base still crashes, as it does on the line today. Only an exact empty string counts as unset, the same as main
    • Rejected: the new test has one blank line above it instead of two. That matches the rest of the file, and no lint gate checks it

User Flow

Before: a developer whose Bedrock deployment has api_base: "" gets an error on every request, even though the same deployment without api_base works

  1. The proxy admin adds a Bedrock Claude deployment with aws_region_name: us-east-1 and api_base: "", as a templated config renders an unset value
  2. The developer sends POST https://litellm-domain/v1/messages/count_tokens for that model with one user message
  3. The proxy answers 500 CountTokens processing error: 'NoneType' object has no attribute 'split'
  4. POST https://litellm-domain/v1/messages answers 500 with the same error, and /v1/chat/completions answers 400 with a server traceback in the message

After: the same requests go to the region's default Bedrock host and come back normally

  1. The proxy admin adds a Bedrock Claude deployment with aws_region_name: us-east-1 and api_base: "", as a templated config renders an unset value
  2. The developer sends POST https://litellm-domain/v1/messages/count_tokens for that model with one user message
  3. The proxy answers 200 with input_tokens, the same as a deployment with no api_base
  4. POST https://litellm-domain/v1/messages and /v1/chat/completions answer 200 with the model's reply, and an empty aws_bedrock_runtime_endpoint behaves the same
Decisions

An empty value now means unset, instead of a 400 that names the setting. Either would have fixed the crash. I went with unset because an empty URL is never a real endpoint, a templated config renders an unset value as an empty string, and the AWS_BEDROCK_RUNTIME_ENDPOINT env var already worked this way

The same rule covers aws_bedrock_runtime_endpoint, which crashed /v1/messages the same way

The fix is in the endpoint lookup that every Bedrock route shares, not in count_tokens alone, since chat, messages, responses, embeddings, and the Bedrock pass-through all crashed the same way

Only an exact empty string counts as unset. A whitespace-only value is still used as written, since no config renderer we know of produces one

A non-string aws_bedrock_runtime_endpoint from a broken config is still skipped, as it was before, so only an empty string changes meaning. The first commit dropped that check, and the Bedrock image tests caught it

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Last updated: 03fc76e. QA ran on 534aeb2. Changes since QA: the second pick restores the string check on the runtime endpoint. Proof remains valid because it only changes non-string values, and the QA config sets none. Verification: the Bedrock image tests and the picked tests pass

Each leg ran python litellm/proxy/proxy_cli.py --config config.yaml --host 127.0.0.1 --port <port> --num_workers 2 from a clean checkout of the stated commit, with no database and Bedrock credentials for us-east-1. Both legs sent the same curl and Anthropic SDK requests to real Bedrock

config.yaml
model_list:
  - model_name: litellm-qa-bedrock-empty-api-base
    litellm_params:
      model: bedrock/us.anthropic.claude-opus-5-5
      aws_region_name: us-east-1
      api_base: ""
    model_info:
      token_count_model: {}
  - model_name: litellm-qa-bedrock-sonnet46-empty-api-base
    litellm_params:
      model: bedrock/us.anthropic.claude-sonnet-4-6
      aws_region_name: us-east-1
      api_base: ""
  - model_name: litellm-qa-bedrock-empty-runtime-endpoint
    litellm_params:
      model: bedrock/us.anthropic.claude-opus-5-5
      aws_region_name: us-east-1
      aws_bedrock_runtime_endpoint: ""
  - model_name: litellm-qa-bedrock-explicit-api-base
    litellm_params:
      model: bedrock/us.anthropic.claude-opus-5-5
      aws_region_name: us-east-1
      api_base: https://bedrock-runtime.us-east-1.amazonaws.com
  - model_name: litellm-qa-bedrock-embed-empty-api-base
    litellm_params:
      model: bedrock/amazon.titan-embed-text-v2:0
      aws_region_name: us-east-1
      api_base: ""
Case Before After
count_tokens, Opus 5.5, api_base "" 500 200
count_tokens, Sonnet 4.6, api_base "" 500 200
messages stream, Opus 5.5, api_base "" 500 200
chat stream, Opus 5.5, api_base "" 400 200
responses, Opus 5.5, api_base "" 400 200
embeddings, Titan v2, api_base "" 400 200
Bedrock passthrough converse, Sonnet 4.6, api_base "" 400 200
messages, Opus 5.5, api_base "" 500 200
chat, Opus 5.5, api_base "" 400 200
messages, Opus 5.5, aws_bedrock_runtime_endpoint "" 500 200
count_tokens, Opus 5.5, aws_bedrock_runtime_endpoint "" 200 200
control: messages, Opus 5.5, explicit api_base 200 200
control: count_tokens, Opus 5.5, explicit api_base 200 200
Anthropic Python SDK 2.3.0, messages.count_tokens on the api_base "" deployment 500 200

Before (831a14c)

  1. curl -sS http://127.0.0.1:<port>/v1/messages/count_tokens -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","messages":[{"role":"user","content":"hello world"}]}'
  2. The proxy answers HTTP 500 {"type":"error","error":{"type":"api_error","message":"CountTokens processing error: 'NoneType' object has no attribute 'split'"}}
Every case, raw output
== tree 831a14c8f4, dirty files outside tests/: 0
== proxy http://127.0.0.1:23134, started as: --num_workers 2, uvicorn worker processes: 2

### count_tokens, Opus 5.5, api_base ""
$ curl -sS http://127.0.0.1:23134/v1/messages/count_tokens -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","messages":[{"role":"user","content":"hello world"}]}'
{"type":"error","error":{"type":"api_error","message":"CountTokens processing error: 'NoneType' object has no attribute 'split'"}}
HTTP 500

### count_tokens, Sonnet 4.6, api_base ""
$ curl -sS http://127.0.0.1:23134/v1/messages/count_tokens -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-sonnet46-empty-api-base","messages":[{"role":"user","content":"hello world"}]}'
{"type":"error","error":{"type":"api_error","message":"CountTokens processing error: 'NoneType' object has no attribute 'split'"}}
HTTP 500

### messages stream, Opus 5.5, api_base ""
$ curl -sS -N http://127.0.0.1:23134/v1/messages -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","max_tokens":16,"stream":true,"messages":[{"role":"user","content":"say hi"}]}'
{"type":"error","error":{"type":"api_error","message":"'NoneType' object has no attribute 'split'"}}
HTTP 500

### chat stream, Opus 5.5, api_base ""
$ curl -sS -N http://127.0.0.1:23134/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","max_tokens":16,"stream":true,"messages":[{"role":"user","content":"say hi"}]}'
{"error":{"message":"Invalid request format: litellm.APIConnectionError: 'NoneType' object has no attribute 'split'\nTraceback (most recent call last):\n  File \"/tmp/wt_lts_1_108_x_base/litellm/main.py\", line 704, in acompletion\n    response = await _resolve_dispatched_chat_response(init_response)\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/main.py\", line 769, in _resolve_dispatched_chat_response\n    return await pending\n           ^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/chat/converse_handler.py\", line 127, in async_streaming\n    prepped: Final = await run_aws_signing(\n                     ^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/base_aws_llm.py\", line 1811, in run_aws_signing\n    return await asyncio.get_running_loop().run_in_executor(\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/concurrent/futures/thread.py\", line 58, in run\n    result = self.fn(*self.args, **self.kwargs)\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/base_aws_llm.py\", line 1662, in get_request_headers\n    sigv4.add_auth(request)\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 438, in add_auth\n    canonical_request = self.canonical_request(request)\n                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 379, in canonical_request\n    cr.append(self.canonical_headers(headers_to_sign) + '\\n')\n              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 314, in canonical_headers\n    value = ','.join(\n            ^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 315, in <genexpr>\n    self._header_value(v) for v in headers_to_sign.get_all(key)\n    ^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 326, in _header_value\n    return ' '.join(value.split())\n                    ^^^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'split'\n\nThis looks like a bug in LiteLLM rather than in your request. File it with one click (prefilled, no request data or error text, review before submitting): https://github.com/BerriAI/litellm/issues/new?template=bug_report.yml&labels=bug&title=%5BBug%5D%3A+AttributeError+in+litellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py&version=1.108.2&domain=Python+SDK%3A+the+litellm+package+itself&description=Auto-generated+by+LiteLLM%27s+bug+report+link.+It+carries+no+request+data+or+error+text.+Please+describe+what+you+were+doing%2C+and+paste+the+error+message+from+your+log+below+if+it+contains+nothing+sensitive.%0A%0A%60%60%60%0A%0A%60%60%60%0A%0AException%3A+%60AttributeError%60%0A%0ALiteLLM+frames%3A%0A%60%60%60%0Alitellm%2Fmain.py%3A704+in+acompletion%0Alitellm%2Fmain.py%3A769+in+_resolve_dispatched_chat_response%0Alitellm%2Fllms%2Fbedrock%2Fchat%2Fconverse_handler.py%3A127+in+async_streaming%0Alitellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py%3A1811+in+run_aws_signing%0Alitellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py%3A1662+in+get_request_headers%0A%60%60%60%0A%0ASurface%3A+sdk%0AEndpoint+%2F+call%3A+unknown%0AProvider%3A+bedrock%0ALiteLLM%3A+1.108.2%0APython%3A+3.12.3%0A&deployment=pip+%2F+Python+SDK\n\nLiteLLM: model group 'litellm-qa-bedrock-empty-api-base' failed with the error above. No fallback was attempted. LiteLLM Retried: 2 times, LiteLLM Max Retries: 2","type":"invalid_request_error","param":null,"code":"400"}}
HTTP 400

### responses, Opus 5.5, api_base ""
$ curl -sS http://127.0.0.1:23134/v1/responses -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","max_output_tokens":16,"input":"say hi"}'
{"error":{"message":"Invalid request format: litellm.APIConnectionError: 'NoneType' object has no attribute 'split'\nTraceback (most recent call last):\n  File \"/tmp/wt_lts_1_108_x_base/litellm/main.py\", line 704, in acompletion\n    response = await _resolve_dispatched_chat_response(init_response)\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/main.py\", line 769, in _resolve_dispatched_chat_response\n    return await pending\n           ^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/chat/converse_handler.py\", line 199, in async_completion\n    prepped: Final = await run_aws_signing(\n                     ^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/base_aws_llm.py\", line 1811, in run_aws_signing\n    return await asyncio.get_running_loop().run_in_executor(\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/concurrent/futures/thread.py\", line 58, in run\n    result = self.fn(*self.args, **self.kwargs)\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/base_aws_llm.py\", line 1662, in get_request_headers\n    sigv4.add_auth(request)\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 438, in add_auth\n    canonical_request = self.canonical_request(request)\n                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 379, in canonical_request\n    cr.append(self.canonical_headers(headers_to_sign) + '\\n')\n              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 314, in canonical_headers\n    value = ','.join(\n            ^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 315, in <genexpr>\n    self._header_value(v) for v in headers_to_sign.get_all(key)\n    ^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 326, in _header_value\n    return ' '.join(value.split())\n                    ^^^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'split'\n\nThis looks like a bug in LiteLLM rather than in your request. File it with one click (prefilled, no request data or error text, review before submitting): https://github.com/BerriAI/litellm/issues/new?template=bug_report.yml&labels=bug&title=%5BBug%5D%3A+AttributeError+in+litellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py&version=1.108.2&domain=Python+SDK%3A+the+litellm+package+itself&description=Auto-generated+by+LiteLLM%27s+bug+report+link.+It+carries+no+request+data+or+error+text.+Please+describe+what+you+were+doing%2C+and+paste+the+error+message+from+your+log+below+if+it+contains+nothing+sensitive.%0A%0A%60%60%60%0A%0A%60%60%60%0A%0AException%3A+%60AttributeError%60%0A%0ALiteLLM+frames%3A%0A%60%60%60%0Alitellm%2Fmain.py%3A704+in+acompletion%0Alitellm%2Fmain.py%3A769+in+_resolve_dispatched_chat_response%0Alitellm%2Fllms%2Fbedrock%2Fchat%2Fconverse_handler.py%3A199+in+async_completion%0Alitellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py%3A1811+in+run_aws_signing%0Alitellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py%3A1662+in+get_request_headers%0A%60%60%60%0A%0ASurface%3A+sdk%0AEndpoint+%2F+call%3A+unknown%0AProvider%3A+bedrock%0ALiteLLM%3A+1.108.2%0APython%3A+3.12.3%0A&deployment=pip+%2F+Python+SDK\n\nLiteLLM: model group 'litellm-qa-bedrock-empty-api-base' failed with the error above. No fallback was attempted. LiteLLM Retried: 2 times, LiteLLM Max Retries: 2","type":"invalid_request_error","param":null,"code":"400"}}
HTTP 400

### embeddings, Titan v2, api_base ""
$ curl -sS http://127.0.0.1:23134/v1/embeddings -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-embed-empty-api-base","input":"hello world","dimensions":256}'
{"error":{"message":"Invalid request format: litellm.APIConnectionError: 'NoneType' object has no attribute 'split'\nTraceback (most recent call last):\n  File \"/tmp/wt_lts_1_108_x_base/litellm/main.py\", line 6393, in aembedding\n    response = await init_response\n               ^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/embed/embedding.py\", line 344, in _async_single_func_embeddings\n    prepped = await run_aws_signing(\n              ^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/base_aws_llm.py\", line 1811, in run_aws_signing\n    return await asyncio.get_running_loop().run_in_executor(\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/concurrent/futures/thread.py\", line 58, in run\n    result = self.fn(*self.args, **self.kwargs)\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/base_aws_llm.py\", line 1662, in get_request_headers\n    sigv4.add_auth(request)\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 438, in add_auth\n    canonical_request = self.canonical_request(request)\n                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 379, in canonical_request\n    cr.append(self.canonical_headers(headers_to_sign) + '\\n')\n              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 314, in canonical_headers\n    value = ','.join(\n            ^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 315, in <genexpr>\n    self._header_value(v) for v in headers_to_sign.get_all(key)\n    ^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 326, in _header_value\n    return ' '.join(value.split())\n                    ^^^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'split'\n\nThis looks like a bug in LiteLLM rather than in your request. File it with one click (prefilled, no request data or error text, review before submitting): https://github.com/BerriAI/litellm/issues/new?template=bug_report.yml&labels=bug&title=%5BBug%5D%3A+AttributeError+in+litellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py&version=1.108.2&domain=Python+SDK%3A+the+litellm+package+itself&description=Auto-generated+by+LiteLLM%27s+bug+report+link.+It+carries+no+request+data+or+error+text.+Please+describe+what+you+were+doing%2C+and+paste+the+error+message+from+your+log+below+if+it+contains+nothing+sensitive.%0A%0A%60%60%60%0A%0A%60%60%60%0A%0AException%3A+%60AttributeError%60%0A%0ALiteLLM+frames%3A%0A%60%60%60%0Alitellm%2Fmain.py%3A6393+in+aembedding%0Alitellm%2Fllms%2Fbedrock%2Fembed%2Fembedding.py%3A344+in+_async_single_func_embeddings%0Alitellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py%3A1811+in+run_aws_signing%0Alitellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py%3A1662+in+get_request_headers%0A%60%60%60%0A%0ASurface%3A+sdk%0AEndpoint+%2F+call%3A+unknown%0AProvider%3A+bedrock%0ALiteLLM%3A+1.108.2%0APython%3A+3.12.3%0A&deployment=pip+%2F+Python+SDK\n\nLiteLLM: model group 'litellm-qa-bedrock-embed-empty-api-base' failed with the error above. No fallback was attempted. LiteLLM Retried: 2 times, LiteLLM Max Retries: 2","type":"invalid_request_error","param":null,"code":"400"}}
HTTP 400

### Bedrock passthrough converse, Sonnet 4.6, api_base ""
$ curl -sS http://127.0.0.1:23134/bedrock/model/litellm-qa-bedrock-sonnet46-empty-api-base/converse -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"messages":[{"role":"user","content":[{"text":"say hi"}]}],"inferenceConfig":{"maxTokens":16}}'
{"error":{"message":"Invalid request format: 'NoneType' object has no attribute 'split'","type":"invalid_request_error","param":null,"code":"400"}}
HTTP 400

### messages, Opus 5.5, api_base ""
$ curl -sS http://127.0.0.1:23134/v1/messages -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","max_tokens":16,"messages":[{"role":"user","content":"say hi"}]}'
{"type":"error","error":{"type":"api_error","message":"'NoneType' object has no attribute 'split'"}}
HTTP 500

### chat, Opus 5.5, api_base ""
$ curl -sS http://127.0.0.1:23134/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","max_tokens":16,"messages":[{"role":"user","content":"say hi"}]}'
{"error":{"message":"Invalid request format: litellm.APIConnectionError: 'NoneType' object has no attribute 'split'\nTraceback (most recent call last):\n  File \"/tmp/wt_lts_1_108_x_base/litellm/main.py\", line 704, in acompletion\n    response = await _resolve_dispatched_chat_response(init_response)\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/main.py\", line 769, in _resolve_dispatched_chat_response\n    return await pending\n           ^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/chat/converse_handler.py\", line 199, in async_completion\n    prepped: Final = await run_aws_signing(\n                     ^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/base_aws_llm.py\", line 1811, in run_aws_signing\n    return await asyncio.get_running_loop().run_in_executor(\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/concurrent/futures/thread.py\", line 58, in run\n    result = self.fn(*self.args, **self.kwargs)\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x_base/litellm/llms/bedrock/base_aws_llm.py\", line 1662, in get_request_headers\n    sigv4.add_auth(request)\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 438, in add_auth\n    canonical_request = self.canonical_request(request)\n                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 379, in canonical_request\n    cr.append(self.canonical_headers(headers_to_sign) + '\\n')\n              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 314, in canonical_headers\n    value = ','.join(\n            ^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 315, in <genexpr>\n    self._header_value(v) for v in headers_to_sign.get_all(key)\n    ^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/wt_lts_1_108_x/.venv/lib/python3.12/site-packages/botocore/auth.py\", line 326, in _header_value\n    return ' '.join(value.split())\n                    ^^^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'split'\n\nThis looks like a bug in LiteLLM rather than in your request. File it with one click (prefilled, no request data or error text, review before submitting): https://github.com/BerriAI/litellm/issues/new?template=bug_report.yml&labels=bug&title=%5BBug%5D%3A+AttributeError+in+litellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py&version=1.108.2&domain=Python+SDK%3A+the+litellm+package+itself&description=Auto-generated+by+LiteLLM%27s+bug+report+link.+It+carries+no+request+data+or+error+text.+Please+describe+what+you+were+doing%2C+and+paste+the+error+message+from+your+log+below+if+it+contains+nothing+sensitive.%0A%0A%60%60%60%0A%0A%60%60%60%0A%0AException%3A+%60AttributeError%60%0A%0ALiteLLM+frames%3A%0A%60%60%60%0Alitellm%2Fmain.py%3A704+in+acompletion%0Alitellm%2Fmain.py%3A769+in+_resolve_dispatched_chat_response%0Alitellm%2Fllms%2Fbedrock%2Fchat%2Fconverse_handler.py%3A199+in+async_completion%0Alitellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py%3A1811+in+run_aws_signing%0Alitellm%2Fllms%2Fbedrock%2Fbase_aws_llm.py%3A1662+in+get_request_headers%0A%60%60%60%0A%0ASurface%3A+sdk%0AEndpoint+%2F+call%3A+unknown%0AProvider%3A+bedrock%0ALiteLLM%3A+1.108.2%0APython%3A+3.12.3%0A&deployment=pip+%2F+Python+SDK\n\nLiteLLM: model group 'litellm-qa-bedrock-empty-api-base' failed with the error above. No fallback was attempted. LiteLLM Retried: 2 times, LiteLLM Max Retries: 2","type":"invalid_request_error","param":null,"code":"400"}}
HTTP 400

### messages, Opus 5.5, aws_bedrock_runtime_endpoint ""
$ curl -sS http://127.0.0.1:23134/v1/messages -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-runtime-endpoint","max_tokens":16,"messages":[{"role":"user","content":"say hi"}]}'
{"type":"error","error":{"type":"api_error","message":"'NoneType' object has no attribute 'split'"}}
HTTP 500

### count_tokens, Opus 5.5, aws_bedrock_runtime_endpoint ""
$ curl -sS http://127.0.0.1:23134/v1/messages/count_tokens -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-runtime-endpoint","messages":[{"role":"user","content":"hello world"}]}'
{"input_tokens":11,"litellm_count_source":"token_count_model","litellm_count_model":"anthropic.claude-opus-5-5"}
HTTP 200

### control: messages, Opus 5.5, explicit api_base
$ curl -sS http://127.0.0.1:23134/v1/messages -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-explicit-api-base","max_tokens":16,"messages":[{"role":"user","content":"say hi"}]}'
{"model":"litellm-qa-bedrock-explicit-api-base","id":"msg_bdrk_odanhp7bggqzaip5chae7ddpexqzvepy5rd444zla5px2qcougkq","type":"message","role":"assistant","content":[{"type":"thinking","thinking":"","signature":"CAQSzgMKEggTEAEYAjgBQgh0aGlua2luZxIMfxe4RYULnSOsrQ2PGgxVrgh/rB8TQBhKqRsiMKVanh+RL0lDNIu4jbHa16vvvAtWkORZ2fi8k4g4L4yTJAGF17sQN1PAq5Wiz+qiDirpAiegkn4zFV64xjeGSm9xxLQMQdOm0A9FnI55hbmZFXuKaaL6qU5/0OXFqILiKSs0+bxIphiHMGJnYoj08foIc6aEocdBnwowwrTUv4jbOg60eL18F4AlrOEffc7z6Y75FCShChZjiZNEEKMZCqsYUZTV23vr0cL97B4mbz4Pm2C9r0uZIeFkZtjH8S7E30o9c5I/HAn1KmBfy1GG3Yjr8BcTJwGQjZMkKoMJn+dbWPY1Tt+dvwCS3a0GE092fEMDjQdqX5lVbxg64VxTxkTAqYcCM/lntAhzgc6XzsfC2I+nZFfwn0BfcW63nVbxa84055xYKnPXg/ZbQckdIqcINaM3+dfMBANoXqP5OarwmIbAmQYclacXEEvjqVVRxVKlP7kyvOENlgSUCGDXN2POJUunmDC/JLbU6a947C8H9FN/pMaK7Ai9Ws65LYwDG9A5uciqx4CjOFUGxeafQwjJ0D3LYq4LwNOn2K4YAQ=="},{"type":"text","text":"Hi there! "}],"container":null,"stop_reason":"max_tokens","stop_sequence":null,"stop_details":null,"usage":{"input_tokens":11,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":16,"output_tokens_details":{"thinking_tokens":9},"service_tier":"standard"}}
HTTP 200

### control: count_tokens, Opus 5.5, explicit api_base
$ curl -sS http://127.0.0.1:23134/v1/messages/count_tokens -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-explicit-api-base","messages":[{"role":"user","content":"hello world"}]}'
{"input_tokens":11,"litellm_count_source":"token_count_model","litellm_count_model":"anthropic.claude-opus-5-5"}
HTTP 200

### Anthropic Python SDK 2.3.0, messages.count_tokens on the api_base "" deployment
$ python sdk_count_tokens.py   # anthropic.Anthropic(base_url=PROXY).messages.count_tokens(model="litellm-qa-bedrock-empty-api-base", messages=[{"role":"user","content":"hello world"}])
InternalServerError 500 {'type': 'error', 'error': {'type': 'api_error', 'message': "CountTokens processing error: 'NoneType' object has no attribute 'split'"}}

After (534aeb2)

  1. curl -sS http://127.0.0.1:<port>/v1/messages/count_tokens -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","messages":[{"role":"user","content":"hello world"}]}'
  2. The proxy answers HTTP 200 {"input_tokens":11,"litellm_count_source":"provider"}
Every case, raw output
== tree 534aeb2d88, dirty files outside tests/: 0
== proxy http://127.0.0.1:26854, started as: --num_workers 2, uvicorn worker processes: 2

### count_tokens, Opus 5.5, api_base ""
$ curl -sS http://127.0.0.1:26854/v1/messages/count_tokens -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","messages":[{"role":"user","content":"hello world"}]}'
{"input_tokens":11,"litellm_count_source":"provider"}
HTTP 200

### count_tokens, Sonnet 4.6, api_base ""
$ curl -sS http://127.0.0.1:26854/v1/messages/count_tokens -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-sonnet46-empty-api-base","messages":[{"role":"user","content":"hello world"}]}'
{"input_tokens":26,"litellm_count_source":"token_count_model","litellm_count_model":"anthropic.claude-sonnet-4-6"}
HTTP 200

### messages stream, Opus 5.5, api_base ""
$ curl -sS -N http://127.0.0.1:26854/v1/messages -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","max_tokens":16,"stream":true,"messages":[{"role":"user","content":"say hi"}]}'
event: message_start
data: {"type":"message_start","message":{"model":"litellm-qa-bedrock-empty-api-base","id":"msg_bdrk_7xx7apurvi52lfpzbb45bmzbniqzw6z43jdkqnmcrdfxw5bj45ta","type":"message","role":"assistant","content":[],"container":null,"stop_reason":null,"stop_sequence":null,"stop_details":null,"usage":{"input_tokens":11,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":4,"service_tier":"standard"}}}

event: content_block_start
data: {"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}}

event: content_block_delta
data: {"type": "content_block_delta", "index": 0, "delta": {"type": "text_delta", "text": "Hi!"}}

event: content_block_delta
data: {"type": "content_block_delta", "index": 0, "delta": {"type": "text_delta", "text": " \ud83d\udc4b How can"}}

event: content_block_delta
data: {"type": "content_block_delta", "index": 0, "delta": {"type": "text_delta", "text": " I help you today?"}}

event: content_block_delta
data: {"type": "content_block_delta", "index": 0, "delta": {"type": "text_delta", "text": "\n\n"}}

event: content_block_stop
data: {"type": "content_block_stop", "index": 0}

event: message_delta
data: {"type": "message_delta", "delta": {"stop_reason": "max_tokens", "stop_sequence": null, "stop_details": null, "container": null}, "usage": {"input_tokens": 11, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0, "output_tokens": 16, "output_tokens_details": {"thinking_tokens": 0}, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0}}}

event: message_stop
data: {"type": "message_stop", "usage": {"input_tokens": 11, "output_tokens": 16}}


HTTP 200

### chat stream, Opus 5.5, api_base ""
$ curl -sS -N http://127.0.0.1:26854/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","max_tokens":16,"stream":true,"messages":[{"role":"user","content":"say hi"}]}'
data: {"id":"chatcmpl-a71f1d42-711f-4e95-8a9a-a6fd7f6d0a68","created":1793998122,"model":"litellm-qa-bedrock-empty-api-base","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Hi! How can I help","role":"assistant"}}],"provider_specific_fields":{}}

data: {"id":"chatcmpl-a71f1d42-711f-4e95-8a9a-a6fd7f6d0a68","created":1793998122,"model":"litellm-qa-bedrock-empty-api-base","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" you today?"}}],"provider_specific_fields":{}}

data: {"id":"chatcmpl-a71f1d42-711f-4e95-8a9a-a6fd7f6d0a68","created":1793998122,"model":"litellm-qa-bedrock-empty-api-base","object":"chat.completion.chunk","choices":[{"finish_reason":"stop","index":0,"delta":{}}],"provider_specific_fields":{}}

data: [DONE]


HTTP 200

### responses, Opus 5.5, api_base ""
$ curl -sS http://127.0.0.1:26854/v1/responses -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","max_output_tokens":16,"input":"say hi"}'
{"id":"resp_Zi_SQpdr1BgG16PINQTYZ5XDYlXQu43kwcLcOYRoDfAxC83ad2G5D3EBbHAlPZGgBgxbFBQmv1IQTNqDuCKVLQrYYtcQUhn5QNJOGmTrj-vON3URFf9MXAp7Fe8RFUc_-h1Z8KTiFeMAUHfwe7nW580JpxA2PQorzP4gpyirzCnd5UWBp_hwvoWnECZ2MkpO03Y_U8dfSYlxZhHqJtQIY8j2SJq3E8E00WjeRCTUvFNO_9zXwDCFOjLe5khtqusTHY-CDEQQI0UpSieUcrlp-ZVYFtm0WX_R3u8bAow_B6deUq5zzXbk3LTrlJMKOT_TKiw-y4J1ehlB1LFwWg2Dm23Ry5YeTYFYmALES-w6p-JlFHny7eQcfqrdzPCrEepjQE13n1O0gdsBvod11YKSouEKpkL44K8az-Q-L9hSuSlC0ctHXMLbrlZMUgMZa4hXIOeOiAJQ","created_at":1793998124,"error":null,"incomplete_details":{"reason":"max_output_tokens"},"instructions":null,"metadata":{},"model":"litellm-qa-bedrock-empty-api-base","object":"response","output":[{"type":"message","id":"msg_aba02ef4-b9cf-4d0d-9a0b-badb4a56b194","status":"incomplete","role":"assistant","content":[{"type":"output_text","text":"Hi! 👋 How can I help you today?\n\n","annotations":[]}],"phase":null}],"parallel_tool_calls":false,"temperature":null,"tool_choice":"auto","tools":[],"top_p":null,"max_output_tokens":16,"previous_response_id":null,"reasoning":null,"status":"incomplete","text":{},"truncation":null,"usage":{"input_tokens":11,"input_tokens_details":{"audio_tokens":null,"cached_tokens":0,"cached_tokens_details":null,"image_tokens":null,"text_tokens":11,"video_tokens":null,"cache_write_tokens":0},"output_tokens":16,"output_tokens_details":{"audio_tokens":null,"reasoning_tokens":0,"text_tokens":16},"total_tokens":27,"cost":null},"user":null,"store":null}
HTTP 200

### embeddings, Titan v2, api_base ""
$ curl -sS http://127.0.0.1:26854/v1/embeddings -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-embed-empty-api-base","input":"hello world","dimensions":256}'
{"model":"litellm-qa-bedrock-embed-empty-api-base","data":[{"embedding":[-0.03639114275574684,0.0999983549118042,0.012661511078476906,-0.015936287119984627,0.06937195360660553,-0.04475763812661171,0.05601125583052635,-0.02162255346775055,0.03454091027379036,0.024476386606693268,-0.011981348507106304,-0.017467843368649483,0.0007949117571115494,-0.14857061207294464,0.03854578733444214,-0.031068742275238037,-0.06025395914912224,-0.021827075630426407,0.025566788390278816,-0.04764476791024208,-0.012166847474873066,0.08845935016870499,-0.013479611836373806,-0.033822692930698395,-0.07642211765050888,-0.05774258077144623,0.003995368257164955,-0.05077328160405159,0.023097030818462372,-0.0007895608432590961,0.13775697350502014,-0.012157334014773369,0.0051369015127420425,-0.028785675764083862,0.019501199945807457,0.1002219021320343,0.052282243967056274,-0.024267105385661125,0.053595010191202164,-0.04305484518408775,0.09012824296951294,0.001510153990238905,-0.007372405845671892,0.02182232029736042,-0.023163624107837677,0.04881008341908455,0.048229802399873734,0.07798578590154648,0.09773372113704681,-0.001636198372580111,-0.007029945496469736,-0.03514021635055542,-0.0917983427643776,0.07401419430971146,-0.03570146858692169,-0.0040268790908157825,0.027101915329694748,0.048984281718730927,-0.06175697594881058,0.005232029594480991,0.009655473753809929,-0.006402101833373308,0.16303004324436188,-0.014860152266919613,-0.00441393069922924,-0.10378444194793701,-0.06358343362808228,0.008276118896901608,-0.07968856394290924,0.034968987107276917,0.006050128489732742,-0.001255687209777534,-0.019177766516804695,-0.09778425842523575,-0.005320023279637098,-0.01423112116754055,0.024193381890654564,0.013127638027071953,-0.05449872091412544,0.21423973143100739,0.06034908816218376,-0.00624038465321064,-0.033484991639852524,0.004889569245278835,0.008961040526628494,-0.04199892655014992,0.09669266641139984,0.021280093118548393,-0.00420227088034153,-0.02833857573568821,-0.027691705152392387,-0.000623087165877223,0.05193978548049927,0.05130242928862572,0.13927187025547028,-0.043863434344530106,0.034169912338256836,-0.08117375522851944,-0.07180247455835342,-0.02750145085155964,0.008052568882703781,-0.008152453228831291,0.06921499222517014,-0.01319422759115696,0.08900158107280731,-0.04575647786259651,-0.05545000359416008,0.06820663809776306,0.0201772041618824,0.04429151117801666,0.06130273640155792,0.02443833462893963,0.04316127300262451,-0.048952773213386536,0.05661056190729141,-0.0639478862285614,0.017950618639588356,0.04042932018637657,0.07885605096817017,0.06752172112464905,-0.017736580222845078,-0.004071470350027084,-0.041787270456552505,-0.020140936598181725,0.03509027138352394,-0.009151295758783817,-0.020742619410157204,-0.016985071823000908,-0.06342171132564545,0.08850869536399841,0.0977913960814476,-0.06748367100954056,0.04222248122096062,-0.019615354016423225,0.05054616183042526,-0.026883119717240334,-0.17022646963596344,0.0990530252456665,-0.09358198940753937,-0.00991707481443882,-0.008634929545223713,0.03558731451630592,0.048553235828876495,-0.13711722195148468,0.17398875951766968,-0.019168255850672722,-0.01836918108165264,-0.03224832937121391,-0.02488543651998043,-0.06158693507313728,-0.1379733681678772,0.03936389088630676,-0.001636198372580111,0.004480520263314247,0.0027634629514068365,0.12034144997596741,0.020653435960412025,0.08785291761159897,-0.06615187972784042,0.07814987748861313,0.006266544573009014,0.0010832678526639938,0.12224874645471573,-0.026453854516148567,0.06811627000570297,-0.08540575206279755,-0.03309020772576332,-0.05953098461031914,0.018067149445414543,0.029603775590658188,-0.030723905190825462,-0.047754161059856415,-0.011986104771494865,0.10090207308530807,-0.03894057124853134,0.16933701932430267,-0.05637095496058464,-0.00919707678258419,-0.10732319951057434,-0.006069154478609562,0.05988801270723343,-0.04649847745895386,-0.006354538258165121,-0.08369345217943192,0.031981971114873886,-0.030507490038871765,0.04210356995463371,-0.06403052806854248,0.0012842253781855106,0.008390272967517376,-0.05931694805622101,0.011401068419218063,0.014630657620728016,-0.08193358033895493,-0.014212096109986305,0.054719895124435425,-0.1281181424856186,-0.03358011692762375,0.02847413159906864,0.060049429535865784,-0.04395856335759163,-0.08276119828224182,0.054784104228019714,0.05728596821427345,-0.04963769391179085,0.06967160850763321,-0.023732010275125504,0.018604325130581856,0.07144098728895187,-0.043149977922439575,0.018064772710204124,-0.08851286768913269,-0.026778478175401688,-0.06580942124128342,0.004680288024246693,-0.038222357630729675,0.11297380179166794,-0.10467864573001862,-0.115846648812294,0.04125693067908287,0.001241417950950563,0.06119571626186371,-0.06355013698339462,0.029679875820875168,0.03184879198670387,-0.02205687016248703,0.005127389449626207,-0.0755314826965332,0.05736207216978073,0.025294484570622444,-0.04262914881110191,0.07564564049243927,-0.05047481507062912,0.03195343166589737,-0.0532715767621994,-0.033582497388124466,-0.0364910289645195,-0.009122757241129875,0.003774195909500122,0.03778476640582085,-0.025532305240631104,-0.10108281672000885,-0.048591285943984985,0.08905865997076035,0.03237675130367279,0.0893808975815773,-0.02765900455415249,0.054831672459840775,-0.08497292548418045,-0.2940590977668762,0.06468642503023148,-0.06924352794885635,0.032210275530815125,0.05955001339316368,-0.04484325274825096,0.008409298956394196],"index":0,"object":"embedding"}],"object":"list","usage":{"completion_tokens":0,"prompt_tokens":3,"total_tokens":3,"completion_tokens_details":null,"prompt_tokens_details":null}}
HTTP 200

### Bedrock passthrough converse, Sonnet 4.6, api_base ""
$ curl -sS http://127.0.0.1:26854/bedrock/model/litellm-qa-bedrock-sonnet46-empty-api-base/converse -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"messages":[{"role":"user","content":[{"text":"say hi"}]}],"inferenceConfig":{"maxTokens":16}}'
{"metrics":{"latencyMs":942},"output":{"message":{"content":[{"text":"Hi there! 👋 How are you doing? Is there something I"}],"role":"assistant"}},"stopReason":"max_tokens","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":9,"outputTokens":16,"serverToolUsage":{},"totalTokens":25}}
HTTP 200

### messages, Opus 5.5, api_base ""
$ curl -sS http://127.0.0.1:26854/v1/messages -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","max_tokens":16,"messages":[{"role":"user","content":"say hi"}]}'
{"model":"litellm-qa-bedrock-empty-api-base","id":"msg_bdrk_323pml27kro5622ss52aqdb2b6eksgv6v3ynjj5sab2cq7lg22wq","type":"message","role":"assistant","content":[{"type":"text","text":"Hi! 👋 How can I help you today?\n\n"}],"container":null,"stop_reason":"max_tokens","stop_sequence":null,"stop_details":null,"usage":{"input_tokens":11,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":16,"output_tokens_details":{"thinking_tokens":0},"service_tier":"standard"}}
HTTP 200

### chat, Opus 5.5, api_base ""
$ curl -sS http://127.0.0.1:26854/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-api-base","max_tokens":16,"messages":[{"role":"user","content":"say hi"}]}'
{"id":"chatcmpl-a76cbad5-a385-4a3d-928d-3a7147aabe2b","created":1793998129,"model":"litellm-qa-bedrock-empty-api-base","object":"chat.completion","choices":[{"finish_reason":"length","index":0,"message":{"content":"Hi there! 👋 How can I help you today?","role":"assistant"}}],"usage":{"completion_tokens":16,"prompt_tokens":11,"total_tokens":27,"completion_tokens_details":{"reasoning_tokens":0,"text_tokens":16},"prompt_tokens_details":{"cached_tokens":0,"text_tokens":11,"cache_write_tokens":0,"cache_creation_tokens":0},"cache_creation_input_tokens":0,"cache_read_input_tokens":0}}
HTTP 200

### messages, Opus 5.5, aws_bedrock_runtime_endpoint ""
$ curl -sS http://127.0.0.1:26854/v1/messages -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-runtime-endpoint","max_tokens":16,"messages":[{"role":"user","content":"say hi"}]}'
{"model":"litellm-qa-bedrock-empty-runtime-endpoint","id":"msg_bdrk_44wya2tyskizx6ou3tpgfuynnkmyfp5z7xmprlyv4lh5sdkfzbfa","type":"message","role":"assistant","content":[{"type":"text","text":"Hi! 👋 How can I help you today?\n\n"}],"container":null,"stop_reason":"max_tokens","stop_sequence":null,"stop_details":null,"usage":{"input_tokens":11,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":16,"output_tokens_details":{"thinking_tokens":0},"service_tier":"standard"}}
HTTP 200

### count_tokens, Opus 5.5, aws_bedrock_runtime_endpoint ""
$ curl -sS http://127.0.0.1:26854/v1/messages/count_tokens -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-empty-runtime-endpoint","messages":[{"role":"user","content":"hello world"}]}'
{"input_tokens":11,"litellm_count_source":"token_count_model","litellm_count_model":"anthropic.claude-opus-5-5"}
HTTP 200

### control: messages, Opus 5.5, explicit api_base
$ curl -sS http://127.0.0.1:26854/v1/messages -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-explicit-api-base","max_tokens":16,"messages":[{"role":"user","content":"say hi"}]}'
{"model":"litellm-qa-bedrock-explicit-api-base","id":"msg_bdrk_2gomovsrnncylxl7vkntdbe5i7hpuslj63oawqionkybeyfqiela","type":"message","role":"assistant","content":[{"type":"text","text":"Hi! 👋 How can I help you today?\n\n"}],"container":null,"stop_reason":"max_tokens","stop_sequence":null,"stop_details":null,"usage":{"input_tokens":11,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":16,"output_tokens_details":{"thinking_tokens":0},"service_tier":"standard"}}
HTTP 200

### control: count_tokens, Opus 5.5, explicit api_base
$ curl -sS http://127.0.0.1:26854/v1/messages/count_tokens -H "x-api-key: $LITELLM_MASTER_KEY" -H 'content-type: application/json' -d '{"model":"litellm-qa-bedrock-explicit-api-base","messages":[{"role":"user","content":"hello world"}]}'
{"input_tokens":11,"litellm_count_source":"token_count_model","litellm_count_model":"anthropic.claude-opus-5-5"}
HTTP 200

### Anthropic Python SDK 2.3.0, messages.count_tokens on the api_base "" deployment
$ python sdk_count_tokens.py   # anthropic.Anthropic(base_url=PROXY).messages.count_tokens(model="litellm-qa-bedrock-empty-api-base", messages=[{"role":"user","content":"hello world"}])
Downloading pydantic-core (2.1MiB)
 Downloaded pydantic-core
MessageTokensCount(input_tokens=11, litellm_count_source='provider')

Type

🐛 Bug Fix

Caveats (if any)

Low

  • Bedrock realtime builds its own URL and still treats api_base: "" as set. This PR leaves it alone, and main has the same gap
  • ruff check --config ruff-tests.toml tests reports 2 errors in files this PR does not touch. The line's tip 831a14c8f4 has the same 2
  • 9 tests in test_main.py and test_router.py fail locally on the line's tip too, for reasons unrelated to this PR

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
Bugbot summary

[!NOTE]
Medium Risk
Adjusting the shared Bedrock endpoint resolver could misroute AWS traffic if the precedence rules are wrong, so reviewers should double-check signing paths beyond the covered cases.

Overview
Bedrock runtime routing

  • BaseAWSLLM.get_runtime_endpoint now treats blank api_base/aws_bedrock_runtime_endpoint values as unset, pulling credentials from get_secret_str("AWS_BEDROCK_RUNTIME_ENDPOINT") before defaulting to the regional Bedrock hostname and reusing that resolution for the proxy target.

Regression coverage

  • Adds async token-counter coverage plus parametrized unit tests around the new empty-string scenarios to ensure traffic still reaches the expected hosts and token counts stay stable.

Reviewed by Cursor Bugbot for commit 03fc76e. Bugbot is set up for automated code reviews on this repo. Configure here.

Landing watch, November 21

Main #51244 is open at the unchanged reviewed head and needs Ryan's approval. All six required checks pass, current-tip Bugbot and Greptile are clean, and OSV remains the previously verified baseline failure

LTS #51327 remains open under the main-first hold and needs human/team approval and supported CLA resolution for the unsigned bot contributor. The maintained parity helper maps all four main commits and blocks because main has not merged

The sole driver accepted the November 21 audit and reattached GitHub notifications for both PRs. The next check is a review, comment, CI, push or merge notification. No timed reminder is active. After main approval, recheck its gates, land main first, then immediately continue LTS. Require exit 0 from the maintained helper immediately before LTS landing. Historical LTS_MERGED_BEFORE_MAIN remains preserved

Backport to lts/1.108.x ahead of its main PR.
Cherry-picked from 9bcb039 (litellm_fix_bedrock_empty_api_base).
@mateo-berri
mateo-berri requested a review from a team November 6, 2026 21:35
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@greptile-apps

greptile-apps Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge

Summary

Treats empty Bedrock endpoint settings as unset and adds tests for endpoint selection and token counting

  • Bedrock requests with empty endpoint settings use the next available host.

Reviews (2) · Last reviewed commit: "fix(bedrock): keep skipping a non-string..." · Reviewed by Greptile

@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Backport to lts/1.108.x ahead of its main PR.
Cherry-picked from ec312bb (litellm_fix_bedrock_empty_api_base).
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 03fc76e. Configure here.

@mateo-berri
mateo-berri merged commit f22a5e7 into lts/1.108.x Nov 7, 2026
65 checks passed
@mateo-berri
mateo-berri deleted the litellm_backport_bedrock_empty_api_base_lts_1_108_x branch November 7, 2026 01:28
doonga pushed a commit to greyrock-labs/home-ops that referenced this pull request Nov 10, 2026
…08.4) (#715)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/berriai/litellm](https://images.chainguard.dev/directory/image/wolfi-base/overview) ([source](https://github.com/BerriAI/litellm)) | patch | `v1.108.2` → `v1.108.4` |

---

### Release Notes

<details>
<summary>BerriAI/litellm (ghcr.io/berriai/litellm)</summary>

### [`v1.108.4`](https://github.com/BerriAI/litellm/releases/tag/v1.108.4): 1.108.4 (LTS)

[Compare Source](BerriAI/litellm@v1.108.3...v1.108.4)

> \[!TIP]
> The `lts` image tag always points to the latest LTS release. Pull `ghcr.io/berriai/litellm:lts` to stay on the newest LTS patch

#### Verify this release

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/e82a3c646908ba0a6ee0beddc4310d7a6cac4065/cosign.pub \
  ghcr.io/berriai/litellm:v1.108.4
```

Same command for `litellm-database`, `litellm-non_root` and the `docker.io/litellm/*` images

#### What's new in 1.108.4 (LTS)

10 PRs. 7 fixed, 1 changed. No action needed to upgrade

##### Changes

- **AWS Bedrock:** Fixed 400s from GLM, GPT-6 Luna and Nova 2 on Bedrock when the conversation carries Claude's signed thinking ([#&#8203;50399](BerriAI/litellm#50399))
- **AWS Bedrock:** Changed `/bedrock` pass-through routes to enforce the model's `guardrailConfig` over any guardrail the caller sends ([#&#8203;47429](BerriAI/litellm#47429))
- **Vertex AI and Gemini:** Fixed Vertex AI Claude batches failing with 404 at create ([#&#8203;50365](BerriAI/litellm#50365))
- **Messages API:** Fixed `chatgpt/` models on `/v1/messages` dropping encrypted reasoning between turns ([#&#8203;50456](BerriAI/litellm#50456))
- **Messages API:** Fixed `/v1/messages` to OpenAI sending `background: true` upstream, which billed full runs that came back empty ([#&#8203;50462](BerriAI/litellm#50462))
- **Embeddings, images and audio:** Fixed `/v1/videos` polls failing with per-model keys or hitting the wrong provider account with a 404 ([#&#8203;44614](BerriAI/litellm#44614))
- **Routing and fallbacks:** Fixed team keys being served by a proxy-wide wildcard instead of the team's own BYOK wildcard deployment ([#&#8203;48490](BerriAI/litellm#48490))
- **SDK:** Fixed `completion()`, `responses()` and `messages` with tools failing with `No module named 'mcp'` on a base install, broken since v1.106.0 ([#&#8203;45961](BerriAI/litellm#45961))

***

Backport [#&#8203;50568](BerriAI/litellm#50568) · Backport [#&#8203;50605](BerriAI/litellm#50605) · Backport [#&#8203;50693](BerriAI/litellm#50693) · [Full changelog](BerriAI/litellm@v1.108.3...v1.108.4)

### [`v1.108.3`](https://github.com/BerriAI/litellm/releases/tag/v1.108.3): 1.108.3 (LTS)

[Compare Source](BerriAI/litellm@v1.108.2...v1.108.3)

> \[!TIP]
> The `lts` image tag always points to the latest LTS release. Pull `ghcr.io/berriai/litellm:lts` to stay on the newest LTS patch

#### Verify this release

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/e82a3c646908ba0a6ee0beddc4310d7a6cac4065/cosign.pub \
  ghcr.io/berriai/litellm:v1.108.3
```

Same command for `litellm-database`, `litellm-non_root` and the `docker.io/litellm/*` images

#### What's new in 1.108.3 (LTS)

11 PRs. 3 fixed. No action needed to upgrade

##### Changes

- **AWS Bedrock:** Fixed every request failing on a Bedrock deployment with `api_base: ""`, which answered 500 or 400 ([#&#8203;50449](BerriAI/litellm#50449))
- **MCP:** Fixed tool results over 1 MiB failing with `SSE stream ended without a response`, broken since v1.103.0 ([#&#8203;47034](BerriAI/litellm#47034))
- **Guardrails:** Fixed model-level `post_call` guardrails checking each response twice and calling the moderation provider twice ([#&#8203;50463](BerriAI/litellm#50463))

***

Backport [#&#8203;50484](BerriAI/litellm#50484) · Backport [#&#8203;50487](BerriAI/litellm#50487) · [Full changelog](BerriAI/litellm@v1.108.2...v1.108.3)

</details>

---

### Configuration

📅 **Schedule**: (in timezone America/New_York)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yMjIuNSIsInVwZGF0ZWRJblZlciI6IjQ0LjIyMi41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.greyrock.io/todd/home-ops/pulls/715
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.

2 participants