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.

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.py
index 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.py
index 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 None
fake_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",