From 2375a902294575029aa07c611db544f26c7af1d0 Mon Sep 17 00:00:00 2001 From: "Ethan T." Date: Fri, 13 Mar 2026 13:48:32 +0800 Subject: [PATCH] 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 --- litellm/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/litellm/main.py b/litellm/main.py index f2ce894ba38..f4bdec500c8 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -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")