Repository navigation
fix(bedrock): treat an empty api_base or runtime endpoint as unset on lts/1.108.x - #50449
Merged
mateo-berri merged 2 commits intoNov 7, 2026
Merged
mateo-berri merged 2 commits into
mateo-berri merged 2 commits into
Conversation
Backport to lts/1.108.x ahead of its main PR. Cherry-picked from 9bcb039 (litellm_fix_bedrock_empty_api_base).
Contributor
Author
Contributor
Author
|
bugbot run |
Contributor
[Medium impact] The PR appears safe to merge SummaryTreats empty Bedrock endpoint settings as unset and adds tests for endpoint selection and token counting
Reviews (2) · Last reviewed commit: "fix(bedrock): keep skipping a non-string..." · Reviewed by Greptile |
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).
Contributor
Author
Contributor
Author
|
bugbot run |
Contributor
There was a problem hiding this comment.
✅ 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
enabled auto-merge
November 6, 2026 23:00
ryan-crabbe-berri
approved these changes
Nov 7, 2026
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 ([#​50399](BerriAI/litellm#50399)) - **AWS Bedrock:** Changed `/bedrock` pass-through routes to enforce the model's `guardrailConfig` over any guardrail the caller sends ([#​47429](BerriAI/litellm#47429)) - **Vertex AI and Gemini:** Fixed Vertex AI Claude batches failing with 404 at create ([#​50365](BerriAI/litellm#50365)) - **Messages API:** Fixed `chatgpt/` models on `/v1/messages` dropping encrypted reasoning between turns ([#​50456](BerriAI/litellm#50456)) - **Messages API:** Fixed `/v1/messages` to OpenAI sending `background: true` upstream, which billed full runs that came back empty ([#​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 ([#​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 ([#​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 ([#​45961](BerriAI/litellm#45961)) *** Backport [#​50568](BerriAI/litellm#50568) · Backport [#​50605](BerriAI/litellm#50605) · Backport [#​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 ([#​50449](BerriAI/litellm#50449)) - **MCP:** Fixed tool results over 1 MiB failing with `SSE stream ended without a response`, broken since v1.103.0 ([#​47034](BerriAI/litellm#47034)) - **Guardrails:** Fixed model-level `post_call` guardrails checking each response twice and calling the moderation provider twice ([#​50463](BerriAI/litellm#50463)) *** Backport [#​50484](BerriAI/litellm#50484) · Backport [#​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
This was referenced Nov 11, 2026
3 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handwritten 1-3 sentence description
This brings the empty
api_basefix for Bedrock to the 1.108 LTS line. A Bedrock model set up withapi_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 whenapi_baseis left out. The main forward-port is tracked in #51244. This LTS PR historically merged first, and that ordering remains recordedDetails
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 #51244Problem this solves:
api_base: ""failed every requestHow it solves it:
api_baseoraws_bedrock_runtime_endpointnow counts as unsetBackport checklist
9bcb039ac2from the unmergedlitellm_fix_bedrock_empty_api_basebranch, picked as534aeb2d88with 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 findingec312bb5e9from the same branch, picked as03fc76ed8d, keeps skipping a non-string runtime endpoint as the line did beforeenterprise/orlitellm-proxy-extras/change, so no package bumpaws_bedrock_runtime_endpointwas used as the host instead of skipped. Two Bedrock image tests failed on it, and the second pick restores the old checkapi_basestill crashes, as it does on the line today. Only an exact empty string counts as unset, the same as mainUser Flow
Before: a developer whose Bedrock deployment has
api_base: ""gets an error on every request, even though the same deployment withoutapi_baseworksaws_region_name: us-east-1andapi_base: "", as a templated config renders an unset valueCountTokens processing error: 'NoneType' object has no attribute 'split'After: the same requests go to the region's default Bedrock host and come back normally
aws_region_name: us-east-1andapi_base: "", as a templated config renders an unset valueinput_tokens, the same as a deployment with noapi_baseaws_bedrock_runtime_endpointbehaves the sameDecisions
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_ENDPOINTenv var already worked this wayThe same rule covers
aws_bedrock_runtime_endpoint, which crashed/v1/messagesthe same wayThe 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_endpointfrom 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 itPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
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 moreDelays 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 2from 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 Bedrockconfig.yaml
Before (831a14c)
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"}]}'{"type":"error","error":{"type":"api_error","message":"CountTokens processing error: 'NoneType' object has no attribute 'split'"}}Every case, raw output
After (534aeb2)
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"}]}'{"input_tokens":11,"litellm_count_source":"provider"}Every case, raw output
Type
🐛 Bug Fix
Caveats (if any)
Low
api_base: ""as set. This PR leaves it alone, and main has the same gapruff check --config ruff-tests.toml testsreports 2 errors in files this PR does not touch. The line's tip831a14c8f4has the same 2test_main.pyandtest_router.pyfail locally on the line's tip too, for reasons unrelated to this PRFinal Attestation
Bugbot summary
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_MAINremains preserved