Skip to content

Conversation

@Sameerlite
Copy link
Collaborator

@Sameerlite Sameerlite commented Oct 24, 2025

Title

Add guardrail support for video generation and video remix endpoints

Relevant issues

Fixes LIT-1323

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

🆕 New Feature

Changes

Summary

This PR adds comprehensive guardrail support for video generation and video remix endpoints, enabling content moderation and safety checks for video-related requests.

Key Changes

1. Video Endpoints Guardrail Integration

  • Added guardrail processing to video_generation endpoint in /litellm/proxy/video_endpoints/endpoints.py
  • Added guardrail processing to video_remix endpoint in /litellm/proxy/video_endpoints/endpoints.py
  • Implemented prompt transformation from prompt field to messages format for guardrail compatibility
  • Added conversion back from messages to prompt after guardrail processing

2. Guardrail Hook Updates

  • Updated OpenAI Moderation guardrail to support video_generation and video_remix call types
  • Updated GuardrailsAI guardrail to support video_generation and video_remix call types
  • Updated Azure Prompt Shield guardrail to support video_generation and video_remix call types
  • Updated Azure Text Moderation guardrail to support video_generation and video_remix call types
  • Updated Custom Guardrail base class to support video_generation and video_remix call types

3. Type System Updates

  • Updated ProxyLogging class in /litellm/proxy/utils.py to include video_generation and video_remix in call type literals
  • Updated CustomLogger class in /litellm/integrations/custom_logger.py to include video_generation and video_remix in call type literals
  • Updated during_call_hook method to support new video call types

Usage Example

curl -i http://localhost:4000/v1/videos \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-1234" \
  -d '{
    "model": "sora-2",
    "prompt": "Create a video of a peaceful sunset",
    "guardrails": ["openai-moderation-pre"]
  }'
Screenshot 2025-10-24 at 10 56 53 AM

@vercel
Copy link

vercel bot commented Oct 24, 2025

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

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Oct 24, 2025 1:58pm

@Sameerlite Sameerlite changed the base branch from main to litellm_proxy_videos_endpoints October 24, 2025 05:43
@Sameerlite Sameerlite changed the base branch from litellm_proxy_videos_endpoints to litellm_sameer_oct_staging October 24, 2025 05:45
@Sameerlite Sameerlite changed the base branch from litellm_sameer_oct_staging to litellm_proxy_videos_endpoints October 24, 2025 05:46
Remove unused imports and print statements
Copy link
Contributor

@ishaan-jaff ishaan-jaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use UnifiedLLMGuardrails class for videos

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.

2 participants