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
style: align lazy import modules with ruff
JerrettDavisebfb64f9c2fd
diff --git a/headroom/providers/anthropic.py b/headroom/providers/anthropic.pyindex b84418667..556048196 100644--- a/headroom/providers/anthropic.py+++ b/headroom/providers/anthropic.py@@ -15,8 +15,8 @@ Usage:provider = AnthropicProvider() # Warning: approximate counting"""-import jsonimport importlib.util+import jsonimport loggingimport osimport warnings@@ -41,6 +41,7 @@ def _get_litellm_clients() -> tuple[Any | None, Any | None]:return litellm, litellm_get_model_info+logger = logging.getLogger(__name__)# Warning flagsdiff --git a/headroom/providers/openai.py b/headroom/providers/openai.pyindex bff476a1f..b2af317b5 100644--- a/headroom/providers/openai.py+++ b/headroom/providers/openai.py@@ -6,8 +6,8 @@ Cost estimates are APPROXIMATE - always verify against your actual billing.from __future__ import annotations-import jsonimport importlib.util+import jsonimport loggingimport osimport warnings