From 2df6dced0a6d3f7701a05aa0d8ad9f6811e323db Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 15 Jul 2026 19:44:29 +0000 Subject: [PATCH] fix(videos): re-stamp status response id with resolved model_id so downstream status/content resolve per-model key --- litellm/proxy/video_endpoints/endpoints.py | 7 ++++++- .../proxy/video_endpoints/test_endpoints.py | 21 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/video_endpoints/endpoints.py b/litellm/proxy/video_endpoints/endpoints.py index a13e80809c1..18a6acfe4e1 100644 --- a/litellm/proxy/video_endpoints/endpoints.py +++ b/litellm/proxy/video_endpoints/endpoints.py @@ -279,7 +279,7 @@ async def video_status( # Process request using ProxyBaseLLMRequestProcessing processor = ProxyBaseLLMRequestProcessing(data=data) try: - return await processor.base_process_llm_request( + response = await processor.base_process_llm_request( request=request, fastapi_response=fastapi_response, user_api_key_dict=user_api_key_dict, @@ -297,6 +297,11 @@ async def video_status( user_api_base=user_api_base, version=version, ) + return encode_video_id_in_response( + response=cast(object, response), + fallback_provider=custom_llm_provider, + fallback_model_id=model_id_from_decoded, + ) except Exception as e: raise await processor._handle_llm_api_exception( e=e, diff --git a/tests/test_litellm/proxy/video_endpoints/test_endpoints.py b/tests/test_litellm/proxy/video_endpoints/test_endpoints.py index 12649579652..e64cc603259 100644 --- a/tests/test_litellm/proxy/video_endpoints/test_endpoints.py +++ b/tests/test_litellm/proxy/video_endpoints/test_endpoints.py @@ -367,6 +367,27 @@ async def test_status__header_provider_beats_decoded_id(harness): assert data["model"] == "azure-sora" +@pytest.mark.asyncio +async def test_status__reencodes_response_id_preserving_model_id(harness): + """Regression for #33423: the status transform re-encodes the video id with + model_id=None, so the id the client gets back decodes to an empty model_id. + Re-using that id on a later status/content call then cannot resolve the + deployment (or its per-model api_key) and dies with invalid_api_key. The + endpoint must re-stamp the response id with the model_id it decoded from the + incoming id so the returned id round-trips.""" + stripped_id = encode_video_id_with_provider("video_orig123", "azure", "") + assert decode_video_id_with_provider(stripped_id)["model_id"] == "" + harness.base_process.return_value = _video_response(stripped_id, hidden_params={}) + + resp = await call_status(harness, AZURE_VIDEO_ID) + + decoded = decode_video_id_with_provider(resp.id) + assert decoded["model_id"] == VIDEO_MODEL_ID + assert decoded["custom_llm_provider"] == "azure" + assert decoded["video_id"] == "video_orig123" + assert harness.resolve_model.side_effect(decoded["model_id"]) == "azure-sora" + + # =========================================================================== # # GET /v1/videos/{video_id}/content - video_content # # =========================================================================== #