$client->createSpeech(...)
例
主なパラメーター
model(必須):TTS対応モデルのID。input(必須):音声に変換するテキスト。voice:音声プリセット(モデルに依存。例:alloy)。format:mp3、wav、flacなど。speed:再生速度の倍率(通常0.25~4)。
戻り値
音声バイナリ(\SplFileObject)Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
PHP SDKで/audio/speechを呼び出します。
$client->createSpeech(...)
<?php
require 'vendor/autoload.php';
use Phaseo\Sdk\Phaseo;
$client = new Phaseo(getenv('PHASEO_API_KEY'));
$audioFile = $client->createSpeech([
'model' => 'openai/gpt-4o-mini-tts',
'input' => 'Hello world',
'voice' => 'alloy',
'format' => 'mp3'
]);
file_put_contents('output.mp3', $audioFile->fread($audioFile->getSize()));
model(必須):TTS対応モデルのID。input(必須):音声に変換するテキスト。voice:音声プリセット(モデルに依存。例:alloy)。format:mp3、wav、flacなど。speed:再生速度の倍率(通常0.25~4)。\SplFileObject)