> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# TTS（テキストから音声へ）

> Ruby SDKで`/audio/speech`を呼び出します。

**メソッド**: `client.generate_speech(...)`または`client.create_speech(...)`。

### 例

```ruby theme={null}
require 'phaseo_sdk'

client = PhaseoSdk::Phaseo.new(api_key: ENV.fetch("PHASEO_API_KEY"))
audio = client.generate_speech(
  model: 'openai/gpt-4o-mini-tts',
  input: 'Hello world',
  voice: 'alloy',
  format: 'mp3'
)
```

### 主なパラメーター

* `model`（必須）: TTS対応モデルのID。
* `input`（必須）: 音声に合成するテキスト。
* `voice`: 音声のプリセット（モデルによって異なります。例: `alloy`）。
* `format`: `mp3`、`wav`、`flac`など。
* `speed`: 再生速度の倍率（通常は0.25～4）。

### 戻り値

バイナリー形式の音声データ


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.