Get Started with Headroom
Headroom is bring-your-own-proxy. Portkey does not host it. Deploy a Headroom proxy in your own infrastructure and point the integration at it â request payloads never leave your network.
Deploy a Headroom Proxy
Verify the deployment with
curl http://your-headroom-host:8787/health.
Using Headroom with Portkey
1. Add Headroom Credentials to Portkey
- Click on the
Admin Settingsbutton on Sidebar - Navigate to
Pluginstab under Organisation Settings - Click on the edit button for the Headroom integration
- Add your Headroom Proxy URL (for example
https://headroom.internal.example.com:8787) - Add your Headroom Proxy Token â leave blank if the proxy runs without
HEADROOM_PROXY_TOKEN
2. Add Headroomâs Guardrail Check
- Navigate to the
Guardrailspage and click theCreatebutton - Search for âHeadroom Compress Contextâ and click
Add - Configure the compression behaviour (all parameters are optional):
- Set any
actionsyou want on your check, and create the Guardrail!
Guardrail Actions allow you to orchestrate your guardrails logic. You can learn more about them here
Start with
mode: audit to measure savings on real traffic without changing what reaches the model, then switch to optimize.
3. Add Guardrail ID to a Config and Make Your Request
- When you save a Guardrail, youâll get an associated Guardrail ID â add this ID to the
input_guardrailsparam in your Portkey Config - Create these Configs in Portkey UI, save them, and get an associated Config ID to attach to your requests. More here.
- NodeJS
- Python
- cURL
Compression Results
Savings appear in thehook_results block of the response and in your Portkey logs:
compression_ratio is tokens_after / tokens_before, so lower is better â 0.35 means a 65% reduction. A ratio of 1.0 means nothing was compressed.
Compression Needs Large Inputs
Headroom skips content where compression would cost more than it saves, so small requests return zero savings by design. Content below roughly 300 tokens, JSON arrays under 5 items, and tool outputs under 500 tokens pass through unchanged, as does source code and the lastprotect_recent messages.
Headroom pays off on long agent sessions, multi-tool workflows, API and database responses, build output, and structured logs â typically 40â95% reduction. Short conversational turns see close to nothing. Test with a realistic payload, not a one-line prompt.
Supported Request Types
Headroom compresses requests with amessages array:
- Chat Completions (
/v1/chat/completions) - Messages (Anthropic-style)
messages array pass through untouched. Compression also fails open â if the proxy is unreachable, slow, or errors, the original request is sent to the provider and the failure is recorded in hook_results.
Get Support
If you face any issues with the Headroom integration, join the Portkey community forum for assistance.Portkey is now PRISMA AIRS AI Gateway. See it in action.
Contact Us

