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]

refactor(proxy): make the cursor responses-path body single-assignment

mateo-berri334e10470b84
diff --git a/litellm/proxy/response_api_endpoints/endpoints.py b/litellm/proxy/response_api_endpoints/endpoints.py
index f752986d7f4..31e2d3b72f5 100644
--- a/litellm/proxy/response_api_endpoints/endpoints.py
+++ b/litellm/proxy/response_api_endpoints/endpoints.py
@@ -537,9 +537,11 @@ async def cursor_chat_completions(
# Rebuild rather than pop: _read_request_body can return the request-scope
# cached parsed-body dict itself, and removing keys from it corrupts the
# cache's key snapshot so later readers get an empty body
- data = {key: value for key, value in raw_body.items() if key != "stream_options"} # mutable-ok: plain body dict
+ body_without_stream_options: Final = { # mutable-ok: base_process_llm_request mutates the body dict in place
+ key: value for key, value in raw_body.items() if key != "stream_options"
+ }
- data = _normalize_tool_dialect(data, to_chat=False)
+ data: Final = _normalize_tool_dialect(body_without_stream_options, to_chat=False)
processor: Final = ProxyBaseLLMRequestProcessing(data=data)