vidu_text
Generate high-quality videos from text prompts using FAL AI models, with customizable duration and aspect ratio options.
Instructions
Vidu Q1 - High-quality text-to-video
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Text prompt for video generation | |
| duration | No | ||
| aspect_ratio | No | 16:9 |
Implementation Reference
- src/index.ts:627-675 (handler)The handleTextToVideo method that implements the execution logic for the 'vidu_text' tool by calling the FAL API, processing the video output, handling downloads, data URLs, and auto-opening.private async handleTextToVideo(args: any, model: any) { const { prompt, duration = 5, aspect_ratio = '16:9' } = args; try { // Configure FAL client lazily with query config override configureFalClient(this.currentQueryConfig); const inputParams: any = { prompt }; if (duration) inputParams.duration = duration; if (aspect_ratio) inputParams.aspect_ratio = aspect_ratio; const result = await fal.subscribe(model.endpoint, { input: inputParams }); const videoData = result.data as FalVideoResult; const videoProcessed = await downloadAndProcessVideo(videoData.video.url, model.id); return { content: [ { type: 'text', text: JSON.stringify({ model: model.name, id: model.id, endpoint: model.endpoint, prompt, video: { url: videoData.video.url, localPath: videoProcessed.localPath, ...(videoProcessed.dataUrl && { dataUrl: videoProcessed.dataUrl }), width: videoData.video.width, height: videoData.video.height, }, metadata: inputParams, download_path: DOWNLOAD_PATH, data_url_settings: { enabled: ENABLE_DATA_URLS, max_size_mb: Math.round(MAX_DATA_URL_SIZE / 1024 / 1024), }, autoopen_settings: { enabled: AUTOOPEN, note: AUTOOPEN ? "Files automatically opened with default application" : "Auto-open disabled" }, }, null, 2), }, ], }; } catch (error) { throw new Error(`${model.name} generation failed: ${error}`); } }
- src/index.ts:117-117 (registration)Registry entry in MODEL_REGISTRY.textToVideo that defines the 'vidu_text' tool ID, endpoint, name, and description used for dynamic tool registration.{ id: 'vidu_text', endpoint: 'fal-ai/vidu/q1/text-to-video', name: 'Vidu Q1', description: 'High-quality text-to-video' }
- src/index.ts:373-379 (schema)Dynamic input schema generation for text-to-video tools like 'vidu_text' in generateToolSchema, defining prompt, duration, and aspect_ratio parameters.} else if (category === 'textToVideo') { baseSchema.inputSchema.properties = { prompt: { type: 'string', description: 'Text prompt for video generation' }, duration: { type: 'number', default: 5, minimum: 1, maximum: 30 }, aspect_ratio: { type: 'string', enum: ['16:9', '9:16', '1:1', '4:3', '3:4'], default: '16:9' }, }; baseSchema.inputSchema.required = ['prompt'];
- src/index.ts:139-143 (helper)Helper function getModelById used to retrieve the model configuration for 'vidu_text' during tool dispatch.// Helper function to get model by ID function getModelById(id: string) { const allModels = getAllModels(); return allModels.find(model => model.id === id); }
- src/index.ts:477-481 (handler)Dispatch logic in CallToolRequestSchema handler that routes 'vidu_text' calls to handleTextToVideo based on registry lookup.return await this.handleImageGeneration(args, model); } else if (MODEL_REGISTRY.textToVideo.find(m => m.id === name)) { return await this.handleTextToVideo(args, model); } else if (MODEL_REGISTRY.imageToVideo.find(m => m.id === name)) { return await this.handleImageToVideo(args, model);