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

# 音頻（TTS / STT）

> 通過 SDK 實現文本轉語音與語音轉文本。

## 文本轉語音

```typescript theme={null}
const audioBuffer = await theo.tts({
  text: "Welcome to Theo. How can I help you today?",
  voice: "theo-voice-warm", // Optional — see table below
  speed: 1.0,               // Optional speed multiplier
});

// audioBuffer is an ArrayBuffer — write to file or stream to client
import { writeFileSync } from "fs";
writeFileSync("output.mp3", Buffer.from(audioBuffer));
```

### 語音

| 語音 | 特點 |
| - | - |
| `theo-voice-classic` | 中性、通用——默認選項 |
| `theo-voice-bright` | 明亮、清晰、活潑 |
| `theo-voice-storyteller` | 敍事感強、富有表現力 |
| `theo-voice-deep` | 低沉、權威 |
| `theo-voice-warm` | 温暖、專業 |
| `theo-voice-soft` | 柔和、沉穩 |

省略 `voice` 或傳入未知值時，將回退為 `theo-voice-classic`。

## 語音轉文本

```typescript theme={null}
const file = new Blob([audioBytes], { type: "audio/mp3" });
const result = await theo.stt(file, "en");

console.log(result.text);              // Transcribed text
console.log(result.language);          // Detected language
console.log(result.duration_seconds);  // Audio duration
console.log(result.usage.cost_cents);  // Cost
```


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