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.

test: fix codex routing response stub

JerrettDavis01fc1aaf94ff
diff --git a/tests/test_openai_codex_routing.py b/tests/test_openai_codex_routing.py
index 95f2d16ec..1359d3bf2 100644
--- a/tests/test_openai_codex_routing.py
+++ b/tests/test_openai_codex_routing.py
@@ -114,6 +114,10 @@ class _DummyTokenizer:
class _ResponseStub:
+ status_code = 200
+ headers = {"content-type": "application/json", "content-length": "42"}
+ content = b'{"id":"resp_123","output":[{"type":"message"}]}'
+
def json(self):
return {"usage": {"input_tokens": 2, "output_tokens": 1}}
@@ -182,7 +186,7 @@ def test_handle_openai_responses_routes_chatgpt_auth_to_backend_api(monkeypatch)
monkeypatch.setattr("headroom.tokenizers.get_tokenizer", lambda model: _DummyTokenizer())
- anyio.run(handler.handle_openai_responses, request)
+ response = anyio.run(handler.handle_openai_responses, request)
assert handler.captured_request is not None
method, url, headers, body = handler.captured_request
@@ -190,6 +194,7 @@ def test_handle_openai_responses_routes_chatgpt_auth_to_backend_api(monkeypatch)
assert url == "https://chatgpt.com/backend-api/codex/responses"
assert headers["ChatGPT-Account-ID"] == "acct-from-jwt"
assert body["input"] == "hello"
+ assert response.status_code == 200
class _DummyWebSocket: