PHP code example of omniflash / omniflash-sdk

1. Go to this page and download the library: Download omniflash/omniflash-sdk 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/ */

    

omniflash / omniflash-sdk example snippets



OmniFlash\Client;

$client = new Client(); // reads OMNIFLASH_API_KEY

$task = $client->run([
    'model_id'     => 'seedance-2',
    'prompt'       => 'a kettle whistles as steam rises, cozy kitchen',
    'aspect_ratio' => '16:9',
]);

echo $task->videoUrl, "\n";
echo $task->audioUrl, "\n"; // synchronized audio

$task = $client->createTask([
    'model_id' => 'gpt-image-2',
    'prompt' => 'cyberpunk corgi, neon rim light',
]);

while (!$task->isDone()) {
    sleep(3);
    $task = $client->getTask($task->taskId);
}
echo $task->imageUrl;
bash
export OMNIFLASH_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx