### Install Plugin Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md Installs the @elizaos/plugin-video-generation package using npm. ```bash npm install @elizaos/plugin-video-generation ``` -------------------------------- ### Basic Video Generation Example Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md A simple example demonstrating how to generate a video using a text prompt and the `generateVideo` function. ```typescript // Basic video generation const videoPrompt = "Create a video of a futuristic city at night"; const result = await generateVideo(videoPrompt, runtime); ``` -------------------------------- ### Video Generation with Callback Handling Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md An example showing how to handle video generation requests with a callback function to process responses. ```typescript // With callback handling videoGeneration.handler( runtime, { content: { text: videoPrompt }, }, state, {}, (response) => { console.log("Generation status:", response); } ); ``` -------------------------------- ### Build Project Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md Command to build the project using npm scripts. ```bash npm run build ``` -------------------------------- ### Test Project Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md Command to run tests for the project using npm scripts. ```bash npm run test ``` -------------------------------- ### Generate Video from Prompt Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md Shows how to use the video generation functionality by providing a text prompt to the handler. ```typescript import { videoGeneration } from "@elizaos/plugin-video-generation"; // Generate video from prompt const result = await videoGeneration.handler( runtime, { content: { text: "Generate a video of a sunset on the beach" }, }, state, {}, callback ); ``` -------------------------------- ### Run Project in Development Mode Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md Command to run the project in development mode using npm scripts. ```bash npm run dev ``` -------------------------------- ### Luma Dream Machine API Reference Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md Provides details on interacting with the Luma Dream Machine API for text-to-video generation. Includes information on available methods, parameters, and expected responses. ```APIDOC Luma Dream Machine API: Endpoint: https://api.lumalabs.ai/dream-machine Methods: generateVideo(prompt: str, style: str, duration: int, resolution: str, frameRate: int, audio: bool, custom_duration: bool, custom_resolution: str, custom_frameRate: int): Generates a video based on the provided text prompt and parameters. Parameters: prompt (str): The text description for video generation. style (str): The desired visual style for the video. duration (int): The duration of the video in seconds. resolution (str): The resolution of the video (e.g., '1080p', '4k'). frameRate (int): The frame rate of the video (e.g., 24, 30). audio (bool): Whether to include audio in the generated video. custom_duration (bool): Flag to enable custom duration settings. custom_resolution (str): Specifies a custom resolution if custom_duration is true. custom_frameRate (int): Specifies a custom frame rate if custom_duration is true. Returns: Video URL or error message. getGenerationStatus(jobId: str): Retrieves the status of a video generation job. Parameters: jobId (str): The unique identifier for the generation job. Returns: Job status (e.g., 'processing', 'completed', 'failed') and video URL if completed. listModels(): Lists available video generation models. Returns: List of available model names. Error Conditions: - Invalid API key - Malformed request parameters - Exceeded rate limits - Unsupported style or resolution Related Documentation: - Luma AI Documentation: https://docs.lumalabs.ai/ - Video Generation Best Practices: https://lumalabs.ai/docs/best-practices ``` -------------------------------- ### Register Plugin in Eliza Configuration Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md Demonstrates how to import and register the video generation plugin within the Eliza configuration file. ```typescript import { videoGenerationPlugin } from "@elizaos/plugin-video-generation"; export default { plugins: [videoGenerationPlugin], // ... other configuration }; ``` -------------------------------- ### Node.js Fetch API Usage Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md Demonstrates how to use the Node.js Fetch API for making HTTP requests, typically for interacting with external services like the Luma Dream Machine API. ```javascript import fetch from 'node-fetch'; async function callLumaApi(prompt) { const apiUrl = 'https://api.lumalabs.ai/dream-machine'; const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key try { const response = await fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}` }, body: JSON.stringify({ prompt: prompt, style: 'cinematic', duration: 5, resolution: '1080p', frameRate: 30, audio: false }) }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log('Generation Job:', data); // You would typically get a jobId here and then poll for status return data; } catch (error) { console.error('Error calling Luma API:', error); return null; } } // Example usage: // callLumaApi('A futuristic cityscape at sunset'); // Related Node.js API: // https://nodejs.org/api/fetch.html ``` -------------------------------- ### Configuration Environment Variable Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md Specifies the required environment variable for Luma AI API key configuration. ```env LUMA_API_KEY=your_luma_api_key ``` -------------------------------- ### Luma AI API Constants Source: https://github.com/elizaos-plugins/plugin-video-generation/blob/main/README.md Defines constants for Luma AI API URL and the API key setting name. ```typescript export const LUMA_CONSTANTS = { API_URL: "https://api.lumalabs.ai/dream-machine/v1/generations", API_KEY_SETTING: "LUMA_API_KEY", }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.