> ## 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.