# Doubao Audio & TTS

Supports both OpenAI-compatible (binary audio) and Volcengine native (raw JSONL/SSE/JSON) routes. [Audio 1.5 Docs](https://docs.volcengine.com/docs/ark/generate-audio-api?lang=zh) · [TTS 3.0 Docs](https://docs.volcengine.com/docs/doubao-voice/seed-tts-3-0-http-streaming?lang=zh) · [TTS 2.0 Docs](https://www.volcengine.com/docs/6561/1598757)

> [!NOTE]
> Example model IDs are for reference only; use actual IDs from the [Model Marketplace](/models).

## Models & Routes

| Model | Capabilities | OpenAI Compatible (Binary) | Volcengine Native (Passthrough) | Voices / Format / Speed | Billing |
| :--- | :--- | :--- | :--- | :--- | :--- |
| `doubao-seed-audio-1-5-261128` (Audio Gen Rec.) | ≤6 min audio gen, audio/image/video refs, stem separation (≤6 tracks), 30-lang video dubbing | `POST /v1/audio/speech` | `POST /api/v3/contents/generations` (JSON) | 2.0 `speaker://` (≤6 refs); `wav`/`mp3`/`pcm`/`ogg_opus`; `-50`–`100` | Upstream `usage.duration_ms` (4 task tiers/min) |
| `doubao-seed-tts-3.0` (Rec.) | 100+ languages & dialects, emotion tags, `instructions`, timestamps | `POST /v1/audio/speech` | `POST /api/v3/text-to-speech/{voice_id}/streaming` (JSONL) | **3.0 only**; `mp3`/`ogg_opus`/`pcm`; `0.5`–`2.0` | Input chars (Han/Kanji=2, else=1) |
| `seed-tts-2.0` | Classic multilingual, SSE/Chunked, `mix_speaker` | `POST /v1/audio/speech` | `POST /api/v3/tts/unidirectional/sse` (SSE)<br>`POST /api/v3/tts/unidirectional` (Chunked) | 2.0 voices; `mp3`/`wav`/`pcm`/`ogg_opus`; `-50`–`100` | Upstream `usage.text_words` |
| `seed-audio-1.0` | Dialogue, SFX & ambient (≤120s), image/audio refs | `POST /v1/audio/speech` | `POST /api/v3/tts/create` (JSON) | Optional 2.0 `speaker` (cite `@音频N`); same | Upstream `original_duration` sec |

> [!TIP]
> Use `POST /v1/audio/speech` for binary audio; use `/api/v3/...` for stem separation, video dubbing, subtitles/video outputs, or Volcengine SDKs. Auth: `Bearer` (`X-Api-Key` also supported on 2.0/3.0 native).

---

## 1. Audio Generation 1.5 (`doubao-seed-audio-1-5-261128`)

Volcengine Ark sync API: **text-to-audio, audio/image/video ref, stem separation, 30-lang video dubbing** (mutually exclusive, ≤6 min / ≤10,000 chars).

### OpenAI-Compatible (`POST /v1/audio/speech`)
```bash
curl -X POST https://www.roookey.com/v1/audio/speech \
  -H "Authorization: Bearer sk-your_token" \
  -H "Content-Type: application/json" -o scene.wav \
  -d '{
    "model": "doubao-seed-audio-1-5-261128",
    "input": "Female narrator (@音频1, warm): [0.5s:5.0s] Welcome to Seed Audio 1.5. Soft piano underlay.",
    "voice": "zh_female_vv_uranus_bigtts",
    "response_format": "wav",
    "sample_rate": 44100,
    "watermark": false
  }'
```
* Optional `voice` (auto `speaker://`), flat `image_url`(≤1), `audio_urls`(≤6), `video_url`(≤1), `speech_rate`/`loudness_rate`(`-50`–`100`), `pitch_rate`(`-12`–`12`), `watermark`; default `wav`/`44100` (`40000` removed; `ogg_opus` only `48000`).

### Ark Native (`POST /api/v3/contents/generations`)
Raw JSON passthrough (`content.audios[]`, `video_url`, `subtitles[]`, `usage.duration_ms`). **Use this route for stem separation, dubbing, and subtitle/video outputs:**
```bash
# ① Text / Multimodal Ref (role: reference_audio / reference_image / reference_video; image cannot mix with audio/video)
curl -X POST https://www.roookey.com/api/v3/contents/generations \
  -H "Authorization: Bearer sk-your_token" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seed-audio-1-5-261128",
    "content": [
      { "type": "text", "text": "Narrate with @音频1 and rain ambience: We finally arrived." },
      { "type": "audio_url", "audio_url": { "url": "speaker://zh_female_vv_uranus_bigtts" }, "role": "reference_audio" },
      { "type": "video_url", "video_url": { "url": "https://example.com/scene.mp4" }, "role": "reference_video" }
    ],
    "output_format": "wav",
    "audio_config": { "sample_rate": 44100 },
    "include": ["video_url", "subtitles.srt"]
  }'
```
```json
// ② Stem Separation (≤6 tracks; no speed/loudness/pitch or subtitles)
{ "model": "doubao-seed-audio-1-5-261128", "output_format": "wav",
  "content": [
    { "type": "text", "text": "Separate vocals, music, and SFX into 3 tracks." },
    { "type": "audio_url", "audio_url": { "url": "https://example.com/mix.mp3" }, "role": "separate_audio" }
  ] }
```
```json
// ③ Video Dubbing (dubbing_video only; custom_subtitle & glossaries exclusive; up to ~10 min latency)
{ "model": "doubao-seed-audio-1-5-261128", "output_format": "wav",
  "content": [{ "type": "video_url", "video_url": { "url": "https://example.com/en.mp4" }, "role": "dubbing_video" }],
  "dubbing_config": { "target_language": "zh", "dialogue_enhancement": "medium" },
  "include": ["video_url", "subtitles.srt", "subtitles_source.srt"] }
```
* **Per-min billing** (`usage.duration_ms` rounded up to whole sec; speed unaffected; 0 on failure; URL 24h/100x): Text/Non-video Ref **`1.00`** · Video Ref **`6.00`** · Dubbing **`4.00`** · Separation **`0.35`** CNY/min.
---

## 2. Doubao Seed TTS 3.0 (`doubao-seed-tts-3.0`)

### OpenAI-Compatible (`POST /v1/audio/speech`)
```bash
curl -X POST https://www.roookey.com/v1/audio/speech \
  -H "Authorization: Bearer sk-your_token" \
  -H "Content-Type: application/json" -o output.mp3 \
  -d '{
    "model": "doubao-seed-tts-3.0",
    "input": "Hello, welcome to Doubao Seed TTS 3.0.",
    "voice": "multi_female_tuanzi_v3_uranus_bigtts",
    "response_format": "mp3",
    "sample_rate": 24000,
    "speed": 1.0,
    "instructions": "gentle and natural"
  }'
```
* Compat notes: `wav` falls back to `mp3`, `pcm` omits `bit_rate`; `instructions` accepts string or array; all `output_format`/`voice_settings` fields plus `session_id`/`pronunciation_dictionary`/`watermark`/`text_normalization`/`enable_markdown_filter`/`silence_duration` can be passed flat.

### Volcengine Native (`POST /api/v3/text-to-speech/{voice_id}/streaming`)
```bash
curl -X POST https://www.roookey.com/api/v3/text-to-speech/multi_female_tuanzi_v3_uranus_bigtts/streaming \
  -H "X-Api-Key: sk-your_token" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello, welcome to Doubao Seed TTS 3.0.",
    "model_id": "doubao-seed-tts-3.0",
    "language_code": "auto",
    "output_format": { "format": "mp3", "sample_rate": 24000, "bit_rate": 64000 },
    "voice_settings": { "speed": 1.0, "volume": 1.0, "pitch": 0, "instructions": ["gentle and natural"] },
    "enable_subtitle": true
  }'
```
* Passes through native JSONL events (`ready` / `audio` Base64 / `alignment` / `final`); in-stream `{"event":"error",...}` auto-refunds at zero cost.

| Param | Req. | Description |
| :--- | :--- | :--- |
| `voice_id` (path) / `voice` | **Yes** | TTS 3.0 voice or clone ID (1.0/2.0 unsupported) |
| `text` / `input` | **Yes*** | Text (≤10,000 chars, emotion tags); exclusive with `ssml` on native route |
| `ssml` | No | Full SSML on native route (exclusive with `text`) |
| `model_id` / `model` | No* | Required on `/v1/audio/speech` (`doubao-seed-tts-3.0`); optional on native (same default) |
| `language_code` | No | Language/dialect, default `auto` (e.g. `zh-CN-x-sichuan`) |
| `output_format` | No | `format` (`mp3`/`ogg_opus`/`pcm`), `sample_rate` (`48000` fixed for `ogg_opus`, else `24000`), `bit_rate` (`64000`/`160000`) |
| `voice_settings` | No | `speed`/`volume` (`0.5`–`2.0`), `pitch` (`-12`–`12`), `instructions` (array), `similarity_boost`, `dialect_boost` |
| `enable_subtitle` | No | Emit `alignment` timestamps in native JSONL stream (default `false`) |

> [!NOTE]
> **3.0 Char Billing**: Han/Kanji = **2**, all others (Latin/digits/kana/punctuation/spaces/newlines) = **1**. Example: `你好，world!` = **11**, `日本のアニメ` = **8**.

---

## 3. Doubao TTS 2.0 (`seed-tts-2.0`)

### OpenAI-Compatible (`POST /v1/audio/speech`)
```bash
curl -X POST https://www.roookey.com/v1/audio/speech \
  -H "Authorization: Bearer sk-your_token" \
  -H "Content-Type: application/json" -o output.mp3 \
  -d '{
    "model": "seed-tts-2.0",
    "input": "Hello, welcome to Doubao TTS 2.0.",
    "voice": "zh_female_vv_uranus_bigtts",
    "response_format": "mp3",
    "sample_rate": 24000,
    "speed": 0
  }'
```
* `speed` maps to `audio_params.speech_rate` (`-50`–`100`, `0` normal, `100` = 2x, `-50` = 0.5x); `mix_speaker` supported.

### Volcengine Native (`SSE` / `Chunked`)
* **Paths**: `POST /api/v3/tts/unidirectional/sse` (SSE) or `/api/v3/tts/unidirectional` (Chunked); set model via `X-Api-Resource-Id` or body `model`.
```bash
curl -X POST https://www.roookey.com/api/v3/tts/unidirectional/sse \
  -H "X-Api-Key: sk-your_token" \
  -H "X-Api-Resource-Id: seed-tts-2.0" \
  -H "Content-Type: application/json" \
  -d '{
    "user": { "uid": "demo_user" },
    "req_params": {
      "text": "Hello, welcome to Doubao TTS 2.0.",
      "speaker": "zh_female_vv_uranus_bigtts",
      "audio_params": { "format": "mp3", "sample_rate": 24000, "speech_rate": 0 }
    }
  }'
```
* Passes through native JSON frames (`code: 0/3000` Base64 `data`, `code: 20000000` end with `usage.text_words`).

---

## 4. Doubao Audio Generation 1.0 (`seed-audio-1.0`)

Multi-speaker dialogue, sound effects, or ambient audio (≤120s), billed strictly by upstream `original_duration` seconds (unaffected by `speech_rate`).

### OpenAI-Compatible (`POST /v1/audio/speech`)
```bash
curl -X POST https://www.roookey.com/v1/audio/speech \
  -H "Authorization: Bearer sk-your_token" \
  -H "Content-Type: application/json" -o scene.mp3 \
  -d '{
    "model": "seed-audio-1.0",
    "input": "Speaker A (gentle female) 声音@音频1\nIn midnight rain, Speaker A whispers: We are finally here.",
    "voice": "zh_female_vv_uranus_bigtts",
    "response_format": "mp3",
    "sample_rate": 44100,
    "speech_rate": 0, "loudness_rate": 0, "pitch_rate": 0
  }'
```
* Compat notes: `voice` optional; supports flat `image_url` (≤1) or `audio_urls` (≤3), mutually exclusive between image and voice/audio (HTTP `400`).

### Volcengine Native (`POST /api/v3/tts/create`)
```bash
curl -X POST https://www.roookey.com/api/v3/tts/create \
  -H "X-Api-Key: sk-your_token" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seed-audio-1.0",
    "text_prompt": "Speaker A (gentle female) 声音@音频1\nIn midnight rain, Speaker A whispers: We are finally here.",
    "references": [{ "speaker": "zh_female_vv_uranus_bigtts" }],
    "audio_config": { "format": "mp3", "sample_rate": 44100, "speech_rate": 0, "loudness_rate": 0, "pitch_rate": 0 }
  }'
```

| Param | Req. | Description |
| :--- | :--- | :--- |
| `model` | **Yes** | `seed-audio-1.0` (or `X-Api-Resource-Id` header) |
| `text_prompt` | **Yes** | Prompt (≤3000 chars); **cite every `speaker`/audio in `references` in order as `@音频1`–`@音频3`** |
| `references` | No | `{"speaker":"..."}`, `{"image_url":"..."}` (`image_bytes`, ≤1), `{"audio_url":"..."}` (`audio_data`, ≤3); **image exclusive with `speaker`/audio** (`400`) |
| `audio_config` | No | `format` (`mp3`/`wav`/`pcm`/`ogg_opus`), `sample_rate` (`48000` for `ogg_opus`, `40000` for `wav`/`pcm`, `44100` for `mp3`), `speech_rate`/`loudness_rate` (`-50`–`100`), `pitch_rate` (`-12`–`12`) |

* Passes through native JSON (`audio` Base64 and/or temp `url`, `original_duration`, `duration`).

### Pitfall: Bind `references` with `@音频N` (Multi-Speaker)
Passing `speaker`/audio in `references` without citing `@音频N` triggers `55001309: audio generate internal error`; cite 1-to-1 in array order matching voice gender/style:
```json
{
  "model": "seed-audio-1.0",
  "text_prompt": "Speaker A (adult male, deep steady) 声音@音频1, Speaker B (middle-aged male, raspy) 声音@音频2\nPhone vibrates in light rain. Speaker A asks seriously: \"Proposal confirmed?\" Speaker B replies calmly: \"Verified and ready for tomorrow.\" Light footsteps.",
  "references": [{ "speaker": "zh_male_example_speaker_1" }, { "speaker": "zh_male_example_speaker_2" }],
  "audio_config": { "format": "mp3", "sample_rate": 48000, "speech_rate": 0, "loudness_rate": 0, "pitch_rate": 0 }
}
```

---

## 5. Voices Quick Reference

3.0 and 1.0/2.0 voices are incompatible (clone IDs supported); Audio 1.5 native requires `speaker://` (auto-added on `/v1/audio/speech`). Search, copy, and preview Doubao & Qwen 3.1 voices below.

| Model | Popular Voices |
| :--- | :--- |
| **TTS 3.0 (ZH)** | Tuanzi `multi_female_tuanzi_v3_uranus_bigtts` · Xiaotian `multi_male_taocheng_v3_uranus_bigtts` · Yunzhou `multi_male_m191_v3_uranus_bigtts` |
| **TTS 3.0 (Dialect/EN)** | Cantonese `multi_male_cantonesemalevoicedb_3_v3_uranus_bigtts` · Sichuan `multi_female_sichuandialectfemalevoicedb_3_v3_uranus_bigtts` · Jamie `multi_male_jamie_v3_uranus_bigtts` |
| **TTS 2.0 / Audio 1.0 / 1.5** | Vivi `zh_female_vv_uranus_bigtts` · Xiaohe `zh_female_xiaohe_uranus_bigtts` · Ahu `zh_male_wennuanahu_uranus_bigtts` · Xiaoming `zh_male_jieshuoxiaoming_uranus_bigtts` |



### 5. Common Error Codes & Troubleshooting

For full HTTP codes, error body formats, and troubleshooting guides, see:

👉 **[Gateway Error Codes & Troubleshooting](/docs/errors/error-codes)**

**Quick reference**:

| Code | Meaning |
| :---: | :--- |
| **400** | Invalid parameters / content moderation or copyright block |
| **402** | Insufficient account balance (**not** 429) |
| **429** | RPS/RPM limits or in-flight task cap (low balance) |
| **403** | Token / IP / model permission (balance → 402; content filter → 400) |
| **200 + `status: failed`** | Async video/long-task business failure on poll |

HTTP status matches call log `status_code` for traceability by `log_id`.
