fix: update model_params with resolved model name in ahealth_check

After get_llm_provider strips the provider prefix from the model name
(e.g., 'ollama/ministral-3:14b' -> 'ministral-3:14b'), update
model_params['model'] so downstream calls like acompletion receive the
correct model identifier.

Without this fix, providers such as Ollama receive the prefixed model
name (e.g., 'ollama/ministral-3:14b') which causes a 404 from the
Ollama server since it doesn't recognize the prefix.

Fixes #17842
This commit is contained in:
Ethan T. 2026-03-13 13:48:32 +08:00
parent 9cd7ad2634
commit 2375a90229

View file

@ -7155,6 +7155,15 @@ async def ahealth_check(
api_base=api_base_from_params,
api_key=api_key_from_params,
)
# Update model_params with the resolved model name (provider prefix
# stripped) so that downstream calls like acompletion receive the
# correct model identifier. Without this, providers such as Ollama
# receive "ollama/model-name" instead of just "model-name", causing
# a 404 from the Ollama server. See
# https://github.com/BerriAI/litellm/issues/17842
model_params["model"] = model
if model in litellm.model_cost and mode is None:
mode = litellm.model_cost[model].get("mode")