litellm - ✅(Solved) Fix [Bug]: Health check strips bedrock/ prefix causing provider identification failure for models not in cost map [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#24694Fetched 2026-04-08 01:42:09
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1labeled ×1subscribed ×1

Root Cause

_update_litellm_params_for_health_check (litellm/proxy/health_check.py:260-284) strips the bedrock/ prefix from the model name before passing it to ahealth_check. After stripping, get_llm_provider can no longer identify the provider from the model name alone and falls back to checking litellm.bedrock_converse_models set. If the model is not in that set (populated from the cost map), provider identification fails.

Normal acompletion calls do NOT go through this pre-processing, so they keep the bedrock/ prefix and get_llm_provider can identify the provider by splitting on /.

Fix Action

Fixed

PR fix notes

PR #24716: Fix health check stripping bedrock/ prefix from model name

Description (problem / solution / changelog)

Fixes #24694

_update_litellm_params_for_health_check strips the bedrock/ prefix from the model name to extract the base model, but never re-adds it when assigning back to litellm_params["model"]. This causes get_llm_provider() to fail for models not in the cost map since there's no provider prefix to split on.

Re-added the bedrock/ prefix after processing so the model name retains its provider routing information.

Changed files

  • litellm/proxy/health_check.py (modified, +1/-1)
  • tests/litellm_utils_tests/test_health_check.py (modified, +15/-15)

Code Example

"bedrock/jp.anthropic.claude-sonnet-4-6"
  → get_llm_provider splits on "/" → provider="bedrock"OK

---

"bedrock/jp.anthropic.claude-sonnet-4-6"
  → _update_litellm_params_for_health_check strips "bedrock/"
"jp.anthropic.claude-sonnet-4-6"
  → get_llm_provider cannot split on "/" to find provider
  → falls back to checking bedrock_converse_models set
"jp.anthropic.claude-sonnet-4-6" not in set → provider unknown → FAIL

---

# Instead of stripping "bedrock/" entirely, keep it
# "bedrock/us-west-2/model""bedrock/model" (strip region only)
# "bedrock/jp.anthropic.claude-sonnet-4-6"unchanged (no region to strip)

---

model_list:
  - model_name: sonnet-4-6
    litellm_params:
      model: bedrock/jp.anthropic.claude-sonnet-4-6

---

# This works
response = await litellm.acompletion(
    model="bedrock/jp.anthropic.claude-sonnet-4-6",
    messages=[{"role": "user", "content": "hi"}]
)

---

GET /health → model "jp.anthropic.claude-sonnet-4-6" fails

---

# This passes health checks because jp.anthropic.claude-sonnet-4-5-20250929-v1:0
# exists in model_prices_and_context_window.json
model_list:
  - model_name: sonnet-4-5
    litellm_params:
      model: bedrock/jp.anthropic.claude-sonnet-4-5-20250929-v1:0
RAW_BUFFERClick to expand / collapse

What happened?

Health checks fail for Bedrock cross-region inference models that are not explicitly listed in model_prices_and_context_window.json, even though normal acompletion calls to the same models work fine.

Root Cause

_update_litellm_params_for_health_check (litellm/proxy/health_check.py:260-284) strips the bedrock/ prefix from the model name before passing it to ahealth_check. After stripping, get_llm_provider can no longer identify the provider from the model name alone and falls back to checking litellm.bedrock_converse_models set. If the model is not in that set (populated from the cost map), provider identification fails.

Normal acompletion calls do NOT go through this pre-processing, so they keep the bedrock/ prefix and get_llm_provider can identify the provider by splitting on /.

Flow comparison

Normal acompletion (works):

"bedrock/jp.anthropic.claude-sonnet-4-6"
  → get_llm_provider splits on "/" → provider="bedrock" → OK

Health check (fails):

"bedrock/jp.anthropic.claude-sonnet-4-6"
  → _update_litellm_params_for_health_check strips "bedrock/"
  → "jp.anthropic.claude-sonnet-4-6"
  → get_llm_provider cannot split on "/" to find provider
  → falls back to checking bedrock_converse_models set
  → "jp.anthropic.claude-sonnet-4-6" not in set → provider unknown → FAIL

Why some cross-region models pass and others don't

The bedrock_converse_models set is populated from model_prices_and_context_window.json during litellm.__init__. Models that happen to have entries in the cost map (e.g., jp.anthropic.claude-sonnet-4-5-20250929-v1:0) are in the set and pass health checks. Models without entries (e.g., jp.anthropic.claude-sonnet-4-6) are not in the set and fail.

The pre-processing logic

The _update_litellm_params_for_health_check function (added for Issue #15807) strips bedrock/ and then removes full AWS region names (us-west-2, ap-northeast-1, etc.) from the path. However, it does not account for cross-region inference profile prefixes (us., eu., jp., etc.), which use a different format (dot-separated, not path-separated).

Possible Fixes

Option A: Preserve bedrock/ prefix in health check pre-processing - only strip the region path segment, not the provider prefix:

# Instead of stripping "bedrock/" entirely, keep it
# "bedrock/us-west-2/model" → "bedrock/model" (strip region only)
# "bedrock/jp.anthropic.claude-sonnet-4-6" → unchanged (no region to strip)

Option B: Pass custom_llm_provider explicitly to ahealth_check so it doesn't need to be inferred from the model name.

Steps to Reproduce

  1. Configure a model not in the cost map with a cross-region inference profile:
model_list:
  - model_name: sonnet-4-6
    litellm_params:
      model: bedrock/jp.anthropic.claude-sonnet-4-6
  1. Verify normal calls work:
# This works
response = await litellm.acompletion(
    model="bedrock/jp.anthropic.claude-sonnet-4-6",
    messages=[{"role": "user", "content": "hi"}]
)
  1. Health check fails:
GET /health → model "jp.anthropic.claude-sonnet-4-6" fails
  1. Compare with a model that IS in the cost map:
# This passes health checks because jp.anthropic.claude-sonnet-4-5-20250929-v1:0
# exists in model_prices_and_context_window.json
model_list:
  - model_name: sonnet-4-5
    litellm_params:
      model: bedrock/jp.anthropic.claude-sonnet-4-5-20250929-v1:0

Relevant Code

  • Health check pre-processing: litellm/proxy/health_check.py _update_litellm_params_for_health_check() (line ~225)
  • Provider identification: litellm/litellm_core_utils/get_llm_provider_logic.py get_llm_provider() (line ~99)
  • bedrock_converse_models population: litellm/__init__.py (line ~724)

Related Issues

  • #24669 — Cross-region inference pricing entries unreachable due to lookup order (same root data issue, different symptom)
  • #15807 — Original issue that introduced the health check bedrock/ stripping logic

Component

Proxy

LiteLLM Version

v1.82.6

extent analysis

Fix Plan

To fix the health check issue for Bedrock cross-region inference models, we will implement Option A: Preserve the bedrock/ prefix in health check pre-processing. We will modify the _update_litellm_params_for_health_check function to only strip the region path segment, not the provider prefix.

Code Changes

# In litellm/proxy/health_check.py, update the _update_litellm_params_for_health_check function
def _update_litellm_params_for_health_check(model_name):
    # Instead of stripping "bedrock/" entirely, keep it
    # "bedrock/us-west-2/model" → "bedrock/model" (strip region only)
    # "bedrock/jp.anthropic.claude-sonnet-4-6" → unchanged (no region to strip)
    if model_name.startswith("bedrock/"):
        # Split the model name into parts
        parts = model_name.split("/")
        # Check if the second part is a region
        if len(parts) > 2 and parts[1] in ["us-west-2", "ap-northeast-1", etc.]:
            # Strip the region
            model_name = "/".join([parts[0], parts[2:]])
    return model_name

Verification

To verify the fix, follow these steps:

  1. Update the _update_litellm_params_for_health_check function with the new code.
  2. Restart the proxy service.
  3. Run a health check on a Bedrock cross-region inference model that was previously failing.
  4. Verify that the health check passes.

Extra Tips

  • Make sure to update the litellm/proxy/health_check.py file with the correct code changes.
  • If you encounter any issues during the verification process, check the proxy service logs for errors.
  • Consider adding additional logging or monitoring to ensure that the health check is working correctly for all models.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING