Skip to content

feat(ai-gemini): add Google Veo video adapter on the typed-duration contract#741

Open
tombeckenham wants to merge 1 commit into
534-video-duration-supportfrom
634-featgemini-add-google-veo-video-adapter-on-the-typed-duration-contract
Open

feat(ai-gemini): add Google Veo video adapter on the typed-duration contract#741
tombeckenham wants to merge 1 commit into
534-video-duration-supportfrom
634-featgemini-add-google-veo-video-adapter-on-the-typed-duration-contract

Conversation

@tombeckenham

Copy link
Copy Markdown
Contributor

🎯 Changes

Closes #634. Stacked on #641 (534-video-duration-support), which is itself stacked on #622 — this PR targets the #641 branch and should merge after it (or land through the stack).

Adds a Google Veo video adapter to @tanstack/ai-gemini, built directly on the per-model typed-duration VideoAdapter contract from #534:

  • model-meta.ts — uncomments and finalizes the five Veo entries (veo-3.1-generate-preview, veo-3.1-fast-generate-preview, veo-3.0-generate-001, veo-3.0-fast-generate-001, veo-2.0-generate-001) and adds a GEMINI_VIDEO_MODELS union. The stale GeminiGenerationConfigOptions reference in the commented code was replaced with the same options intersection the Imagen entries use.
  • video/video-provider-options.tsGeminiVideoModelDurationByName, GeminiVideoModelSizeByName (Veo sizes are aspect ratios '16:9' | '9:16'; resolution lives in modelOptions), and a GEMINI_VIDEO_DURATIONS runtime table. GeminiVideoProviderOptions is the vendor GenerateVideosConfig minus the fields the adapter manages (durationSeconds, aspectRatio, transport).
  • adapters/video.tsGeminiVideoAdapter extends BaseVideoAdapter with the fifth generic, driving models.generateVideos (:predictLongRunning) / operations.getVideosOperation. getVideoStatus maps done/error and surfaces all-samples-RAI-filtered as failed with the reasons; getVideoUrl returns response.generatedVideos[0].video.uri. availableDurations/snapDuration overridden via snapToDurationOption.
  • FactoriesgeminiVideo / createGeminiVideo exported from the package root, following the image adapter pattern.
  • E2E'gemini' added to the video-gen feature set; global-setup.ts mounts Veo's :predictLongRunning + operations-poll endpoints (aimock 1.29 mocks Gemini :predict but not the long-running pair), responding with the raw MLDev wire shape the SDK normalizes. All three transports (SSE, HTTP stream, fetcher) pass the full job lifecycle.
  • Docs + skill — Veo section in docs/media/video-generation.md (typed durations table, snapDuration example, download-auth note) and the media-generation SKILL.md.

