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.

Add INFO-level logging for WS /v1/responses connect and complete

chopratejas92f74db8e010
diff --git a/headroom/proxy/handlers/openai.py b/headroom/proxy/handlers/openai.py
index f088cff4f..a2eb3be34 100644
--- a/headroom/proxy/handlers/openai.py
+++ b/headroom/proxy/handlers/openai.py
@@ -1103,7 +1103,7 @@ class OpenAIHandlerMixin:
tokens_saved = 0
# --- Connect to upstream OpenAI WebSocket ---
- logger.debug(f"[{request_id}] WS connecting to {upstream_url}")
+ logger.info(f"[{request_id}] WS /v1/responses connecting to {upstream_url}")
# Use ssl=True to let the websockets library handle SSL natively.
# Manual ssl.create_default_context() + certifi doesn't load the
@@ -1164,6 +1164,10 @@ class OpenAIHandlerMixin:
return_exceptions=True,
)
+ logger.info(
+ f"[{request_id}] WS /v1/responses completed (tokens_saved={tokens_saved})"
+ )
+
except Exception as ws_err:
if ws_connected:
# WS was established but broke mid-stream — re-raise