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]

feat(xai): add parallel_tool_calls to supported params (#25106)

Baqiaoec38f2b17bee
diff --git a/litellm/llms/xai/chat/transformation.py b/litellm/llms/xai/chat/transformation.py
index bfa55105a6c..64b4a545acb 100644
--- a/litellm/llms/xai/chat/transformation.py
+++ b/litellm/llms/xai/chat/transformation.py
@@ -43,6 +43,7 @@ class XAIChatConfig(OpenAIGPTConfig):
"logprobs",
"max_tokens",
"n",
+ "parallel_tool_calls",
"presence_penalty",
"response_format",
"seed",
diff --git a/tests/test_litellm/llms/xai/test_xai_chat_transformation.py b/tests/test_litellm/llms/xai/test_xai_chat_transformation.py
new file mode 100644
index 00000000000..5a236de900e
--- /dev/null
+++ b/tests/test_litellm/llms/xai/test_xai_chat_transformation.py
@@ -0,0 +1,39 @@
+import os
+import sys
+
+sys.path.insert(
+ 0, os.path.abspath("../../../..")
+) # Adds the parent directory to the system path
+
+from litellm.llms.xai.chat.transformation import XAIChatConfig
+
+
+class TestXAIParallelToolCalls:
+ """Test suite for XAI parallel tool calls functionality."""
+
+ def test_get_supported_openai_params_includes_parallel_tool_calls(self):
+ """Test that parallel_tool_calls is in supported parameters."""
+ config = XAIChatConfig()
+ supported_params = config.get_supported_openai_params(
+ "xai/grok-4.20"
+ )
+ assert "parallel_tool_calls" in supported_params
+
+ def test_transform_request_preserves_parallel_tool_calls(self):
+ """Test that transform_request preserves parallel_tool_calls parameter."""
+ config = XAIChatConfig()
+
+ messages = [{"role": "user", "content": "What's the weather like?"}]
+ optional_params = {"parallel_tool_calls": True}
+
+ result = config.transform_request(
+ model="xai/grok-4.20",
+ messages=messages,
+ optional_params=optional_params,
+ litellm_params={},
+ headers={},
+ )
+
+ assert result.get("parallel_tool_calls") is True
+ assert len(result["messages"]) == 1
+ assert result["messages"][0]["role"] == "user"