Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: respect videos content db creds

Sameer Kankute15e5a8251e1c
diff --git a/litellm/llms/openai/videos/transformation.py b/litellm/llms/openai/videos/transformation.py
index abdcd2fbe7b..8762d8c0b83 100644
--- a/litellm/llms/openai/videos/transformation.py
+++ b/litellm/llms/openai/videos/transformation.py
@@ -180,6 +180,7 @@ class OpenAIVideoConfig(BaseVideoConfig):
# Construct the URL for video content download
url = f"{api_base.rstrip('/')}/{original_video_id}/content"
+ print("🔥 [OPENAI VIDEO CONTENT] URL:", url)
# No additional data needed for GET content request
data: Dict[str, Any] = {}
diff --git a/litellm/videos/main.py b/litellm/videos/main.py
index 74e41ed5be3..db09ab04f11 100644
--- a/litellm/videos/main.py
+++ b/litellm/videos/main.py
@@ -271,7 +271,6 @@ def video_generation( # noqa: PLR0915
@client
def video_content(
video_id: str,
- api_base: Optional[str] = None,
timeout: Optional[float] = None,
custom_llm_provider: Optional[str] = None,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -384,8 +383,6 @@ def video_content(
@client
async def avideo_content(
video_id: str,
- api_key: Optional[str] = None,
- api_base: Optional[str] = None,
timeout: Optional[float] = None,
custom_llm_provider: Optional[str] = None,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -400,8 +397,6 @@ async def avideo_content(
Parameters:
- `video_id` (str): The identifier of the video whose content to download
- - `api_key` (Optional[str]): The API key to use for authentication
- - `api_base` (Optional[str]): The base URL for the API
- `timeout` (Optional[float]): The timeout for the request in seconds
- `custom_llm_provider` (Optional[str]): The LLM provider to use
- `extra_headers` (Optional[Dict[str, Any]]): Additional headers
@@ -425,8 +420,6 @@ async def avideo_content(
func = partial(
video_content,
video_id=video_id,
- api_key=api_key,
- api_base=api_base,
timeout=timeout,
custom_llm_provider=custom_llm_provider,
extra_headers=extra_headers,
diff --git a/tests/test_litellm/test_video_generation.py b/tests/test_litellm/test_video_generation.py
index 567f7d53fe4..87012f05155 100644
--- a/tests/test_litellm/test_video_generation.py
+++ b/tests/test_litellm/test_video_generation.py
@@ -832,6 +832,37 @@ def test_video_content_handler_uses_get_for_openai():
assert called_url == "https://api.openai.com/v1/videos/video_abc/content"
+def test_video_content_respects_api_base_and_api_key_from_kwargs():
+ """Test that video_content respects api_base and api_key from kwargs (simulating database entry)."""
+ from litellm.videos.main import video_content
+
+ # Mock the handler to capture litellm_params
+ captured_litellm_params = None
+
+ def capture_litellm_params(*args, **kwargs):
+ nonlocal captured_litellm_params
+ captured_litellm_params = kwargs.get("litellm_params")
+ return b"mp4-bytes"
+
+ with patch('litellm.videos.main.base_llm_http_handler') as mock_handler:
+ mock_handler.video_content_handler = capture_litellm_params
+
+ # Call video_content with api_base and api_key in kwargs (simulating database entry)
+ # This simulates how the router passes model config from database via **kwargs
+ result = video_content(
+ video_id="video_test_123",
+ custom_llm_provider="azure",
+ api_base="https://test-resource.openai.azure.com/", # Passed via kwargs by router
+ api_key="test-api-key-from-db", # Passed via kwargs by router
+ )
+
+ # Verify that api_base and api_key from kwargs were included in litellm_params
+ assert captured_litellm_params is not None
+ assert captured_litellm_params.get("api_base") == "https://test-resource.openai.azure.com/"
+ assert captured_litellm_params.get("api_key") == "test-api-key-from-db"
+ assert result == b"mp4-bytes"
+
+
def test_openai_video_config_has_async_transform():
"""Ensure OpenAIVideoConfig exposes async_transform_video_content_response at runtime."""
cfg = OpenAIVideoConfig()