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(proxy): say a forwarded streaming error came from the provider (#4629)
gglucass956b8855a677
diff --git a/headroom/proxy/handlers/streaming.py b/headroom/proxy/handlers/streaming.pyindex 54f764715..d51b3e2fb 100644--- a/headroom/proxy/handlers/streaming.py+++ b/headroom/proxy/handlers/streaming.py@@ -1479,7 +1479,7 @@ class StreamingMixin:if upstream_response.status_code >= 400:logger.warning(- "[%s] Forwarding upstream streaming error status=%s url=%s",+ "[%s] Upstream provider returned an error; forwarding it to the client status=%s url=%s",request_id,upstream_response.status_code,url,diff --git a/tests/test_proxy_streaming_ratelimit_headers.py b/tests/test_proxy_streaming_ratelimit_headers.pyindex 67779e88e..e721f933d 100644--- a/tests/test_proxy_streaming_ratelimit_headers.py+++ b/tests/test_proxy_streaming_ratelimit_headers.py@@ -493,7 +493,7 @@ class TestStreamingRatelimitHeaderForwarding:assert result.body == b'{"error":{"message":"capacity exhausted"}}'assert result.headers.get("content-encoding") is Nonefake_logger.warning.assert_any_call(- "[%s] Forwarding upstream streaming error status=%s url=%s",+ "[%s] Upstream provider returned an error; forwarding it to the client status=%s url=%s","test-http-error",503,"https://api.anthropic.com/v1/messages",