Skip to content

feat(pillar): add automatic LiteLLM context headers - #17076

Merged
1 commit merged into
BerriAI:mainfrom
eagle-p:feat/pillar-litellm-context-headers
Nov 26, 2025
Merged

feat(pillar): add automatic LiteLLM context headers#17076
1 commit merged into
BerriAI:mainfrom
eagle-p:feat/pillar-litellm-context-headers

Conversation

@eagle-p

@eagle-p eagle-p commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Title

feat(pillar): add automatic LiteLLM context headers to Pillar guardrail

Relevant issues

N/A

Pre-Submission checklist

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Test Results
image

Type

🆕 New Feature

Changes

Summary

Automatically passes LiteLLM virtual key context as X-LiteLLM-* headers to Pillar guardrail for application/user tracking. No configuration required - works out of the box.

What Changed

  • Automatic header passing: Extracts context from LiteLLM virtual keys and passes 7 standard headers
  • Headers sent: X-LiteLLM-Key-Name, X-LiteLLM-Key-Alias, X-LiteLLM-User-Id, X-LiteLLM-User-Email, X-LiteLLM-Team-Id, X-LiteLLM-Team-Name, X-LiteLLM-Org-Id
  • Security: Excludes sensitive data (metadata and API key tokens)
  • Zero config: Always enabled - no additional setup needed

Files Changed

  • litellm/proxy/guardrails/guardrail_hooks/pillar/pillar.py - Added header extraction logic
  • tests/test_litellm/proxy/guardrails/test_pillar_guardrails.py - Added 30 comprehensive tests (all passing)
  • docs/my-website/docs/proxy/guardrails/pillar_security.md - Updated documentation

Benefits

  • Enables Pillar to track and analyze requests by application, user, team, and organization
  • Engineers don't need to manually pass any headers
  • Uses existing LiteLLM virtual key infrastructure

- Automatically pass LiteLLM virtual key context as X-LiteLLM-* headers
- Includes key_alias, user_id, team_id, org_id, and user_email
- No configuration required - always enabled for application/user tracking
- Excludes sensitive data (metadata, API tokens) for security
- Add comprehensive tests (30 tests, all passing)
- Update documentation with header details
@vercel

vercel Bot commented Nov 25, 2025

Copy link
Copy Markdown

@eagle-p is attempting to deploy a commit to the CLERKIEAI Team on Vercel.

A member of the Team first needs to authorize it.

@ghost
ghost merged commit e6e1e8f into BerriAI:main Nov 26, 2025
2 of 6 checks passed
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
- Automatically pass LiteLLM virtual key context as X-LiteLLM-* headers
- Includes key_alias, user_id, team_id, org_id, and user_email
- No configuration required - always enabled for application/user tracking
- Excludes sensitive data (metadata, API tokens) for security
- Add comprehensive tests (30 tests, all passing)
- Update documentation with header details
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant