PHP code example of runapi-ai / openai-tts
1. Go to this page and download the library: Download runapi-ai/openai-tts 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 / openai-tts example snippets
unApi\OpenaiTts\OpenaiTtsClient;
$client = new OpenaiTtsClient(); // reads RUNAPI_API_KEY
$result = $client->textToSpeech->run([
'model' => 'tts-1',
'text' => 'A product render',
]);
echo $result->audios[0]->url . PHP_EOL;