PHP code example of runapi-ai / minimax-h3

1. Go to this page and download the library: Download runapi-ai/minimax-h3 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

runapi-ai / minimax-h3 example snippets




unApi\MinimaxH3\MinimaxH3Client;

$client = new MinimaxH3Client(); // reads RUNAPI_API_KEY

$imageToVideoTask = $client->imageToVideo->create([
    'model' => 'minimax-h3',
    'duration_seconds' => 4,
    'first_frame_image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
    'last_frame_image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
    'output_resolution' => '768p',
    'prompt' => 'Make it golden hour',
]);

$task = $client->textToVideo->create([
    'model' => 'minimax-h3',
    'aspect_ratio' => 'adaptive',
    'duration_seconds' => 4,
    'output_resolution' => '768p',
    'prompt' => 'A precise product render on white marble',
    'reference_audio_urls' => ['https://cdn.runapi.ai/public/samples/voice.mp3'],
    'reference_image_urls' => ['https://cdn.runapi.ai/public/samples/image.jpg'],
    'reference_video_urls' => ['https://cdn.runapi.ai/public/samples/video.mp4'],
]);

$status = $client->textToVideo->get($task->id);

$result = $client->textToVideo->run([
    'model' => 'minimax-h3',
    'aspect_ratio' => 'adaptive',
    'duration_seconds' => 4,
    'output_resolution' => '768p',
    'prompt' => 'A serene mountain lake at dawn',
    'reference_audio_urls' => ['https://cdn.runapi.ai/public/samples/voice.mp3'],
    'reference_image_urls' => ['https://cdn.runapi.ai/public/samples/image.jpg'],
    'reference_video_urls' => ['https://cdn.runapi.ai/public/samples/video.mp4'],
]);

echo $result->videos[0]->url . PHP_EOL;