Skip to content

Conversation

@Sameerlite
Copy link
Collaborator

@Sameerlite Sameerlite commented Nov 6, 2025

Title

  • Added endcoded video id support
  • Added Gemini Video generation support
  • Added Vertex Video generation support
  • Added Cost tracking for Gemini and Vertex Ai
  • Added video generation route in health check and UI

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

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

Sameerlite and others added 24 commits November 3, 2025 17:27
… sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Refactor Video API: Encode provider and model in video_id
Add Video Generation Mode to UI Model Management and Health Check
* Add veo with openai videos unified specs

* Add videos testing to UI

* remove mock code

* Remove not need ui changes:

* Fix mypy errors related to gemini

* fix test_transform_video_create_request
Add vertex ai veo videos endpoint support and cost tracking
@vercel
Copy link

vercel bot commented Nov 6, 2025

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

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Nov 8, 2025 8:38pm

litellm_params={}
)

assert url.startswith("https://generativelanguage.googleapis.com")

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

The string
https://generativelanguage.googleapis.com
may be at an arbitrary position in the sanitized URL.

Copilot Autofix

AI about 6 hours ago

To fix this issue, we should parse the URL and check that its hostname matches the expected value (or ends with it, if subdomains are allowed), instead of performing a string match on the whole URL. In this test, we want to confirm that the returned URL points at generativelanguage.googleapis.com.

The change should be in the test method test_get_complete_url_default_api_base, replacing

assert url.startswith("https://generativelanguage.googleapis.com")

with code that parses the URL and asserts .hostname equality with the correct host:

from urllib.parse import urlparse
...
parsed = urlparse(url)
assert parsed.scheme == "https"
assert parsed.hostname == "generativelanguage.googleapis.com"

We may need to add the urllib.parse import at the top of the file if it isn't present.


Suggested changeset 1
tests/test_litellm/llms/gemini/videos/test_gemini_video_transformation.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/test_litellm/llms/gemini/videos/test_gemini_video_transformation.py b/tests/test_litellm/llms/gemini/videos/test_gemini_video_transformation.py
--- a/tests/test_litellm/llms/gemini/videos/test_gemini_video_transformation.py
+++ b/tests/test_litellm/llms/gemini/videos/test_gemini_video_transformation.py
@@ -7,7 +7,7 @@
 
 import httpx
 import pytest
-
+from urllib.parse import urlparse
 from litellm.llms.gemini.videos.transformation import GeminiVideoConfig
 from litellm.llms.openai.cost_calculation import video_generation_cost
 from litellm.types.router import GenericLiteLLMParams
@@ -77,9 +77,10 @@
             litellm_params={}
         )
         
-        assert url.startswith("https://generativelanguage.googleapis.com")
+        parsed = urlparse(url)
+        assert parsed.scheme == "https"
+        assert parsed.hostname == "generativelanguage.googleapis.com"
         assert "veo-3.0-generate-preview:predictLongRunning" in url
-
     def test_transform_video_create_request(self):
         """Test transformation of video creation request."""
         prompt = "A cat playing with a ball of yarn"
EOF
@@ -7,7 +7,7 @@

import httpx
import pytest

from urllib.parse import urlparse
from litellm.llms.gemini.videos.transformation import GeminiVideoConfig
from litellm.llms.openai.cost_calculation import video_generation_cost
from litellm.types.router import GenericLiteLLMParams
@@ -77,9 +77,10 @@
litellm_params={}
)

assert url.startswith("https://generativelanguage.googleapis.com")
parsed = urlparse(url)
assert parsed.scheme == "https"
assert parsed.hostname == "generativelanguage.googleapis.com"
assert "veo-3.0-generate-preview:predictLongRunning" in url

def test_transform_video_create_request(self):
"""Test transformation of video creation request."""
prompt = "A cat playing with a ball of yarn"
Copilot is powered by AI and may make mistakes. Always verify output.
litellm_params=litellm_params,
)

assert url.startswith("https://custom-endpoint.example.com")

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

The string
https://custom-endpoint.example.com
may be at an arbitrary position in the sanitized URL.

Copilot Autofix

AI about 20 hours ago

The best way to fix this is to parse the constructed URL and verify that its host (and protocol) match the expected values. Instead of checking that the url string starts with the expected base string, we should use urllib.parse.urlparse to extract the netloc (host) and scheme (protocol) and compare them against the expected ones. This avoids problems where the expected domain/endpoint is present as a prefix but not in the actual host, or is embedded elsewhere in the URL.

We should replace line 87:

assert url.startswith("https://custom-endpoint.example.com")

with code that parses url (using urlparse) and confirms both scheme and netloc are correct. This will require importing urlparse from urllib.parse if not already imported.

Suggested changeset 1
tests/test_litellm/llms/vertex_ai/videos/test_vertex_video_transformation.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/test_litellm/llms/vertex_ai/videos/test_vertex_video_transformation.py b/tests/test_litellm/llms/vertex_ai/videos/test_vertex_video_transformation.py
--- a/tests/test_litellm/llms/vertex_ai/videos/test_vertex_video_transformation.py
+++ b/tests/test_litellm/llms/vertex_ai/videos/test_vertex_video_transformation.py
@@ -7,6 +7,7 @@
 from unittest.mock import Mock, MagicMock, patch
 import httpx
 import base64
+from urllib.parse import urlparse
 
 from litellm.llms.vertex_ai.videos.transformation import (
     VertexAIVideoConfig,
@@ -84,7 +85,10 @@
             litellm_params=litellm_params,
         )
 
-        assert url.startswith("https://custom-endpoint.example.com")
+        # Parse and assert host/scheme instead of unsafe prefix check
+        parsed_url = urlparse(url)
+        assert parsed_url.scheme == "https"
+        assert parsed_url.netloc == "custom-endpoint.example.com"
         assert "test-project" in url
         assert "us-west1" in url
         assert "veo-002" in url
EOF
@@ -7,6 +7,7 @@
from unittest.mock import Mock, MagicMock, patch
import httpx
import base64
from urllib.parse import urlparse

from litellm.llms.vertex_ai.videos.transformation import (
VertexAIVideoConfig,
@@ -84,7 +85,10 @@
litellm_params=litellm_params,
)

assert url.startswith("https://custom-endpoint.example.com")
# Parse and assert host/scheme instead of unsafe prefix check
parsed_url = urlparse(url)
assert parsed_url.scheme == "https"
assert parsed_url.netloc == "custom-endpoint.example.com"
assert "test-project" in url
assert "us-west1" in url
assert "veo-002" in url
Copilot is powered by AI and may make mistakes. Always verify output.
@krrishdholakia
Copy link
Contributor

this fails linting @Sameerlite
Screenshot 2025-11-07 at 7 20 19 PM

@Sameerlite
Copy link
Collaborator Author

fixed

@ishaan-jaff ishaan-jaff merged commit e037d93 into main Nov 9, 2025
47 of 53 checks passed
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.

4 participants