fix(clf_ai_gateway): declare each model's real reasoning_effort levels

The per-level supports_*_reasoning_effort flags cannot express the sets
this gateway actually takes, so all nine models advertised a wrong one:
every model offered "minimal" and eight offered "none", neither of which
the gateway accepts, five dropped "xhigh", which it does accept, and
qwen3.8-27b offered "high", which it rejects. That set surfaces through
/model_group/info and the model picker, so a user picking a level off it
gets a 400 from the gateway.

Declare reasoning_effort_levels instead, taken from the gateway's own
GET /v1/public/models, which resolve_supported_reasoning_efforts reads
first and uses whole. Declaring it also stops clf_ai_gateway/deepseek-v4-pro
and clf_ai_gateway/deepseek-v4-flash inheriting effort metadata from the
unprefixed deepseek entries of the same name.
This commit is contained in:
mateo-berri 2026-09-06 03:03:27 -07:00 • committed by bap1106
parent 935e8178ab
commit da8494e2f0
3 changed files with 122 additions and 20 deletions

View file

@ -78787,8 +78787,13 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"supports_max_reasoning_effort": true,
"reasoning_effort_levels": [
"none",
"low",
"medium",
"high",
"max"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78807,7 +78812,12 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"xhigh"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78827,7 +78837,12 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"xhigh"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78845,7 +78860,11 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high"
],
"supports_response_schema": true,
"supports_system_messages": true,
"source": "https://clfaigateway.dev/models"
@ -78863,7 +78882,12 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"xhigh"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78882,7 +78906,12 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"xhigh"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78901,7 +78930,11 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78921,7 +78954,11 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78941,7 +78978,11 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"xhigh"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,

View file

@ -78787,8 +78787,13 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"supports_max_reasoning_effort": true,
"reasoning_effort_levels": [
"none",
"low",
"medium",
"high",
"max"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78807,7 +78812,12 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"xhigh"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78827,7 +78837,12 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"xhigh"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78845,7 +78860,11 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high"
],
"supports_response_schema": true,
"supports_system_messages": true,
"source": "https://clfaigateway.dev/models"
@ -78863,7 +78882,12 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"xhigh"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78882,7 +78906,12 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high",
"xhigh"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78901,7 +78930,11 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78921,7 +78954,11 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"high"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,
@ -78941,7 +78978,11 @@
"supports_parallel_function_calling": true,
"supports_tool_choice": true,
"supports_reasoning": true,
"supports_low_reasoning_effort": true,
"reasoning_effort_levels": [
"low",
"medium",
"xhigh"
],
"supports_response_schema": true,
"supports_system_messages": true,
"supports_prompt_caching": true,

View file

@ -2,6 +2,7 @@ import pytest
import litellm
from litellm.llms.clf_ai_gateway.chat.transformation import ClfAiGatewayConfig
from litellm.router_utils.reasoning_effort_capability import resolve_supported_reasoning_efforts
from litellm.types.utils import LlmProviders
MODELS = [
@ -16,6 +17,18 @@ MODELS = [
"qwen3.8-27b",
]
GATEWAY_REASONING_EFFORTS = {
"glm-5.3": ("none", "low", "medium", "high", "max"),
"glm-5.3-flash": ("low", "medium", "high", "xhigh"),
"glm-5.2": ("low", "medium", "high", "xhigh"),
"glm-4.7-flash": ("low", "medium", "high"),
"deepseek-v4-pro": ("low", "medium", "high", "xhigh"),
"deepseek-v4-flash": ("low", "medium", "high", "xhigh"),
"kimi-k2.6": ("low", "medium", "high"),
"kimi-k2.7-code": ("low", "medium", "high"),
"qwen3.8-27b": ("low", "medium", "xhigh"),
}
@pytest.fixture(autouse=True)
def _local_cost_map(monkeypatch: pytest.MonkeyPatch) -> None:
@ -126,3 +139,10 @@ def test_completion_routes_without_network(monkeypatch: pytest.MonkeyPatch) -> N
mock_response="hello from mock",
)
assert response.choices[0].message.content == "hello from mock"
@pytest.mark.parametrize("model", MODELS)
def test_advertised_reasoning_efforts_match_the_gateway(model: str) -> None:
key = f"clf_ai_gateway/{model}"
entry = {**litellm.model_cost[key], "key": key}
assert resolve_supported_reasoning_efforts(entry, deployment_is_mapped=True) == GATEWAY_REASONING_EFFORTS[model]