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
chore: format proxy route tests with ruff
Kayzo1961cebd00c3
diff --git a/tests/test_proxy_codex_route_aliases.py b/tests/test_proxy_codex_route_aliases.pyindex d74529d2e..780619995 100644--- a/tests/test_proxy_codex_route_aliases.py+++ b/tests/test_proxy_codex_route_aliases.py@@ -118,9 +118,7 @@ def test_codex_responses_subpath_aliases_delegate_to_passthrough():),],)-def test_codex_responses_subpath_passthrough_derives_chatgpt_routing_from_jwt(- path, expected_url-):+def test_codex_responses_subpath_passthrough_derives_chatgpt_routing_from_jwt(path, expected_url):class FakeAsyncClient:def __init__(self) -> None:self.calls: list[tuple[str, str, dict[str, str]]] = []diff --git a/tests/test_proxy_google_cloudcode_route_aliases.py b/tests/test_proxy_google_cloudcode_route_aliases.pyindex 5f2a85592..b94e918fd 100644--- a/tests/test_proxy_google_cloudcode_route_aliases.py+++ b/tests/test_proxy_google_cloudcode_route_aliases.py@@ -98,9 +98,7 @@ def test_cloudcode_route_uses_cloudcode_api_override(monkeypatch):monkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)with TestClient(- create_app(- ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test/v1")- )+ create_app(ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test/v1"))) as client:response = client.post("/v1/v1internal:streamGenerateContent",@@ -150,9 +148,7 @@ def test_antigravity_route_does_not_cross_route_to_cloudcode_override(monkeypatcmonkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)with TestClient(- create_app(- ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test")- )+ create_app(ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test"))) as client:response = client.post("/v1internal:streamGenerateContent",@@ -175,9 +171,7 @@ def test_cloudcode_override_does_not_leak_between_app_instances(monkeypatch):monkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)with TestClient(- create_app(- ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test")- )+ create_app(ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test"))) as client:first = client.post("/v1internal:streamGenerateContent",@@ -193,6 +187,12 @@ def test_cloudcode_override_does_not_leak_between_app_instances(monkeypatch):)assert first.status_code == 200- assert first.json()["url"] == "https://cloudcode-proxy.test/v1internal:streamGenerateContent?alt=sse"+ assert (+ first.json()["url"]+ == "https://cloudcode-proxy.test/v1internal:streamGenerateContent?alt=sse"+ )assert second.status_code == 200- assert second.json()["url"] == "https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse"+ assert (+ second.json()["url"]+ == "https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse"+ )diff --git a/tests/test_proxy_streaming_ratelimit_headers.py b/tests/test_proxy_streaming_ratelimit_headers.pyindex d11d41c5c..c6a69857c 100644--- a/tests/test_proxy_streaming_ratelimit_headers.py+++ b/tests/test_proxy_streaming_ratelimit_headers.py@@ -220,9 +220,7 @@ class TestStreamingRatelimitHeaderForwarding:"content-length": "42",})- mock_response.aread = AsyncMock(- return_value=b'{"error":{"message":"capacity exhausted"}}'- )+ mock_response.aread = AsyncMock(return_value=b'{"error":{"message":"capacity exhausted"}}')mock_response.aclose = AsyncMock()mock_request = MagicMock()