Skip to main content

Overview

AI Video Generation tools allow you to create high-quality videos from simple text descriptions using advanced AI models. These tools support multiple video formats, aspect ratios, and durations for various use cases.

Key Features

  • LUMA_TEXT_TO_VIDEO
    • Generate videos using Luma AI’s advanced models (ray-2, ray-flash-2, ray-1-6)
    • Support for 4K resolution and multiple aspect ratios
    • Customizable duration (5s or 10s) with seamless looping options
  • LUMA_TEXT_TO_IMAGE
    • Generate high-quality images from text descriptions
  • KLING_TEXT_TO_VIDEO
    • Generate videos using Kling AI’s enhanced models
    • Improved motion quality and lifelike character generation
    • Support for multiple aspect ratios and durations

Authentication

For further details, click here and click here. To use video generation tools, you need API keys from the respective services: Note: Treat API keys as sensitive information and never commit them to public repositories.

Example: Basic Video Generation

- id: generate_marketing_video
  name: generate_marketing_video
  tool: LUMA_TEXT_TO_VIDEO
  config:
    - name: api_key
      value: "{{secrets.LUMA_API_KEY}}"
    - name: model
      value: "ray-2"
    - name: aspect_ratio
      value: "16:9"
    - name: duration
      value: 10
    - name: loop
      value: false
  input:
    - name: prompt
      value: |
        A professional product showcase video featuring a sleek smartphone 
        rotating slowly on a white background with soft lighting. The phone 
        displays a modern app interface. Camera slowly zooms in to highlight 
        the premium build quality and design details.

- id: generate_social_media_video
  name: generate_social_media_video
  tool: KLING_TEXT_TO_VIDEO
  config:
    - name: api_key
      value: "{{secrets.KLING_API_KEY}}"
    - name: aspect_ratio
      value: "9:16"
    - name: duration
      value: 5
  input:
    - name: prompt
      value: |
        A vibrant animated scene of a person working at a coffee shop, 
        typing on a laptop with steam rising from their coffee cup. 
        Warm afternoon sunlight streaming through the window. 
        Perfect for social media content about productivity and lifestyle.

Example: Video Content Creation Pipeline

- id: get_video_brief
  name: get_video_brief
  tool: INPUT_JSON_WITH_VALIDATION
  input:
    - name: value
      value: {
        "video_type": "product_demo",
        "product_name": "Smart Watch",
        "target_audience": "fitness enthusiasts",
        "duration": 10,
        "style": "modern_minimal"
      }

- id: generate_video_script
  name: generate_video_script
  tool: OPENAI_INVOKE
  config:
    - name: version
      value: gpt-4
  input:
    - name: prompt
      value: |
        Create a detailed video description/prompt for AI video generation based on this brief:
        
        Product: {{steps.get_video_brief.result.product_name}}
        Target Audience: {{steps.get_video_brief.result.target_audience}}
        Duration: {{steps.get_video_brief.result.duration}} seconds
        Style: {{steps.get_video_brief.result.style}}
        Type: {{steps.get_video_brief.result.video_type}}
        
        Requirements:
        1. Write a detailed visual description for AI video generation
        2. Include camera movements, lighting, and composition details
        3. Specify product positioning and key features to highlight
        4. Ensure the description fits the target duration
        5. Match the requested visual style
        
        Format the output as a single, detailed prompt suitable for AI video generation.

- id: create_main_video
  name: create_main_video
  tool: LUMA_TEXT_TO_VIDEO
  config:
    - name: api_key
      value: "{{secrets.LUMA_API_KEY}}"
    - name: model
      value: "ray-2"
    - name: aspect_ratio
      value: "16:9"
    - name: duration
      value: "{{steps.get_video_brief.result.duration}}"
  input:
    - name: prompt
      value: "{{steps.generate_video_script.result.content}}"

- id: create_social_variant
  name: create_social_variant
  tool: KLING_TEXT_TO_VIDEO
  config:
    - name: api_key
      value: "{{secrets.KLING_API_KEY}}"
    - name: aspect_ratio
      value: "9:16"
    - name: duration
      value: 5
  input:
    - name: prompt
      value: |
        Vertical social media version: {{steps.generate_video_script.result.content}}
        Optimized for mobile viewing with close-up shots and dynamic movement.

Example: Multi-Format Content Creation

- id: create_hero_image
  name: create_hero_image
  tool: LUMA_TEXT_TO_IMAGE
  config:
    - name: api_key
      value: "{{secrets.LUMA_API_KEY}}"
  input:
    - name: prompt
      value: |
        A stunning hero image for a tech startup website. Modern office space 
        with diverse team members collaborating around a large display showing 
        data visualizations. Professional lighting, clean design, inspiring 
        atmosphere. High-resolution, photorealistic.

