Skip to content

Enforce support of enforce_user_param to openai post endpoints - #17407

Merged
Sameerlite merged 1 commit into
mainfrom
litellm_enforce_enforce_user_param
Dec 3, 2025
Merged

Sameerlite merged 1 commit into
mainfrom
litellm_enforce_enforce_user_param

Conversation

@Sameerlite

Copy link
Copy Markdown
Contributor

Title

Enforce support of enforce_user_param to openai post endpoints

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • 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

Type

🐛 Bug Fix
🧹 Refactoring

Changes

The enforce_user_param setting was being enforced on ALL OpenAI endpoint requests, including:

  • GET requests like /v1/models (which don't have request bodies)
  • MCP-related calls (which were causing 500 errors)

This caused issues because:

  1. GET requests don't have request bodies, so adding a user parameter doesn't make sense
  2. MCP calls shouldn't be required to have a user parameter

Modified the enforce_user_param logic in /litellm/proxy/auth/auth_checks.py to:

  1. Check HTTP Method: Only enforce the user parameter on POST requests
  2. Exclude MCP Routes: Check if the route is an MCP route and skip enforcement
  3. Focus on Completion Calls: This ensures user parameter is enforced only on actual LLM completion calls (chat/completions, embeddings, etc.)

@vercel

vercel Bot commented Dec 3, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Dec 3, 2025 6:50am

@Sameerlite
Sameerlite marked this pull request as ready for review December 3, 2025 15:15
@Sameerlite
Sameerlite merged commit 7e9c1ff into main Dec 3, 2025
31 of 59 checks passed
@ishaan-berri
ishaan-berri deleted the litellm_enforce_enforce_user_param branch March 26, 2026 21:52
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…_user_param

Enforce support of enforce_user_param to openai post endpoints

This branch was successfully deployed

1 active deployment
Preview — 54e29e78 Deployed Dec 3, 2025 by vercel[bot]
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