Skip to content

feat(vertex-ai): add veo 3.1 lite model metadata - #30782

Merged
mateo-berri merged 9 commits into
BerriAI:litellm_internal_stagingfrom
emerzon:litellm_veo_31_lite
Aug 29, 2026
Merged

feat(vertex-ai): add veo 3.1 lite model metadata#30782
mateo-berri merged 9 commits into
BerriAI:litellm_internal_stagingfrom
emerzon:litellm_veo_31_lite

Conversation

@emerzon

@emerzon emerzon commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Veo 3.1 Lite exists on Vertex AI but the gateway cannot price it
  • OpenAI-style 1080p size requests never ask Veo for 1080p output

How it solves it:

  • Adds vertex_ai/veo-3.1-lite-generate-001 with 720p and 1080p per-second pricing
  • Maps size to Veo resolution for models with a 1080p pricing tier

User 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

  1. They send POST http://localhost:4000/v1/videos with {"model": "veo-3.1-lite-generate-001", "prompt": "...", "seconds": "8", "size": "1920x1080"}
  2. The response carries a video_... id with status: "processing", and they poll GET http://localhost:4000/v1/videos/{video_id} until status is "completed"
  3. They download the video with GET http://localhost:4000/v1/videos/{video_id}/content and the file is 1280x720, not the 1920x1080 they asked for
  4. They look the request up in GET http://localhost:4000/spend/logs?request_id={video_id} and it shows spend: 0.0

After: the same request comes back as a real 1080p video, priced at the Lite 1080p rate

  1. They send the same POST http://localhost:4000/v1/videos with {"model": "veo-3.1-lite-generate-001", "prompt": "...", "seconds": "8", "size": "1920x1080"}
  2. The response carries a video_... id with status: "processing" and its usage now says "video_resolution": "1080p"; they poll GET http://localhost:4000/v1/videos/{video_id} until status is "completed"
  3. They download the video with GET http://localhost:4000/v1/videos/{video_id}/content and the file is 1920x1080
  4. GET http://localhost:4000/spend/logs?request_id={video_id} shows spend: 0.64 (8 seconds at the $0.08/second 1080p Lite rate)

Relevant issues

Linear ticket

Resolves LIT-5500

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. 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
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to 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=True so the proxy reads the cost map from its own checkout. Same config and same request on both sides

model_list:
  - model_name: veo-3.1-lite-generate-001
    litellm_params:
      model: vertex_ai/veo-3.1-lite-generate-001
      vertex_project: <project>
      vertex_location: us-central1
      vertex_credentials: <service account json path>

general_settings:
  master_key: sk-1234
LITELLM_LOCAL_MODEL_COST_MAP=True DATABASE_URL=<fresh db> python litellm/proxy/proxy_cli.py --config config.yaml --port <port> --num_workers 2

Before (b0626ca)

  1. Create the video
curl -sS -D - -X POST http://localhost:31333/v1/videos -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
  -d '{"model":"veo-3.1-lite-generate-001","prompt":"A slow aerial shot of a lighthouse at sunrise","seconds":"8","size":"1920x1080"}'
HTTP/1.1 200 OK
{"id":"video_bGl0ZWxsbTpjdXN0b21fbGxt...","object":"video","status":"processing","model":"veo-3.1-lite-generate-001","size":null,"seconds":null,"usage":{"duration_seconds":8.0}}
  1. Poll until done
curl -s http://localhost:31333/v1/videos/$VIDEO_ID -H "Authorization: Bearer sk-1234"
{"id":"video_bGl0ZWxsbTpjdXN0b21fbGxt...","status":"completed","model":"veo-3.1-lite-generate-001"}
  1. Download it and check the frame size
curl -s http://localhost:31333/v1/videos/$VIDEO_ID/content -H "Authorization: Bearer sk-1234" -o before.mp4
ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 before.mp4
5838487 bytes
1280x720
  1. Look up the spend
curl -s "http://localhost:31333/spend/logs?request_id=$VIDEO_ID" -H "Authorization: Bearer sk-1234"
[{"request_id":"video_bGl0ZWxsbTpjdXN0b21fbGxt...","model":"vertex_ai/veo-3.1-lite-generate-001","call_type":"avideo_generation","spend":0.0,"usage":{"duration_seconds":8.0}}]

After (a007fa4)

  1. Create the video
curl -sS -D - -X POST http://localhost:41873/v1/videos -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
  -d '{"model":"veo-3.1-lite-generate-001","prompt":"A slow aerial shot of a lighthouse at sunrise","seconds":"8","size":"1920x1080"}'
HTTP/1.1 200 OK
{"id":"video_bGl0ZWxsbTpjdXN0b21fbGxt...","object":"video","status":"processing","model":"veo-3.1-lite-generate-001","size":null,"seconds":null,"usage":{"duration_seconds":8.0,"video_resolution":"1080p"}}
  1. Poll until done
curl -s http://localhost:41873/v1/videos/$VIDEO_ID -H "Authorization: Bearer sk-1234"
{"id":"video_bGl0ZWxsbTpjdXN0b21fbGxt...","status":"completed","model":"veo-3.1-lite-generate-001"}
  1. Download it and check the frame size
curl -s http://localhost:41873/v1/videos/$VIDEO_ID/content -H "Authorization: Bearer sk-1234" -o after.mp4
ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 after.mp4
13377331 bytes
1920x1080
  1. Look up the spend
