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
Changelog
0.1.1
- Inject the upstream bearer only on requests that go upstream. Local routes
(
/health,/stats*,/metrics,/v1/compress*,/ext/*, …; see README) are passed through untouched, so an unreachable IdP no longer 502s health probes and management calls no longer mint tokens./p/<project>/prefixes are stripped first. - Startup log carries
scheme://hostof the token URL and the mint log a scope count, instead of the full URL and scope list. - Requires
headroom-ai≥ 0.40 (extension middleware inside the proxy-token gate).
0.1.0
Initial release — generic OAuth2 client-credentials upstream-auth extension for the Headroom proxy.
- Mints an OAuth2 client-credentials (RFC 6749 §4.4) bearer from a configurable token endpoint and
injects it as the upstream
Authorizationon each proxied request, via Headroom's opt-inheadroom.proxy_extensionseam (--proxy-extension oauth2). No core changes; vendor-neutral. postandbasicclient-auth styles; scopes,audience, RFC 8707resource, static upstream headers, configurable timeout/skew — all env-driven.- Token caching with single-flight refresh and pre-expiry skew;
expires_inclamped to a positive TTL. - Fails closed on misconfiguration; returns
502 upstream_auth_erroron mint failure without leaking the IdP error body.token_urlhttps-enforced (loopback exempt). Std-lib only (system cert store -> works behind corporate SSL inspection).