Deviations from the issue

  • Duration values: the issue's table said Veo 3.x = 4 | 8 and Veo 2 = 5–8. The issue asked to confirm before locking; the @tanstack/ai-schemas Gemini spec types :predictLongRunning parameters as z.unknown() (no duration data), and the current official Veo docs say Veo 3.x: 4 | 6 | 8, Veo 2: 5 | 6 | 8 — those are what shipped. Consequently snapDuration(7) returns 6 (closest), not 8 as the issue's acceptance line assumed. I attempted live API confirmation via invalid-duration probes, but the key's prepaid credits are depleted (429 before validation), so docs are the source of truth.
  • Durations are numbers (durationSeconds?: number in the SDK), not strings as for Sora.
  • Base-branch lint fixes: pnpm test:pr on the base branch fails @typescript-eslint/no-unnecessary-type-assertion in snap.ts and ai-fal/adapters/video.ts (the red Test check on feat(ai,ai-fal): per-model typed durations for video generation #641). This PR includes the eslint --fix one-liners so the stacked gate is green — feel free to cherry-pick them into feat(ai,ai-fal): per-model typed durations for video generation #641 instead.

Acceptance criteria

  • geminiVideo('veo-3.0-generate-001') has duration?: 4 | 6 | 8 at compile time (asserted with expectTypeOf in tests/video-adapter.test.ts)
  • adapter.availableDurations(){ kind: 'discrete', values: [4, 6, 8] }
  • adapter.snapDuration(7)6 (see deviation note above)
  • ✅ E2E exercises the full create → poll → URL lifecycle against the mocked Gemini endpoints for all three transports

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

🤖 Generated with Claude Code

…ontract (#634)

Builds the Veo adapter directly on the per-model typed-duration VideoAdapter
contract from #534:

- Uncomment + finalize the five Veo model entries in model-meta.ts and add
  a GEMINI_VIDEO_MODELS union.
- Add video/video-provider-options.ts with GeminiVideoModelDurationByName,
  GeminiVideoModelSizeByName, and a docs-curated GEMINI_VIDEO_DURATIONS map
  (the ai-schemas Gemini spec types :predictLongRunning parameters as
  unknown, so it carries no per-model duration data).
- Implement GeminiVideoAdapter over @google/genai generateVideos /
  getVideosOperation with availableDurations/snapDuration overrides, RAI
  filter surfacing, and geminiVideo/createGeminiVideo factories.
- Wire gemini into the video-gen E2E feature matrix with a Veo
  predictLongRunning + operations mount in global-setup.
- Update video-generation docs and the media-generation skill.
- Fix pre-existing no-unnecessary-type-assertion lint errors in the base
  branch's snap.ts / fal video.ts so the stacked PR gate is green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9dbb82c4-0789-497f-84ae-bf622ac029b0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 634-featgemini-add-google-veo-video-adapter-on-the-typed-duration-contract

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

4 package(s) bumped directly, 27 bumped as dependents.

🟥 Major bumps

Package Version Reason
@tanstack/ai 0.21.3 → 1.0.0 Changeset
@tanstack/ai-fal 0.7.13 → 1.0.0 Changeset
@tanstack/ai-gemini 0.10.10 → 1.0.0 Changeset
@tanstack/ai-anthropic 0.10.3 → 1.0.0 Dependent
@tanstack/ai-code-mode 0.1.20 → 1.0.0 Dependent
@tanstack/ai-code-mode-skills 0.1.20 → 1.0.0 Dependent
@tanstack/ai-elevenlabs 0.2.10 → 1.0.0 Dependent
@tanstack/ai-event-client 0.3.10 → 1.0.0 Dependent
@tanstack/ai-grok 0.8.7 → 1.0.0 Dependent
@tanstack/ai-groq 0.2.6 → 1.0.0 Dependent
@tanstack/ai-isolate-node 0.1.20 → 1.0.0 Dependent
@tanstack/ai-isolate-quickjs 0.1.20 → 1.0.0 Dependent
@tanstack/ai-ollama 0.6.21 → 1.0.0 Dependent
@tanstack/ai-openai 0.10.0 → 1.0.0 Dependent
@tanstack/ai-openrouter 0.9.7 → 1.0.0 Dependent
@tanstack/ai-preact 0.6.32 → 1.0.0 Dependent
@tanstack/ai-react 0.11.7 → 1.0.0 Dependent
@tanstack/ai-react-ui 0.8.1 → 1.0.0 Dependent
@tanstack/ai-solid 0.10.7 → 1.0.0 Dependent
@tanstack/ai-solid-ui 0.7.1 → 1.0.0 Dependent
@tanstack/ai-svelte 0.10.7 → 1.0.0 Dependent
@tanstack/ai-vue 0.10.8 → 1.0.0 Dependent
@tanstack/openai-base 0.3.6 → 1.0.0 Dependent

🟨 Minor bumps

Package Version Reason
@tanstack/ai-schemas 0.1.0 → 0.2.0 Changeset

🟩 Patch bumps

Package Version Reason
@tanstack/ai-client 0.11.7 → 0.11.8 Dependent
@tanstack/ai-devtools-core 0.3.37 → 0.3.38 Dependent
@tanstack/ai-isolate-cloudflare 0.2.11 → 0.2.12 Dependent
@tanstack/ai-vue-ui 0.2.3 → 0.2.4 Dependent
@tanstack/preact-ai-devtools 0.1.41 → 0.1.42 Dependent
@tanstack/react-ai-devtools 0.2.41 → 0.2.42 Dependent
@tanstack/solid-ai-devtools 0.2.41 → 0.2.42 Dependent

@nx-cloud

nx-cloud Bot commented Jun 10, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 27eaac5

Command Status Duration Result
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 1m 8s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-10 08:55:45 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jun 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@tanstack/ai

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai@741

@tanstack/ai-anthropic

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-anthropic@741

@tanstack/ai-client

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-client@741

@tanstack/ai-code-mode

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode@741

@tanstack/ai-code-mode-skills

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode-skills@741

@tanstack/ai-devtools-core

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-devtools-core@741

@tanstack/ai-elevenlabs

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-elevenlabs@741

@tanstack/ai-event-client

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-event-client@741

@tanstack/ai-fal

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-fal@741

@tanstack/ai-gemini

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-gemini@741

@tanstack/ai-grok

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok@741

@tanstack/ai-groq

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-groq@741

@tanstack/ai-isolate-cloudflare

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-cloudflare@741

@tanstack/ai-isolate-node

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-node@741

@tanstack/ai-isolate-quickjs

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-quickjs@741

@tanstack/ai-ollama

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollama@741

@tanstack/ai-openai

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openai@741

@tanstack/ai-openrouter

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openrouter@741

@tanstack/ai-preact

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-preact@741

@tanstack/ai-react

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react@741

@tanstack/ai-react-ui

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react-ui@741

@tanstack/ai-schemas

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-schemas@741

@tanstack/ai-solid

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid@741

@tanstack/ai-solid-ui

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid-ui@741

@tanstack/ai-svelte

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-svelte@741

@tanstack/ai-utils

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-utils@741

@tanstack/ai-vue

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue@741

@tanstack/ai-vue-ui

npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue-ui@741

@tanstack/openai-base

npm i https://pkg.pr.new/TanStack/ai/@tanstack/openai-base@741

@tanstack/preact-ai-devtools

npm i https://pkg.pr.new/TanStack/ai/@tanstack/preact-ai-devtools@741

@tanstack/react-ai-devtools

npm i https://pkg.pr.new/TanStack/ai/@tanstack/react-ai-devtools@741

@tanstack/solid-ai-devtools

npm i https://pkg.pr.new/TanStack/ai/@tanstack/solid-ai-devtools@741

commit: 27eaac5

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.

1 participant