Fix video list pagination cursors not encoded with provider metadata - #20710
Merged
Sameerlite merged 1 commit intoFeb 9, 2026
Conversation
first_id and last_id in the video list response were returned as raw provider IDs while data[].id was properly wrapped with encode_video_id_with_provider(). This caused pagination to break when clients passed unencoded cursors back as the `after` parameter. - Encode first_id/last_id in transform_video_list_response - Decode the `after` param in transform_video_list_request via extract_original_video_id() - Add 6 unit tests covering encoding, decoding, passthrough, and full round-trip pagination Fixes BerriAI#20708 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile OverviewGreptile SummaryThis PR correctly fixes the pagination cursor encoding issue in video list operations. The Key changes:
The implementation follows the existing pattern used for Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| litellm/llms/openai/videos/transformation.py | Adds encoding to first_id and last_id pagination cursors, and decodes after parameter in requests - logic is correct and consistent with existing ID encoding pattern |
| tests/test_litellm/test_video_generation.py | Adds 6 comprehensive unit tests covering encoding/decoding, edge cases, and full round-trip pagination scenarios - excellent test coverage |
Sequence Diagram
sequenceDiagram
participant Client
participant LiteLLM
participant OpenAI as OpenAI/Azure Provider
Note over Client,OpenAI: Video List - First Page Request
Client->>LiteLLM: GET /v1/videos?limit=10
LiteLLM->>LiteLLM: transform_video_list_request(after=None)
LiteLLM->>OpenAI: GET /v1/videos?limit=10
OpenAI-->>LiteLLM: {data: [{id: "video_aaa"}, {id: "video_bbb"}],<br/>first_id: "video_aaa", last_id: "video_bbb"}
LiteLLM->>LiteLLM: transform_video_list_response()
LiteLLM->>LiteLLM: encode data[].id with provider metadata
LiteLLM->>LiteLLM: encode first_id with provider metadata (NEW)
LiteLLM->>LiteLLM: encode last_id with provider metadata (NEW)
LiteLLM-->>Client: {data: [{id: "video_encoded_aaa"}],<br/>first_id: "video_encoded_aaa",<br/>last_id: "video_encoded_bbb"}
Note over Client,OpenAI: Video List - Next Page Request
Client->>LiteLLM: GET /v1/videos?after=video_encoded_bbb
LiteLLM->>LiteLLM: transform_video_list_request(after="video_encoded_bbb")
LiteLLM->>LiteLLM: extract_original_video_id() → "video_bbb" (NEW)
LiteLLM->>OpenAI: GET /v1/videos?after=video_bbb
OpenAI-->>LiteLLM: {data: [{id: "video_ccc"}],<br/>first_id: "video_ccc", last_id: "video_ccc"}
LiteLLM->>LiteLLM: transform_video_list_response()
LiteLLM->>LiteLLM: encode pagination cursors with provider metadata
LiteLLM-->>Client: {data: [{id: "video_encoded_ccc"}],<br/>first_id: "video_encoded_ccc",<br/>last_id: "video_encoded_ccc"}
Sameerlite
changed the base branch from
main
to
litellm_oss_staging_02_08_2026
February 9, 2026 11:11
Sameerlite
merged commit Feb 9, 2026
285c00a
into
BerriAI:litellm_oss_staging_02_08_2026
6 of 8 checks passed
fzowl
pushed a commit
to fzowl/litellm
that referenced
this pull request
Jun 24, 2026
…on-id-encoding Fix video list pagination cursors not encoded with provider metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
transform_video_list_response:first_idandlast_idpagination cursor fields are now encoded withencode_video_id_with_provider(), matching the encoding already applied todata[].idtransform_video_list_request: theafterparameter is now decoded viaextract_original_video_id()before being sent upstream, so wrapped cursor IDs round-trip correctlyFixes #20708
Root Cause
In
litellm/llms/openai/videos/transformation.py,transform_video_list_responseonly iterated overdata[]to encode video IDs with provider metadata, but leftfirst_idandlast_idas raw provider IDs. Clients using these cursors for pagination would pass unencoded IDs back, breaking provider routing.Test plan
TestVideoListTransformation::test_transform_video_list_response_encodes_first_id_and_last_id— verifies both cursors are encodedTestVideoListTransformation::test_transform_video_list_response_no_provider_leaves_ids_unchanged— no encoding when provider is NoneTestVideoListTransformation::test_transform_video_list_response_missing_pagination_fields— handles absent first_id/last_idTestVideoListTransformation::test_transform_video_list_request_decodes_after_parameter— encoded after cursor decoded correctlyTestVideoListTransformation::test_transform_video_list_request_passes_through_plain_after— plain IDs pass throughTestVideoListTransformation::test_transform_video_list_roundtrip— full round-trip: list → use last_id as after → correctly decoded🤖 Generated with Claude Code