curl -s "http://localhost:41873/spend/logs?request_id=$VIDEO_ID" -H "Authorization: Bearer sk-1234"
[{"request_id":"video_bGl0ZWxsbTpjdXN0b21fbGxt...","model":"vertex_ai/veo-3.1-lite-generate-001","call_type":"avideo_generation","spend":0.64,"usage":{"duration_seconds":8.0,"video_resolution":"1080p"}}]

Observations from the run, none caused by this PR:

  • size and seconds echo back as null on every response; PR leaves it alone
  • Spend row is keyed by the video id, not x-litellm-call-id; PR leaves it alone

Type

🆕 New Feature
✅ Test

Caveats (if any)

Low

  • Vertex videos docs page does not list this model or the size-to-resolution mapping yet; docs follow-up
  • Proxies reading the remote cost map pick up this pricing only once the entry is published

Changes

Adds vertex_ai/veo-3.1-lite-generate-001 to 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/second

Marks the Vertex Lite entry as accepting text and image inputs

Updates the Vertex video transformer so OpenAI-style video size maps to Veo aspectRatio and, when model metadata advertises a 1080p pricing tier, an inferred resolution. A caller-provided direct resolution or nested parameters.resolution is preserved

Keeps Veo 2 and existing Veo 3 models backward compatible by omitting automatically inferred resolution unless their model-cost metadata advertises a 1080p pricing tier

Adds 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 metadata

Final 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-001 to 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 size still maps to aspectRatio, and when model metadata includes an output_cost_per_second_1080p tier the transformer also infers resolution (e.g. 1920x10801080p). Explicit resolution or nested parameters.resolution are not overridden; Veo 2 and other Veo 3 models without that tier keep omitting inferred resolution.

VideoCreateOptionalRequestParams documents resolution as read-only on the typed params. Tests cover catalog entries, provider routing, tiered video_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.

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@emerzon
emerzon marked this pull request as ready for review June 18, 2026 20:38
Copilot AI review requested due to automatic review settings June 18, 2026 20:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-001 to 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_provider routing to vertex_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.

Comment thread tests/test_litellm/llms/vertex_ai/videos/test_vertex_video_transformation.py Outdated
Comment thread tests/test_litellm/llms/vertex_ai/videos/test_vertex_video_transformation.py Outdated
@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds vertex_ai/veo-3.1-lite-generate-001 to both cost maps with 720p ($0.05/s) and 1080p ($0.08/s) pricing tiers, and updates the Vertex AI video transformer so an OpenAI-style size parameter is mapped to the Veo resolution field — but only for models that advertise output_cost_per_second_1080p in the cost map. Previous-review concerns about hardcoded model-version flags and test isolation have both been addressed in this revision.

  • _supports_resolution_inference is driven entirely by output_cost_per_second_1080p presence in litellm.model_cost, so no version-string checks are in the code path and future models automatically get the feature once their cost entry includes the field.
  • Explicit resolution (both top-level and nested inside parameters) takes priority over the inferred value; Veo 2 and existing Veo 3 entries without output_cost_per_second_1080p are unaffected.
  • Tests cover both cost catalogs, provider routing, cost tiers, size-to-resolution mapping, and all priority/override scenarios using monkeypatch for clean isolation.

Confidence Score: 5/5

  • This PR is safe to merge. The changes are well-scoped: a new model cost entry in both catalogs, a capability-gated resolution inference path, and a new TypedDict field. Existing Veo 2 and Veo 3 models are unaffected by the new logic.
  • The resolution inference is gated entirely on output_cost_per_second_1080p being present in the model cost map rather than on any hardcoded model name, making it safe to extend to future models. The priority ordering (explicit resolution beats inferred) is tested for both the top-level and nested-parameters cases. Usage data flows correctly from map_openai_params through transform_video_create_request into the parameters block where _build_vertex_video_usage_from_request_data reads it. No existing behavior is changed for models without the new cost field.
  • No files require special attention.

Important Files Changed

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

Comment thread model_prices_and_context_window.json
@Sameerlite

Copy link
Copy Markdown
Contributor

Thanks for your contribution! Triggering a code review now.

@greptileai

Comment thread litellm/llms/vertex_ai/videos/transformation.py Outdated
Comment thread litellm/llms/vertex_ai/videos/transformation.py Outdated
@emerzon

emerzon commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@greptile-apps

@codspeed-hq

codspeed-hq Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing emerzon:litellm_veo_31_lite (a007fa4) with litellm_internal_staging (002d006)

Open in CodSpeed

@emerzon
emerzon force-pushed the litellm_veo_31_lite branch from 159093b to d40bf05 Compare August 12, 2026 17:15
@emerzon

emerzon commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Updated and rebased this pull request; @greptile-apps, please review the latest changes and flag any remaining concerns.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

bugbot run

@devin-ai-integration

Copy link
Copy Markdown
Contributor

@greptileai review

@mateo-berri
mateo-berri self-requested a review as a code owner August 29, 2026 19:04
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

1 similar comment
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 mateo-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution!

@mateo-berri
mateo-berri merged commit 8dd9c4a into BerriAI:litellm_internal_staging Aug 29, 2026
84 checks passed
@emerzon
emerzon deleted the litellm_veo_31_lite branch August 29, 2026 21:24
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