PHP code example of runapi-ai / gemini-omni

1. Go to this page and download the library: Download runapi-ai/gemini-omni 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 / gemini-omni example snippets




unApi\GeminiOmni\GeminiOmniClient;

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

$createAudioResult = $client->createAudio->run([
    'model' => 'gemini-omni-audio',
    'audio_id' => 'zephyr',
    'example_dialogue' => 'sample',
    'name' => 'sample',
    'voice_description' => 'sample',
]);

$task = $client->textToVideo->create([
    'model' => 'gemini-omni-flash-preview',
    'aspect_ratio' => '16:9',
    'audio_ids' => ['audio_1'],
    'character_ids' => ['character_1'],
    'duration_seconds' => 4,
    'output_resolution' => '720p',
    'prompt' => 'A precise product render on white marble',
    'reference_image_urls' => ['https://cdn.runapi.ai/public/samples/image.jpg'],
    'seed' => 1,
    'video_list' => [['url' => 'https://cdn.runapi.ai/public/samples/video.mp4', 'start' => 0, 'ends' => 4]],
]);

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

$result = $client->textToVideo->run([
    'model' => 'gemini-omni-flash-preview',
    'aspect_ratio' => '16:9',
    'audio_ids' => ['audio_1'],
    'character_ids' => ['character_1'],
    'duration_seconds' => 4,
    'output_resolution' => '720p',
    'prompt' => 'A serene mountain lake at dawn',
    'reference_image_urls' => ['https://cdn.runapi.ai/public/samples/image.jpg'],
    'seed' => 1,
    'video_list' => [['url' => 'https://cdn.runapi.ai/public/samples/video.mp4', 'start' => 0, 'ends' => 4]],
]);

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