Merge pull request #20258 from BerriAI/litellm_cerebras_reasoning

fix: add reasoning param support for GPT OSS cerebras
This commit is contained in:
Sameer Kankute 2026-02-02 17:42:28 +05:30 committed by GitHub
commit 7773a92069
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 5 deletions

View file

@ -7,6 +7,7 @@ this is OpenAI compatible - no translation needed / occurs
from typing import Optional
from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig
from litellm.utils import supports_reasoning
class CerebrasConfig(OpenAIGPTConfig):
@ -24,6 +25,7 @@ class CerebrasConfig(OpenAIGPTConfig):
tool_choice: Optional[str] = None
tools: Optional[list] = None
user: Optional[str] = None
reasoning_effort: Optional[str] = None
def __init__(
self,
@ -37,6 +39,7 @@ class CerebrasConfig(OpenAIGPTConfig):
tool_choice: Optional[str] = None,
tools: Optional[list] = None,
user: Optional[str] = None,
reasoning_effort: Optional[str] = None,
) -> None:
locals_ = locals().copy()
for key, value in locals_.items():
@ -53,7 +56,7 @@ class CerebrasConfig(OpenAIGPTConfig):
"""
return [
supported_params = [
"max_tokens",
"max_completion_tokens",
"response_format",
@ -67,6 +70,12 @@ class CerebrasConfig(OpenAIGPTConfig):
"user",
]
# Only add reasoning_effort for models that support it
if supports_reasoning(model=model, custom_llm_provider="cerebras"):
supported_params.append("reasoning_effort")
return supported_params
def map_openai_params(
self,
non_default_params: dict,

View file

@ -6715,13 +6715,13 @@
"supports_tool_choice": true
},
"cerebras/gpt-oss-120b": {
"input_cost_per_token": 2.5e-07,
"input_cost_per_token": 3.5e-07,
"litellm_provider": "cerebras",
"max_input_tokens": 131072,
"max_output_tokens": 32768,
"max_tokens": 32768,
"mode": "chat",
"output_cost_per_token": 6.9e-07,
"output_cost_per_token": 7.5e-07,
"source": "https://www.cerebras.ai/blog/openai-gpt-oss-120b-runs-fastest-on-cerebras",
"supports_function_calling": true,
"supports_parallel_function_calling": true,
@ -6739,6 +6739,7 @@
"output_cost_per_token": 8e-07,
"source": "https://inference-docs.cerebras.ai/support/pricing",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_tool_choice": true
},
"cerebras/zai-glm-4.6": {

View file

@ -6729,13 +6729,13 @@
"supports_tool_choice": true
},
"cerebras/gpt-oss-120b": {
"input_cost_per_token": 2.5e-07,
"input_cost_per_token": 3.5e-07,
"litellm_provider": "cerebras",
"max_input_tokens": 131072,
"max_output_tokens": 32768,
"max_tokens": 32768,
"mode": "chat",
"output_cost_per_token": 6.9e-07,
"output_cost_per_token": 7.5e-07,
"source": "https://www.cerebras.ai/blog/openai-gpt-oss-120b-runs-fastest-on-cerebras",
"supports_function_calling": true,
"supports_parallel_function_calling": true,
@ -6753,6 +6753,7 @@
"output_cost_per_token": 8e-07,
"source": "https://inference-docs.cerebras.ai/support/pricing",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_tool_choice": true
},
"cerebras/zai-glm-4.6": {