Skip to content

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

@tombeckenham

Description

@tombeckenham

Build the Google Gemini Veo video adapter on top of the per-model typed-duration contract introduced in #534.

Why now

#534 ships the typed-duration VideoAdapter contract (availableDurations + snapDuration + per-model duration union). Building the Veo adapter directly on the new contract means it never ships with the old duration?: number API and never breaks.

Current state

  • packages/typescript/ai-gemini/src/adapters/ has no video.ts.
  • packages/typescript/ai-gemini/src/model-meta.ts contains commented-out Veo model entries at lines 827–940 (VEO_3_1_PREVIEW, VEO_3_1_FAST_PREVIEW, VEO_3, VEO_3_FAST, VEO_2).
  • testing/e2e/src/lib/feature-support.ts does not list 'gemini' for 'video-gen'.

Scope

  1. Uncomment + finalize the Veo entries in model-meta.ts and add a GeminiVideoModel union.
  2. Add packages/typescript/ai-gemini/src/video/video-provider-options.ts with GeminiVideoModelDurationByName, GeminiVideoModelSizeByName, and a GEMINI_VIDEO_DURATIONS map sourced from @tanstack/ai-schemas (the gemini OpenAPI spec is already in feat(schemas): @tanstack/ai-schemas with nightly OpenAPI sync (closes #619) #622's pipeline).
  3. Build packages/typescript/ai-gemini/src/adapters/video.ts extending BaseVideoAdapter with the fifth generic and implementing the three core methods (createVideoJob, getVideoStatus, getVideoUrl) plus overriding availableDurations / snapDuration.
  4. Export geminiVideo / createGeminiVideo factories from packages/typescript/ai-gemini/src/index.ts.
  5. Add 'gemini' to the video-gen feature-support set and record an E2E fixture.

Per-model duration shapes (from Veo API docs)

  • veo-2.0-generate-001: integer seconds 5 | 6 | 7 | 8
  • veo-3.0-generate-001, veo-3.0-fast-generate-001: 4 | 8
  • veo-3.1-generate-preview, veo-3.1-fast-generate-preview: 4 | 8

(Confirm against @tanstack/ai-schemas Gemini endpoint Zod map before locking the constants — schema should be the source of truth.)

API surface

Veo uses Google's :predictLongRunning endpoint. Map:

  • createVideoJobPOST {model}:predictLongRunning with parameters: { durationSeconds }.
  • getVideoStatusGET /operations/{name} and map done/error.
  • getVideoUrl → extract response.generatedSamples[0].video.uri (GCS signed URL).

Acceptance

  • geminiVideo('veo-3.0-generate-001') has duration?: 4 | 8 typed at compile time.
  • adapter.availableDurations() returns { kind: 'discrete', values: [4, 8] }.
  • adapter.snapDuration(7) returns 8.
  • E2E test exercises one full job lifecycle against the gemini aimock fixture.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions