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
Fixing the ruff linting
chopratejas30a5aba9d62d
diff --git a/headroom/backends/anyllm.py b/headroom/backends/anyllm.pyindex d0d5b1b20..474d4c78e 100644--- a/headroom/backends/anyllm.py+++ b/headroom/backends/anyllm.py@@ -349,7 +349,9 @@ class AnyLLMBackend(Backend):if param in body:kwargs[param] = body[param]- logger.debug(f"any-llm OpenAI request: provider={self.provider}, model={original_model}")+ logger.debug(+ f"any-llm OpenAI request: provider={self.provider}, model={original_model}"+ )response: Any = await self.llm.acompletion(**kwargs)@@ -377,11 +379,13 @@ class AnyLLMBackend(Backend):}for tc in c.message.tool_calls]- choices.append({- "index": c.index,- "message": msg,- "finish_reason": c.finish_reason,- })+ choices.append(+ {+ "index": c.index,+ "message": msg,+ "finish_reason": c.finish_reason,+ }+ )usage = response.usageresponse_dict: dict[str, Any] = {