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
fix: type cache lazy exports
JerrettDavis245241d2b486
diff --git a/headroom/__init__.py b/headroom/__init__.pyindex c7061b3f1..8e65f3750 100644--- a/headroom/__init__.py+++ b/headroom/__init__.py@@ -71,6 +71,7 @@ For more examples, see https://github.com/headroom-sdk/headroom/tree/main/examplfrom __future__ import annotationsfrom importlib import import_module+from typing import Anyfrom ._version import __version__ # noqa: F401from .compress import CompressResult, compress@@ -275,7 +276,7 @@ _OPTIONAL_EXPORTS = {}-def __getattr__(name: str):+def __getattr__(name: str) -> Any:module_attr = _LAZY_EXPORTS.get(name)if module_attr is not None:module_name, attr_name = module_attrdiff --git a/headroom/cache/__init__.py b/headroom/cache/__init__.pyindex f9899deff..88315247c 100644--- a/headroom/cache/__init__.py+++ b/headroom/cache/__init__.py@@ -3,6 +3,38 @@from __future__ import annotationsfrom importlib import import_module+from typing import TYPE_CHECKING++if TYPE_CHECKING:+ from headroom.cache.anthropic import AnthropicCacheOptimizer # noqa: F401+ from headroom.cache.base import ( # noqa: F401+ BaseCacheOptimizer,+ CacheBreakpoint,+ CacheConfig,+ CacheMetrics,+ CacheOptimizer,+ CacheResult,+ CacheStrategy,+ OptimizationContext,+ )+ from headroom.cache.compression_cache import CompressionCache # noqa: F401+ from headroom.cache.dynamic_detector import ( # noqa: F401+ DetectorConfig,+ DynamicCategory,+ DynamicContentDetector,+ DynamicSpan,+ detect_dynamic_content,+ )+ from headroom.cache.google import GoogleCacheOptimizer # noqa: F401+ from headroom.cache.openai import OpenAICacheOptimizer # noqa: F401+ from headroom.cache.prefix_tracker import ( # noqa: F401+ FreezeStats,+ PrefixCacheTracker,+ PrefixFreezeConfig,+ SessionTrackerStore,+ )+ from headroom.cache.registry import CacheOptimizerRegistry # noqa: F401+ from headroom.cache.semantic import SemanticCache, SemanticCacheLayer # noqa: F401__all__ = [# Base types