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 lazy package exports
JerrettDavis5998c8b0fe02
diff --git a/headroom/providers/__init__.py b/headroom/providers/__init__.pyindex 7f0268e5a..1e37ece21 100644--- a/headroom/providers/__init__.py+++ b/headroom/providers/__init__.py@@ -3,6 +3,30 @@from __future__ import annotationsfrom importlib import import_module+from typing import TYPE_CHECKING++if TYPE_CHECKING:+ from headroom.providers.anthropic import AnthropicProvider+ from headroom.providers.base import Provider, TokenCounter+ from headroom.providers.cohere import CohereProvider+ from headroom.providers.google import GoogleProvider+ from headroom.providers.litellm import (+ LiteLLMProvider,+ create_litellm_provider,+ is_litellm_available,+ )+ from headroom.providers.openai import OpenAIProvider+ from headroom.providers.openai_compatible import (+ ModelCapabilities,+ OpenAICompatibleProvider,+ create_anyscale_provider,+ create_fireworks_provider,+ create_groq_provider,+ create_lmstudio_provider,+ create_ollama_provider,+ create_together_provider,+ create_vllm_provider,+ )__all__ = [# Basediff --git a/headroom/transforms/__init__.py b/headroom/transforms/__init__.pyindex 46bc69c39..6354b1b4e 100644--- a/headroom/transforms/__init__.py+++ b/headroom/transforms/__init__.py@@ -4,6 +4,73 @@ from __future__ import annotationsimport importlib.utilfrom importlib import import_module+from typing import TYPE_CHECKING++if TYPE_CHECKING:+ from headroom.transforms.anchor_selector import ( # noqa: F401+ AnchorSelector,+ AnchorStrategy,+ AnchorWeights,+ DataPattern,+ calculate_information_score,+ compute_item_hash,+ )+ from headroom.transforms.base import Transform # noqa: F401+ from headroom.transforms.cache_aligner import CacheAligner # noqa: F401+ from headroom.transforms.code_compressor import ( # noqa: F401+ CodeAwareCompressor,+ CodeCompressionResult,+ CodeCompressorConfig,+ CodeLanguage,+ DocstringMode,+ detect_language,+ is_tree_sitter_available,+ )+ from headroom.transforms.content_detector import ( # noqa: F401+ ContentType,+ DetectionResult,+ detect_content_type,+ )+ from headroom.transforms.content_router import ( # noqa: F401+ CompressionStrategy,+ ContentRouter,+ ContentRouterConfig,+ RouterCompressionResult,+ )+ from headroom.transforms.diff_compressor import ( # noqa: F401+ DiffCompressionResult,+ DiffCompressor,+ DiffCompressorConfig,+ )+ from headroom.transforms.html_extractor import ( # noqa: F401+ HTMLExtractionResult,+ HTMLExtractor,+ HTMLExtractorConfig,+ is_html_content,+ )+ from headroom.transforms.intelligent_context import ( # noqa: F401+ ContextStrategy,+ IntelligentContextManager,+ )+ from headroom.transforms.log_compressor import ( # noqa: F401+ LogCompressionResult,+ LogCompressor,+ LogCompressorConfig,+ )+ from headroom.transforms.pipeline import TransformPipeline # noqa: F401+ from headroom.transforms.rolling_window import RollingWindow # noqa: F401+ from headroom.transforms.scoring import ( # noqa: F401+ EmbeddingProvider,+ MessageScore,+ MessageScorer,+ )+ from headroom.transforms.search_compressor import ( # noqa: F401+ SearchCompressionResult,+ SearchCompressor,+ SearchCompressorConfig,+ )+ from headroom.transforms.smart_crusher import SmartCrusher, SmartCrusherConfig # noqa: F401+ from headroom.transforms.tool_crusher import ToolCrusher # noqa: F401_HTML_EXTRACTOR_AVAILABLE = importlib.util.find_spec("trafilatura") is not None