Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix get llm provider logic

Ishaan Jaff4599a0ffd3b5
diff --git a/litellm/litellm_core_utils/get_llm_provider_logic.py b/litellm/litellm_core_utils/get_llm_provider_logic.py
index 4a615acd76b..5afa966490e 100644
--- a/litellm/litellm_core_utils/get_llm_provider_logic.py
+++ b/litellm/litellm_core_utils/get_llm_provider_logic.py
@@ -55,13 +55,15 @@ def handle_cohere_chat_model_custom_llm_provider(
if custom_llm_provider == "cohere" and model in litellm.cohere_chat_models:
return model, "cohere_chat"
- _custom_llm_provider, _model = model.split("/", 1)
- if (
- _custom_llm_provider
- and _custom_llm_provider == "cohere"
- and _model in litellm.cohere_chat_models
- ):
- return _model, "cohere_chat"
+ if "/" in model:
+ _custom_llm_provider, _model = model.split("/", 1)
+ if (
+ _custom_llm_provider
+ and _custom_llm_provider == "cohere"
+ and _model in litellm.cohere_chat_models
+ ):
+ return _model, "cohere_chat"
+
return model, custom_llm_provider