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: let the cache-price stub absorb the long_context tier selector (#3359)
Tejas Chopra65477f933a77
diff --git a/tests/test_proxy_savings_history.py b/tests/test_proxy_savings_history.pyindex d40f0716d..9e9be57e8 100644--- a/tests/test_proxy_savings_history.py+++ b/tests/test_proxy_savings_history.py@@ -1070,7 +1070,10 @@ def test_stats_history_persists_across_restarts_and_stats_stays_compatible(tmp_pmonkeypatch.setenv("HEADROOM_SAVINGS_PATH", str(savings_path))monkeypatch.setattr("headroom.proxy.server.CostTracker._get_cache_prices",- lambda self, model: (0.001, 0.0015, 0.002),+ # **kwargs so the stub keeps standing in for the real method as its+ # signature grows: it takes a keyword-only `long_context` tier selector,+ # which a positional-only stub turns into a TypeError inside /stats.+ lambda self, model, **kwargs: (0.001, 0.0015, 0.002),)config = ProxyConfig(@@ -1270,7 +1273,10 @@ def test_stats_history_csv_export_is_frontend_friendly(tmp_path, monkeypatch):monkeypatch.setenv("HEADROOM_SAVINGS_PATH", str(savings_path))monkeypatch.setattr("headroom.proxy.server.CostTracker._get_cache_prices",- lambda self, model: (0.001, 0.0015, 0.002),+ # **kwargs so the stub keeps standing in for the real method as its+ # signature grows: it takes a keyword-only `long_context` tier selector,+ # which a positional-only stub turns into a TypeError inside /stats.+ lambda self, model, **kwargs: (0.001, 0.0015, 0.002),)config = ProxyConfig(