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]

Add support for reasoning param

Sameer Kankute57e75a308296
diff --git a/docs/my-website/docs/providers/fireworks_ai.md b/docs/my-website/docs/providers/fireworks_ai.md
index 29168dce932..4589066031a 100644
--- a/docs/my-website/docs/providers/fireworks_ai.md
+++ b/docs/my-website/docs/providers/fireworks_ai.md
@@ -300,6 +300,51 @@ litellm_settings:
</TabItem>
</Tabs>
+## Reasoning Effort
+
+The `reasoning_effort` parameter is supported on select Fireworks AI models. Supported models include:
+
+<Tabs>
+<TabItem value="sdk" label="SDK">
+
+```python
+from litellm import completion
+import os
+
+os.environ["FIREWORKS_AI_API_KEY"] = "YOUR_API_KEY"
+
+response = completion(
+ model="fireworks_ai/accounts/fireworks/models/qwen3-8b",
+ messages=[
+ {"role": "user", "content": "What is the capital of France?"}
+ ],
+ reasoning_effort="low",
+)
+print(response)
+```
+
+</TabItem>
+<TabItem value="proxy" label="PROXY">
+
+```bash
+curl http://0.0.0.0:4000/v1/chat/completions \
+ -H "Content-Type: application/json" \
+ -H "Authorization: Bearer $LITELLM_KEY" \
+ -d '{
+ "model": "fireworks_ai/accounts/fireworks/models/qwen3-8b",
+ "messages": [
+ {
+ "role": "user",
+ "content": "What is the capital of France?"
+ }
+ ],
+ "reasoning_effort": "low"
+ }'
+```
+
+</TabItem>
+</Tabs>
+
## Supported Models - ALL Fireworks AI Models Supported!
:::info
diff --git a/litellm/llms/fireworks_ai/chat/transformation.py b/litellm/llms/fireworks_ai/chat/transformation.py
index a65eaf38845..81b34f80ea0 100644
--- a/litellm/llms/fireworks_ai/chat/transformation.py
+++ b/litellm/llms/fireworks_ai/chat/transformation.py
@@ -25,7 +25,11 @@ from litellm.types.utils import (
ModelResponse,
ProviderSpecificModelInfo,
)
-from litellm.utils import supports_function_calling, supports_tool_choice
+from litellm.utils import (
+ supports_function_calling,
+ supports_reasoning,
+ supports_tool_choice,
+)
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
from ..common_utils import FireworksAIException
@@ -51,6 +55,7 @@ class FireworksAIConfig(OpenAIGPTConfig):
response_format: Optional[dict] = None
user: Optional[str] = None
logprobs: Optional[int] = None
+ reasoning_effort: Optional[str] = None
# Non OpenAI parameters - Fireworks AI only params
prompt_truncate_length: Optional[int] = None
@@ -71,6 +76,7 @@ class FireworksAIConfig(OpenAIGPTConfig):
response_format: Optional[dict] = None,
user: Optional[str] = None,
logprobs: Optional[int] = None,
+ reasoning_effort: Optional[str] = None,
prompt_truncate_length: Optional[int] = None,
context_length_exceeded_behavior: Optional[Literal["error", "truncate"]] = None,
) -> None:
@@ -111,6 +117,10 @@ class FireworksAIConfig(OpenAIGPTConfig):
if supports_tool_choice(model=model, custom_llm_provider="fireworks_ai"):
supported_params.append("tool_choice")
+ # Only add reasoning_effort for models that support it
+ if supports_reasoning(model=model, custom_llm_provider="fireworks_ai"):
+ supported_params.append("reasoning_effort")
+
return supported_params
def map_openai_params(
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index 2af548ce07e..e8f2e97cc14 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -10787,6 +10787,7 @@
"mode": "chat",
"output_cost_per_token": 1.68e-06,
"source": "https://fireworks.ai/pricing",
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10799,6 +10800,7 @@
"mode": "chat",
"output_cost_per_token": 1.68e-06,
"source": "https://fireworks.ai/pricing",
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10812,6 +10814,7 @@
"output_cost_per_token": 1.2e-06,
"source": "https://fireworks.ai/models/fireworks/deepseek-v3p2",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10838,6 +10841,7 @@
"output_cost_per_token": 2.19e-06,
"source": "https://fireworks.ai/models/fireworks/glm-4p5",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10851,6 +10855,7 @@
"output_cost_per_token": 8.8e-07,
"source": "https://artificialanalysis.ai/models/glm-4-5-air",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10864,6 +10869,7 @@
"mode": "chat",
"source": "https://fireworks.ai/pricing",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10877,6 +10883,7 @@
"output_cost_per_token": 6e-07,
"source": "https://fireworks.ai/pricing",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10890,6 +10897,7 @@
"output_cost_per_token": 2e-07,
"source": "https://fireworks.ai/pricing",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -29313,7 +29321,8 @@
"input_cost_per_token": 1.2e-06,
"output_cost_per_token": 1.2e-06,
"litellm_provider": "fireworks_ai",
- "mode": "chat"
+ "mode": "chat",
+ "supports_reasoning": true
},
"fireworks_ai/accounts/fireworks/models/gpt-oss-safeguard-120b": {
"max_tokens": 131072,
diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json
index 2af548ce07e..e8f2e97cc14 100644
--- a/model_prices_and_context_window.json
+++ b/model_prices_and_context_window.json
@@ -10787,6 +10787,7 @@
"mode": "chat",
"output_cost_per_token": 1.68e-06,
"source": "https://fireworks.ai/pricing",
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10799,6 +10800,7 @@
"mode": "chat",
"output_cost_per_token": 1.68e-06,
"source": "https://fireworks.ai/pricing",
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10812,6 +10814,7 @@
"output_cost_per_token": 1.2e-06,
"source": "https://fireworks.ai/models/fireworks/deepseek-v3p2",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10838,6 +10841,7 @@
"output_cost_per_token": 2.19e-06,
"source": "https://fireworks.ai/models/fireworks/glm-4p5",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10851,6 +10855,7 @@
"output_cost_per_token": 8.8e-07,
"source": "https://artificialanalysis.ai/models/glm-4-5-air",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10864,6 +10869,7 @@
"mode": "chat",
"source": "https://fireworks.ai/pricing",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10877,6 +10883,7 @@
"output_cost_per_token": 6e-07,
"source": "https://fireworks.ai/pricing",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -10890,6 +10897,7 @@
"output_cost_per_token": 2e-07,
"source": "https://fireworks.ai/pricing",
"supports_function_calling": true,
+ "supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true
},
@@ -29313,7 +29321,8 @@
"input_cost_per_token": 1.2e-06,
"output_cost_per_token": 1.2e-06,
"litellm_provider": "fireworks_ai",
- "mode": "chat"
+ "mode": "chat",
+ "supports_reasoning": true
},
"fireworks_ai/accounts/fireworks/models/gpt-oss-safeguard-120b": {
"max_tokens": 131072,
diff --git a/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py b/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py
index e4b0928d923..43c1c413747 100644
--- a/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py
+++ b/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py
@@ -10,6 +10,7 @@ sys.path.insert(
0, os.path.abspath("../../../../..")
) # Adds the parent directory to the system path
+from litellm import supports_reasoning
from litellm.llms.fireworks_ai.chat.transformation import FireworksAIConfig
from litellm.types.llms.openai import ChatCompletionToolCallFunctionChunk
from litellm.types.utils import ChatCompletionMessageToolCall, Function, Message
@@ -57,3 +58,53 @@ def test_handle_message_content_with_tool_calls():
updated_message.tool_calls[0].function.arguments
== expected_tool_call.function.arguments
)
+
+
+def test_supports_reasoning_effort():
+ """Test that reasoning_effort is only supported for specific Fireworks AI models."""
+ # Models that support reasoning_effort
+ supported_models = [
+ "fireworks_ai/accounts/fireworks/models/qwen3-8b",
+ "fireworks_ai/accounts/fireworks/models/qwen3-32b",
+ "fireworks_ai/accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",
+ "fireworks_ai/accounts/fireworks/models/deepseek-v3p1",
+ "fireworks_ai/accounts/fireworks/models/deepseek-v3p2",
+ "fireworks_ai/accounts/fireworks/models/glm-4p5",
+ "fireworks_ai/accounts/fireworks/models/glm-4p5-air",
+ "fireworks_ai/accounts/fireworks/models/glm-4p6",
+ "fireworks_ai/accounts/fireworks/models/gpt-oss-120b",
+ "fireworks_ai/accounts/fireworks/models/gpt-oss-20b",
+ ]
+
+ # Models that don't support reasoning_effort
+ unsupported_models = [
+ "fireworks_ai/accounts/fireworks/models/llama-v3-70b-instruct",
+ "fireworks_ai/accounts/fireworks/models/mixtral-8x7b-instruct",
+ ]
+
+ for model in supported_models:
+ assert (
+ supports_reasoning(model=model, custom_llm_provider="fireworks_ai") == True
+ ), f"{model} should support reasoning_effort"
+
+ for model in unsupported_models:
+ assert (
+ supports_reasoning(model=model, custom_llm_provider="fireworks_ai") == False
+ ), f"{model} should not support reasoning_effort"
+
+
+def test_get_supported_openai_params_reasoning_effort():
+ """Test that reasoning_effort is only included in supported params for models that support it."""
+ config = FireworksAIConfig()
+
+ # Model that supports reasoning_effort
+ supported_params = config.get_supported_openai_params(
+ "fireworks_ai/accounts/fireworks/models/qwen3-8b"
+ )
+ assert "reasoning_effort" in supported_params
+
+ # Model that doesn't support reasoning_effort
+ unsupported_params = config.get_supported_openai_params(
+ "fireworks_ai/accounts/fireworks/models/llama-v3-70b-instruct"
+ )
+ assert "reasoning_effort" not in unsupported_params