tools.generate_veo_video module
Generate videos using Google Veo via the Gemini API.
Supports the full Veo feature surface: - Text-to-video generation with audio (Veo 3.x natively includes audio) - Image-to-video: animate a starting frame - First + last frame interpolation: control both the opening and closing shot - Reference image guided generation: up to 3 asset images to preserve appearance - Video extension: extend a previously Veo-generated clip by ~7 seconds - Multiple model variants: Veo 3.1, 3.1 Fast, 3.1 Lite, Veo 3, Veo 3 Fast, Veo 2 - Resolution: 720p, 1080p, 4k (model-dependent) - Aspect ratio: 16:9 (landscape) or 9:16 (portrait) - Duration: 4 / 6 / 8 seconds (model-dependent) - Negative prompts, person generation controls, seed
Video generation is a long-running API operation (30 s – 6 min). This tool polls until the result is ready, then downloads the MP4 and uploads it to the current channel.
- async tools.generate_veo_video.run(prompt, model='veo-3.1-generate-preview', aspect_ratio='16:9', resolution='720p', duration_seconds=None, image_url=None, last_frame_url=None, reference_image_urls=None, previous_video_url=None, negative_prompt=None, person_generation=None, seed=None, ctx=None)[source]
Generate a Veo video and send the MP4 to the current channel.
- Parameters:
prompt (
str) – Video description with subject, action, style, camera, ambiance.model (
str) – Veo model variant identifier.aspect_ratio (
str) – ‘16:9’ or ‘9:16’.resolution (
str) – ‘720p’, ‘1080p’, or ‘4k’.duration_seconds (
int|None) – Length in seconds (4/6/8 for Veo 3.x; 5/6/8 for Veo 2).image_url (
str|None) – Starting image URL (image-to-video / first frame).last_frame_url (
str|None) – Final frame URL for interpolation (requires image_url).reference_image_urls (
list[str] |None) – 1–3 reference image URLs (Veo 3.1 only).previous_video_url (
str|None) – Previous Veo video URL for extension (Veo 3.1 only).negative_prompt (
str|None) – Elements to exclude from the video.person_generation (
str|None) – ‘allow_all’, ‘allow_adult’, or ‘dont_allow’.ctx (
ToolContext|None) – Tool execution context.
- Returns:
JSON result with success, filename, duration, file_url.
- Return type: