Skip to main content

Overview

GMI Cloud Video Generation SDK provides a Python interface for creating, managing, and monitoring video generation requests using state-of-the-art AI models. This SDK allows users to generate videos from text prompts, images, or other inputs through an asynchronous request system.

Features

  • Text-to-Video Generation: Create videos from text descriptions
  • Image-to-Video Generation: Animate static images into videos
  • Asynchronous Processing: Submit requests and monitor progress
  • Multiple Model Support: Access various video generation models
  • Request Management: Track, retrieve, and manage video generation requests
  • Real-time Status Monitoring: Get real-time updates on request progress

Installation

To install the SDK, use pip:

Setup and Authentication

Prerequisites

Before using the video generation SDK, you must have:
  • A GMI Cloud account
  • Valid authentication credentials

Authentication Configuration

There are two ways to configure authentication: Set the following environment variables:

Option 2: Direct Parameter Passing

Pass credentials directly when initializing the client:

Quick Start

1. Initialize the Client

2. Explore Available Models

3. Submit a Video Generation Request

4. Monitor Request Progress

Detailed API Reference

Client Initialization

Video Manager Methods

Get Available Models

Example:

Get Model Details

Example:

Submit Video Generation Request

Request Structure:
Example - Text-to-Video:
Example - Image-to-Video:

Get Request Details

Response Structure:

Get User Requests

Example:

Request Status Reference

The SDK uses the following status values to track request progress:

Complete Example: Text-to-Video Generation

Here’s a complete example that demonstrates the full workflow:

Error Handling

The SDK provides comprehensive error handling:

Best Practices

1. Request Management

  • Always store the request_id returned from create_request()
  • Use appropriate polling intervals (5-10 seconds) to avoid overwhelming the API
  • Implement timeout mechanisms for long-running requests

2. Error Handling

  • Always check for None responses from API calls
  • Handle different request statuses appropriately
  • Implement retry logic for transient failures

3. Resource Management

  • Monitor your usage and costs through the pricing information
  • Clean up completed requests if needed
  • Use appropriate video lengths and quality settings

4. Prompt Engineering

  • Be specific and descriptive in your prompts
  • Use negative prompts to avoid unwanted elements
  • Experiment with different cfg_scale values for desired results

Model-Specific Parameters

Different models may support different parameters. Always check the model details:

Troubleshooting

Common Issues

  1. Authentication Errors
    • Verify your credentials are correct
    • Check that environment variables are properly set
    • Ensure your account has video generation permissions
  2. Request Failures
    • Check the model parameters are valid
    • Verify the model ID exists and is available
    • Review the error details in the response
  3. Long Processing Times
    • Video generation can take several minutes
    • Use appropriate polling intervals
    • Check the model’s expected processing time

Getting Help

For additional support:

API Limits and Pricing

  • Video generation requests are processed asynchronously
  • Processing time varies by model and video length
  • Pricing is per second of video and varies by model
  • Check model_detail.price_info for current pricing