feat(vertex-ai): add veo 3.1 lite model metadata - #30782
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Adds pricing/catalog metadata for the Vertex AI Veo 3.1 Lite video generation model and extends the Vertex video test suite to validate presence, routing, and resolution-tier pricing.
Changes:
- Added
vertex_ai/veo-3.1-lite-generate-001to the canonical and bundled model cost maps with per-second and 1080p-tier pricing. - Added Vertex video transformation tests to assert catalog inclusion,
get_llm_providerrouting tovertex_ai, and tiered video cost behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
tests/test_litellm/llms/vertex_ai/videos/test_vertex_video_transformation.py |
Adds tests validating the new Veo 3.1 Lite catalog entries, provider routing, and tiered cost calculation. |
model_prices_and_context_window.json |
Adds model metadata + pricing fields for vertex_ai/veo-3.1-lite-generate-001. |
litellm/model_prices_and_context_window_backup.json |
Mirrors the same model metadata + pricing in the bundled backup map. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryAdds
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| litellm/llms/vertex_ai/videos/transformation.py | Adds class-level size-to-aspect-ratio and size-to-resolution mappings, plus resolution inference gated on output_cost_per_second_1080p presence in the model cost map. Logic correctly handles explicit resolution (top-level and nested), falls back cleanly for models without 1080p metadata, and the usage dict reads request_data["parameters"]["resolution"] which is where the merged vertex_params land. |
| litellm/types/videos/main.py | Adds `resolution: ReadOnly[str |
| model_prices_and_context_window.json | Adds vertex_ai/veo-3.1-lite-generate-001 with output_cost_per_second: 0.05, output_cost_per_second_1080p: 0.08, litellm_provider: vertex_ai-video-models, and supported_modalities: [text, image]. Entry mirrors the backup file exactly. |
| litellm/model_prices_and_context_window_backup.json | Identical new entry to the root cost map. Both files are kept in sync. |
| tests/test_litellm/llms/vertex_ai/videos/test_vertex_video_transformation.py | New tests cover: cost map presence in both files, provider routing from bundled map (monkeypatched), 720p/1080p cost tiers, size→resolution mapping, no injection for Veo 2 and existing Veo 3 entries without 1080p metadata, and priority of explicit resolution over inferred. Uses monkeypatch for isolation. No real network calls. |
Reviews (8): Last reviewed commit: "Merge branch 'litellm_internal_staging' ..." | Re-trigger Greptile
|
Thanks for your contribution! Triggering a code review now. |
159093b to
d40bf05
Compare
|
Updated and rebased this pull request; @greptile-apps, please review the latest changes and flag any remaining concerns. |
|
bugbot run |
|
@greptileai review |
1 similar comment
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a007fa4. Configure here.
mateo-berri
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the contribution!
8dd9c4a
into
BerriAI:litellm_internal_staging
TLDR
Problem this solves:
sizerequests never ask Veo for 1080p outputHow it solves it:
vertex_ai/veo-3.1-lite-generate-001with 720p and 1080p per-second pricingsizeto Veoresolutionfor models with a 1080p pricing tierUser Flow
Before: a developer generating a 1080p video with Veo 3.1 Lite gets a 720p video back and the gateway tracks no spend for it
POST http://localhost:4000/v1/videoswith{"model": "veo-3.1-lite-generate-001", "prompt": "...", "seconds": "8", "size": "1920x1080"}video_...id withstatus: "processing", and they pollGET http://localhost:4000/v1/videos/{video_id}untilstatusis"completed"GET http://localhost:4000/v1/videos/{video_id}/contentand the file is 1280x720, not the 1920x1080 they asked forGET http://localhost:4000/spend/logs?request_id={video_id}and it showsspend: 0.0After: the same request comes back as a real 1080p video, priced at the Lite 1080p rate
POST http://localhost:4000/v1/videoswith{"model": "veo-3.1-lite-generate-001", "prompt": "...", "seconds": "8", "size": "1920x1080"}video_...id withstatus: "processing"and itsusagenow says"video_resolution": "1080p"; they pollGET http://localhost:4000/v1/videos/{video_id}untilstatusis"completed"GET http://localhost:4000/v1/videos/{video_id}/contentand the file is 1920x1080GET http://localhost:4000/spend/logs?request_id={video_id}showsspend: 0.64(8 seconds at the $0.08/second 1080p Lite rate)Relevant issues
Linear ticket
Resolves LIT-5500
Pre-Submission checklist
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Live run against a real Vertex AI project (real Veo 3.1 Lite generations, real spend). Each leg is its own proxy booted with 2 uvicorn workers on its own fresh Postgres database, with
LITELLM_LOCAL_MODEL_COST_MAP=Trueso the proxy reads the cost map from its own checkout. Same config and same request on both sidesBefore (b0626ca)
After (a007fa4)
Observations from the run, none caused by this PR:
sizeandsecondsecho back asnullon every response; PR leaves it alonex-litellm-call-id; PR leaves it aloneType
🆕 New Feature
✅ Test
Caveats (if any)
Low
Changes
Adds
vertex_ai/veo-3.1-lite-generate-001to the root and bundled model-cost maps with Vertex video routing and Lite per-second pricing from the Gemini Enterprise Agent Platform Veo table. The default rate is 720p video with audio at$0.05/second; the 1080p tier is$0.08/secondMarks the Vertex Lite entry as accepting text and image inputs
Updates the Vertex video transformer so OpenAI-style video
sizemaps to VeoaspectRatioand, when model metadata advertises a 1080p pricing tier, an inferredresolution. A caller-provided directresolutionor nestedparameters.resolutionis preservedKeeps Veo 2 and existing Veo 3 models backward compatible by omitting automatically inferred
resolutionunless their model-cost metadata advertises a 1080p pricing tierAdds tests that confirm the model is present in both catalogs, resolves from the bundled catalog to
vertex_ai, uses the 720p and 1080p video cost tiers, maps resolution-tier model sizes into the documented Vertex parameters, preserves explicit resolution, and does not inject resolution into Veo 2 or existing Veo 3 requests without resolution-tier metadataFinal Attestation
The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
a007fa4 passes /live-pr-risk
Note
Medium Risk
Changes Vertex video request shaping and spend accounting for resolution-tier models; behavior is gated on cost-map metadata and preserves explicit resolution, but wrong inference would affect output quality and billing.
Overview
Adds
vertex_ai/veo-3.1-lite-generate-001to the model cost catalogs with 720p ($0.05/s) and 1080p ($0.08/s) tiers so the gateway can route and price Lite generations.For Vertex Veo video create, OpenAI-style
sizestill maps toaspectRatio, and when model metadata includes anoutput_cost_per_second_1080ptier the transformer also infersresolution(e.g.1920x1080→1080p). Explicitresolutionor nestedparameters.resolutionare not overridden; Veo 2 and other Veo 3 models without that tier keep omitting inferred resolution.VideoCreateOptionalRequestParamsdocumentsresolutionas read-only on the typed params. Tests cover catalog entries, provider routing, tieredvideo_generation_cost, and the new mapping edge cases.Reviewed by Cursor Bugbot for commit a007fa4. Bugbot is set up for automated code reviews on this repo. Configure here.