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',
]);

$character = $client->createCharacter->run([
    'descriptions' => 'A silver-haired cyberpunk guide',
    'reference_image_url' => 'https://cdn.runapi.ai/public/samples/portrait.jpg',
    'body_reference_image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
]);

$task = $client->textToVideo->create([
    'model' => 'gemini-omni-flash-1-1',
    'aspect_ratio' => '16:9',
    'duration_seconds' => 6,
    'first_frame_image_url' => 'https://cdn.runapi.ai/public/samples/first-frame.jpg',
    'last_frame_image_url' => 'https://cdn.runapi.ai/public/samples/last-frame.jpg',
    'output_resolution' => '360p',
    'prompt' => 'A precise product render travels from dawn into dusk',
]);

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

$result = $client->textToVideo->run([
    'model' => 'gemini-omni-flash-1-1',
    'aspect_ratio' => '16:9',
    'duration_seconds' => 6,
    'first_frame_image_url' => 'https://cdn.runapi.ai/public/samples/first-frame.jpg',
    'last_frame_image_url' => 'https://cdn.runapi.ai/public/samples/last-frame.jpg',
    'output_resolution' => '360p',
    'prompt' => 'A serene mountain lake travels from dawn into dusk',
]);

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