LiteLLM × Headroom: Use 60-95% fewer tokens with Prompt Compression #31816
Replies: 8 comments 7 replies
-
|
It looks like the Setup Guide link is incorrect. I believe it should be https://docs.litellm.ai/docs/proxy/headroom |
Beta Was this translation helpful? Give feedback.
-
|
v1.90.2 ValueError: Unsupported guardrail: headroom
ERROR: Application startup failed. Exiting.which version should I use to setup headroom properly? |
Beta Was this translation helpful? Give feedback.
-
|
updated posts to clarify it's on v1.92.x versions |
Beta Was this translation helpful? Give feedback.
-
|
Wow, what timing. I was just looking into adding Headroom in a different way. Will this work for all coding agents, not just Claude Code? I guess it's whatever is calling the |
Beta Was this translation helpful? Give feedback.
-
|
Hey, Thanks for adding Headroom in LiteLLM ! EDIT 2026/07/02 06:00PM: I just test the python package version 1.92.0-dev.1 => Same error with the Docker container 1.92.0-dev.1 : # Config.yml
...
guardrails:
- guardrail_name: headroom-compression
litellm_params:
guardrail: headroom
mode: pre_call
api_base: http://127.0.0.1:8787
# api_key: os.environ/HEADROOM_API_KEY
default_on: true |
Beta Was this translation helpful? Give feedback.
-
|
How do I repro this?
*Krrish Dholakia | *CEO
Book a meeting with me
<https://calendly.com/d/cx9p-5yf-2nm/litellm-introductions>
LinkedIn <https://www.linkedin.com/in/krish-d/> | (770) 878 - 3106
***@***.***
P.S. See how LiteLLM helps LLM Platform teams move fast and stay in control
<https://www.litellm.ai/#features>
…On Thu, Jul 2, 2026 at 11:16 PM Quentin (b3ard0x) Schweitzer < ***@***.***> wrote:
Yep.
I use it with Ollama, Mistral and Deepseek.
I don't see headroom Guardrails on every requests. Is it only visible on
the first one ?
I'm not sure that headroom is really used even if I set 'default_on' to
"true" and some of stats are visibles in headroom dashboard.
Thanks for your work 🙏🏼
—
Reply to this email directly, view it on GitHub
<#31816?email_source=notifications&email_token=CARFWGE32TJ5CNC5IPE7CPL5C5FVJA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNZVGE4TKOJUUZZGKYLTN5XKO3LFNZ2GS33OUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-17519594>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CARFWGEH442YAHHGFFSG3JD5C5FVJAVCNFSNUABIKJSXA33TNF2G64TZHM3DOMJSGY4TKMBVHNCGS43DOVZXG2LPNY5TCMBTGUYDSMBXUF3AE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
hi, I am having problem with retrieving compressed ccr via retrieve_headroom (as mentioned in the blog and also this text). I have followed the setup guide and wondering did i miss any step(s)? in opencode, the model responded as the tool is not exposed to it: I am using headroom with default:on. Regards, |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
LiteLLM × Headroom: Use 60-95% fewer tokens with Prompt Compression
Headroom now runs as a native guardrail on the LiteLLM proxy, compressing tool outputs, RAG payloads, database results, and file reads before they reach the model.
Why this matters
Long-context agents burn most of their input budget on repeated tool output, retrieved chunks, and stale scratch state. Headroom intelligently rewrites that content so the model sees the same information at a fraction of the tokens.
If the model needs the full context, LiteLLM will also pass a
retrieve_headroomtool to the model, to retrieve the full context from Headroom.How is it deployed?
Headroom runs as a sidecar to LiteLLM. Client traffic still hits the LiteLLM gateway; LiteLLM invokes Headroom during the
pre_callstep, swaps in the compressed messages, and forwards the payload upstream. Clients and the LLM provider never talk to Headroom directly.The benefit of this is two-fold:
Works with both OpenAI & Anthropic formats
Compression works on both
/v1/chat/completionsand/v1/messages(Anthropic format), which makes the Claude Code rollout a one-liner for the admin: attachheadroom-compressionto a virtual key, hand it to the developer, and every request they make throughANTHROPIC_BASE_URLgets compressed automatically. No client-side change, no code diff.How to enable it
Turn it on per key, per request, or globally via
default_on: true. Confirm it ran by checking thex-litellm-applied-guardrailsresponse header or the Guardrails panel in the Logs UI.📖 Full blog post: https://docs.litellm.ai/blog/headroom-integration
📘 Setup guide: https://docs.litellm.ai/docs/proxy/guardrails/headroom
Beta Was this translation helpful? Give feedback.
All reactions