PHP code example of runapi-ai / pixverse
1. Go to this page and download the library: Download runapi-ai/pixverse 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 / pixverse example snippets
unApi\Pixverse\PixverseClient;
$client = new PixverseClient(); // reads RUNAPI_API_KEY
$imageToVideoTask = $client->imageToVideo->create([
'model' => 'pixverse-v6',
'duration_seconds' => 1,
'enable_audio' => true,
'enable_multi_clip' => true,
'first_frame_image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
'output_resolution' => '360p',
'prompt' => 'Make it golden hour',
'seed' => 1,
]);
$task = $client->textToVideo->create([
'model' => 'pixverse-v6',
'aspect_ratio' => '16:9',
'duration_seconds' => 1,
'enable_audio' => true,
'enable_multi_clip' => true,
'output_resolution' => '360p',
'prompt' => 'A precise product render on white marble',
'seed' => 1,
]);
$status = $client->textToVideo->get($task->id);
$result = $client->textToVideo->run([
'model' => 'pixverse-v6',
'aspect_ratio' => '16:9',
'duration_seconds' => 1,
'enable_audio' => true,
'enable_multi_clip' => true,
'output_resolution' => '360p',
'prompt' => 'A serene mountain lake at dawn',
'seed' => 1,
]);
echo $result->videos[0]->url . PHP_EOL;