Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
test(litellm): cover standalone max_completion_tokens forwarding (#3558)
AxelRayc32b315537fe
diff --git a/tests/test_litellm_openai_passthrough.py b/tests/test_litellm_openai_passthrough.pyindex 1604102ad..79ea524a2 100644--- a/tests/test_litellm_openai_passthrough.py+++ b/tests/test_litellm_openai_passthrough.py@@ -145,6 +145,42 @@ async def test_standard_params_still_forwarded() -> None:assert kwargs["extra_body"] == {"chat_template_kwargs": {"enable_thinking": False}}+async def test_max_completion_tokens_forwarded_as_standard_param() -> None:+ backend = make_backend()+ body = request_body(max_completion_tokens=64)+ body.pop("max_tokens")++ with patch("headroom.backends.litellm.acompletion", new_callable=AsyncMock) as mock_acomp:+ mock_acomp.return_value = make_response()++ await backend.send_openai_message(body, {})++ kwargs = mock_acomp.await_args.kwargs+ assert kwargs["max_completion_tokens"] == 64+ assert "extra_body" not in kwargs+++async def test_max_completion_tokens_forwarded_as_standard_param_streaming() -> None:+ backend = make_backend()+ body = request_body(max_completion_tokens=64)+ body.pop("max_tokens")+ stream = FakeAsyncStream(+ [SimpleNamespace(model_dump=lambda **kwargs: {"id": "chunk1", "choices": []})]+ )++ with patch("headroom.backends.litellm.acompletion", new_callable=AsyncMock) as mock_acomp:+ mock_acomp.return_value = stream++ chunks = [chunk async for chunk in backend.stream_openai_message(body, {})]++ kwargs = mock_acomp.await_args.kwargs+ assert kwargs["max_completion_tokens"] == 64+ assert "extra_body" not in kwargs+ assert chunks[-1] == "data: [DONE]\n\n"++@pytest.mark.asyncioasync def test_reasoning_params_forwarded_top_level_not_extra_body() -> None:# reasoning_effort / max_completion_tokens are litellm-mapped params: they