> ## 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（音声合成）

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

**メソッド**：`client.generateSpeech()`。

### 例

```typescript theme={null}
const audio = await client.generateSpeech({
  model: "openai/gpt-4o-mini-tts",
  input: "Hello world",
  voice: "alloy",
  response_format: "mp3",
});
```

### 主なパラメーター

* `model`（必須）：TTS対応モデルのID。
* `input`（必須）：合成するテキスト。
* `voice`：プロバイダーで正規化された音声エイリアス（推奨）またはプロバイダー固有の音声値。
* `response_format`：`mp3`、`wav`、`flac`など。
* `speed`：再生速度の倍率（通常は0.25～4）。

ルーティング先のプロバイダーとモデルの組み合わせで`voice`が無効な場合、APIは`param: "voice"`を付けて`400`を返します。

### プロバイダー設定の例

```typescript theme={null}
// ElevenLabs explicit override
await client.generateSpeech({
  model: "eleven-labs/eleven-v3",
  input: "Hello from ElevenLabs",
  voice: "rachel",
  config: {
    elevenlabs: {
      voice_id: "21m00Tcm4TlvDq8ikWAM"
    }
  }
});

// Google explicit override
await client.generateSpeech({
  model: "google/gemini-2.5-flash-preview-tts",
  input: "Hello from Gemini",
  voice: "kore",
  config: {
    google: {
      voice_name: "Kore"
    }
  }
});
```

### 戻り値

音声バイナリ（Blob）


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