Skip to content

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.

style: align lazy import modules with ruff

JerrettDavisebfb64f9c2fd
diff --git a/headroom/providers/anthropic.py b/headroom/providers/anthropic.py
index b84418667..556048196 100644
--- a/headroom/providers/anthropic.py
+++ b/headroom/providers/anthropic.py
@@ -15,8 +15,8 @@ Usage:
provider = AnthropicProvider() # Warning: approximate counting
"""
-import json
import importlib.util
+import json
import logging
import os
import 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 flags
diff --git a/headroom/providers/openai.py b/headroom/providers/openai.py
index 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 json
import importlib.util
+import json
import logging
import os
import warnings