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]

fix(main): forward verbosity param to chat completion providers (#32254)

Mateo Wang46a8025dd69c
diff --git a/litellm/main.py b/litellm/main.py
index b3c176a1347..2ace46a16fb 100644
--- a/litellm/main.py
+++ b/litellm/main.py
@@ -582,6 +582,7 @@ async def acompletion(
"api_key": api_key,
"model_list": model_list,
"reasoning_effort": reasoning_effort,
+ "verbosity": verbosity,
"safety_identifier": safety_identifier,
"service_tier": service_tier,
"extra_headers": extra_headers,
@@ -5193,6 +5194,7 @@ def completion( # type: ignore
"parallel_tool_calls": parallel_tool_calls,
"messages": messages,
"reasoning_effort": reasoning_effort,
+ "verbosity": verbosity,
"thinking": thinking,
"web_search_options": web_search_options,
"include_server_side_tool_invocations": (
diff --git a/tests/test_litellm/test_main.py b/tests/test_litellm/test_main.py
index f24df599505..28cf4fa0744 100644
--- a/tests/test_litellm/test_main.py
+++ b/tests/test_litellm/test_main.py
@@ -638,6 +638,93 @@ def test_bedrock_llama():
)
+def _mocked_openai_chat_response(model: str) -> httpx.Response:
+ return httpx.Response(
+ status_code=200,
+ json={
+ "id": "chatcmpl-123",
+ "object": "chat.completion",
+ "created": 1677652288,
+ "model": model,
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "Hello from mocked response!",
+ },
+ "finish_reason": "stop",
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 9,
+ "completion_tokens": 12,
+ "total_tokens": 21,
+ },
+ },
+ )
+
+
+def test_completion_forwards_verbosity_in_raw_request(respx_mock: respx.MockRouter):
+ """Regression test: completion() must forward the verbosity param to the provider request body."""
+ from litellm.types.utils import CallTypes
+ from litellm.utils import return_raw_request
+
+ model = "gpt-5.2"
+ messages = [{"role": "user", "content": "hi"}]
+ respx_mock.post("https://api.openai.com/v1/chat/completions").mock(
+ return_value=_mocked_openai_chat_response(model)
+ )
+
+ request = return_raw_request(
+ endpoint=CallTypes.completion,
+ kwargs={
+ "model": model,
+ "messages": messages,
+ "verbosity": "high",
+ },
+ )
+
+ assert request["raw_request_body"]["verbosity"] == "high"
+ assert request["raw_request_body"]["model"] == model
+ assert request["raw_request_body"]["messages"] == messages
+
+
+async def test_acompletion_forwards_verbosity_to_provider_request(
+ respx_mock: respx.MockRouter, monkeypatch
+):
+ """Regression test: acompletion() must forward the verbosity param to the provider request body."""
+ original_disable_aiohttp = litellm.disable_aiohttp_transport
+ try:
+ litellm.disable_aiohttp_transport = True
+ monkeypatch.setenv("DISABLE_AIOHTTP_TRANSPORT", "True")
+ litellm.in_memory_llm_clients_cache.flush_cache()
+
+ model = "gpt-5.2"
+ messages = [{"role": "user", "content": "hi"}]
+ mock_route = respx_mock.post("https://api.openai.com/v1/chat/completions").mock(
+ return_value=_mocked_openai_chat_response(model)
+ )
+
+ response = await litellm.acompletion(
+ model=model,
+ messages=messages,
+ verbosity="low",
+ api_key="fake-openai-api-key",
+ )
+
+ assert response.choices[0].message.content == "Hello from mocked response!"
+ assert mock_route.called
+ request_body = json.loads(respx_mock.calls[0].request.read())
+ assert request_body["verbosity"] == "low"
+ assert request_body["model"] == model
+ assert request_body["messages"] == messages
+ finally:
+ litellm.disable_aiohttp_transport = original_disable_aiohttp
+ litellm.in_memory_llm_clients_cache.flush_cache()
+
+
def test_responses_api_bridge_check_strips_responses_prefix():
"""Test that responses_api_bridge_check strips 'responses/' prefix and sets mode."""
from litellm.main import responses_api_bridge_check