Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gemini Omni PHP SDK for RunAPI

Packagist License

The Gemini Omni PHP SDK is the language-specific package for Gemini Omni on RunAPI. Use this package when your application needs Composer installs, associative-array request bodies, task status lookup, and consistent RunAPI errors in PHP.

This README is the PHP package guide for the public gemini-omni-php split repository. For model details, use https://runapi.ai/models/gemini-omni; for API reference, use https://runapi.ai/docs/api/gemini-omni/text-to-video; for SDK docs, use https://runapi.ai/docs/resources/sdks.

Install

composer require runapi-ai/gemini-omni

Quick start

<?php

require __DIR__ . "/vendor/autoload.php";

use RunApi\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;

$character->character->images is ordered portrait first and optional full-body image second. A character created with both references consumes two of the seven reference units in a multimodal video request.

For gemini-omni-flash-1-1, first_frame_image_url cannot be combined with reference images, audio IDs, video clips, or character IDs. last_frame_image_url requires first_frame_image_url.

Use create() to submit a task and return quickly, get() to fetch the latest task state, and run() when a script should create and poll until completion. In web request handlers, prefer create() plus webhook or later get() polling so a worker is not held open.

createAudio is a synchronous resource and only exposes run(). createCharacter->run() returns an immediate result when available. When RunAPI accepts the request for background execution, it follows the Task Result URL until the character response is ready.

RunAPI-generated file URLs are temporary. Download and store generated files in your own durable storage within the retention window; do not treat returned URLs as long-term assets.

Language notes

Pass request parameters as associative arrays with snake_case keys. The available resources are textToVideo, createAudio, createCharacter. Keep RUNAPI_API_KEY in the environment or your secret manager; never commit API keys or callback secrets.

Links

License

Licensed under the Apache License, Version 2.0.

Releases

Packages

Contributors

Languages