- id: create_background_video
  name: create_background_video
  tool: LUMA_TEXT_TO_VIDEO
  config:
    - name: api_key
      value: "{{secrets.LUMA_API_KEY}}"
    - name: model
      value: "ray-flash-2"
    - name: aspect_ratio
      value: "16:9"
    - name: duration
      value: 10
    - name: loop
      value: true
  input:
    - name: prompt
      value: |
        Subtle background video for website hero section. Gentle floating 
        abstract particles and soft geometric shapes in corporate blue colors. 
        Minimal motion, professional feel, seamless loop. Perfect for website 
        background without being distracting.

- id: create_product_showcase
  name: create_product_showcase
  tool: KLING_TEXT_TO_VIDEO
  config:
    - name: api_key
      value: "{{secrets.KLING_API_KEY}}"
    - name: aspect_ratio
      value: "1:1"
    - name: duration
      value: 5
  input:
    - name: prompt
      value: |
        Square format product showcase for Instagram. Modern laptop computer 
        on a clean desk setup with plants and coffee. Smooth 360-degree 
        rotation showing all angles. Premium aesthetic with natural lighting 
        and minimal shadows.

Example: Video Generation with Quality Control

- id: generate_video_options
  name: generate_video_options
  tool: PYTHON_SANDBOX_RUN
  input:
    - name: script
      value: |
        import json
        
        base_prompt = "A professional presentation of a new mobile app interface"
        
        # Generate variations for A/B testing
        variations = [
            {
                "name": "version_a_minimal",
                "prompt": f"{base_prompt} with minimal design, clean white background, subtle animations",
                "model": "ray-2",
                "aspect_ratio": "16:9"
            },
            {
                "name": "version_b_dynamic",
                "prompt": f"{base_prompt} with dynamic camera movements, colorful gradient background, energetic transitions",
                "model": "ray-flash-2",
                "aspect_ratio": "16:9"
            },
            {
                "name": "version_c_social",
                "prompt": f"{base_prompt} optimized for social media, vertical format, engaging visual effects",
                "model": "ray-2",
                "aspect_ratio": "9:16"
            }
        ]
        
        print(json.dumps({"variations": variations}))

- id: create_version_a
  name: create_version_a
  tool: LUMA_TEXT_TO_VIDEO
  config:
    - name: api_key
      value: "{{secrets.LUMA_API_KEY}}"
    - name: model
      value: "{{steps.generate_video_options.result.variations[0].model}}"
    - name: aspect_ratio
      value: "{{steps.generate_video_options.result.variations[0].aspect_ratio}}"
    - name: duration
      value: 10
  input:
    - name: prompt
      value: "{{steps.generate_video_options.result.variations[0].prompt}}"

- id: create_version_b
  name: create_version_b
  tool: LUMA_TEXT_TO_VIDEO
  config:
    - name: api_key
      value: "{{secrets.LUMA_API_KEY}}"
    - name: model
      value: "{{steps.generate_video_options.result.variations[1].model}}"
    - name: aspect_ratio
      value: "{{steps.generate_video_options.result.variations[1].aspect_ratio}}"
    - name: duration
      value: 10
  input:
    - name: prompt
      value: "{{steps.generate_video_options.result.variations[1].prompt}}"

- id: analyze_results
  name: analyze_results
  tool: PYTHON_SANDBOX_RUN
  input:
    - name: script
      value: |
        import json
        
        # Compile results
        results = {
            "version_a": {
                "url": "{{steps.create_version_a.result.video_url}}",
                "status": "{{steps.create_version_a.result.status}}",
                "style": "minimal"
            },
            "version_b": {
                "url": "{{steps.create_version_b.result.video_url}}",
                "status": "{{steps.create_version_b.result.status}}",
                "style": "dynamic"
            }
        }
        
        print(json.dumps({"video_results": results}))

Tips and Best Practices

  • Use specific, detailed prompts for better video quality
  • Choose the right model based on your needs (quality vs speed)
  • Consider aspect ratio based on intended platform (16:9 for web, 9:16 for mobile)
  • Test different prompt variations to find the best results
  • Use looping for background videos and website elements
  • Plan video duration based on platform requirements
  • Include lighting, camera movement, and composition details in prompts
  • Consider creating multiple versions for A/B testing
  • Monitor API usage and costs for high-volume generation