Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/crewai/src/crewai/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,8 @@ def _matches_provider_pattern(cls, model: str, provider: str) -> bool:
return True

if provider == "dashscope":
return model_lower.startswith("qwen")
# DashScope's OpenAI-compatible endpoint serves Qwen plus DeepSeek/Kimi/GLM/etc.
return True
Comment thread
Vidit-Ostwal marked this conversation as resolved.

if provider == "openrouter":
# OpenRouter uses org/model format but accepts anything
Expand Down
14 changes: 14 additions & 0 deletions lib/crewai/tests/llms/openai_compatible/test_openai_compatible.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,20 @@ def test_llm_creates_openai_compatible_for_dashscope(self):
assert isinstance(llm, OpenAICompatibleCompletion)
assert llm.provider == "dashscope"

def test_llm_creates_openai_compatible_for_dashscope_non_qwen(self):
"""Non-Qwen DashScope models must still use the native OpenAI-compatible path."""
with patch.dict(
os.environ,
{
"DASHSCOPE_API_KEY": "test-key",
"DASHSCOPE_BASE_URL": "https://my-dashscope.example.com/v1",
},
):
llm = LLM(model="dashscope/deepseek-v3")
assert isinstance(llm, OpenAICompatibleCompletion)
assert llm.provider == "dashscope"
assert llm.base_url == "https://my-dashscope.example.com/v1"

def test_llm_with_explicit_provider(self):
"""Test LLM with explicit provider parameter."""
with patch.dict(os.environ, {"DEEPSEEK_API_KEY": "test-key"}):
Expand Down
Loading