PHP code example of runapi-ai / happyhorse

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




unApi\Happyhorse\HappyhorseClient;

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

$task = $client->textToVideo->create([
    'model' => 'happyhorse-text-to-video',
    'prompt' => 'A precise product render on white marble',
]);

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

$result = $client->textToVideo->run([
    'model' => 'happyhorse-text-to-video',
    'prompt' => 'A serene mountain lake at dawn',
]);

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