# Add pauses

Pause tags add silence where they are written in a Paxa TTS Flash v2 request: three named lengths per language, or an exact length up to 500 ms. Where a pause falls, speed, billing, and live connections.

On Paxa TTS Flash v2, a pause tag in the `text` of [POST /v1/tts](https://paxalabs.com/docs/api/text-to-speech) adds silence after the word before it. Write a named length, `[short pause]`, `[pause]`, or `[long pause]`, or an exact one such as `[pause 300ms]`. Every voice reads them, and the API checks each one before any charge.

curl:

```bash
curl -X POST https://api.paxalabs.com/v1/tts \
  -H "Authorization: Bearer $PAXA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "ยืนยันคำสั่งซื้อเรียบร้อยแล้วครับ [pause 300ms] พัสดุจะถึงภายในวันศุกร์ [long pause] มีคำถามโทรหาเราได้ตลอดครับ",
    "voice": "khanomkrok",
    "model": "paxa-tts-flash-v2"
  }' \
  --output speech.mp3
```

TypeScript:

```typescript
import { writeFile } from "node:fs/promises";

const response = await fetch("https://api.paxalabs.com/v1/tts", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PAXA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    text: "ยืนยันคำสั่งซื้อเรียบร้อยแล้วครับ [pause 300ms] พัสดุจะถึงภายในวันศุกร์ [long pause] มีคำถามโทรหาเราได้ตลอดครับ",
    voice: "khanomkrok",
    model: "paxa-tts-flash-v2",
  }),
});

if (!response.ok) throw new Error(`TTS failed: ${response.status}`);
await writeFile("speech.mp3", Buffer.from(await response.arrayBuffer()));
```

Python:

```python
import os
import requests

response = requests.post(
    "https://api.paxalabs.com/v1/tts",
    headers={"Authorization": f"Bearer {os.environ['PAXA_API_KEY']}"},
    json={"text": "ยืนยันคำสั่งซื้อเรียบร้อยแล้วครับ [pause 300ms] พัสดุจะถึงภายในวันศุกร์ [long pause] มีคำถามโทรหาเราได้ตลอดครับ", "voice": "khanomkrok", "model": "paxa-tts-flash-v2"},
)
response.raise_for_status()

with open("speech.mp3", "wb") as f:
    f.write(response.content)
```

## Named lengths

A named pause takes its length from the language of the word before the tag.

| Language | `[short pause]` | `[pause]` | `[long pause]` |
| --- | --- | --- | --- |
| Thai | 130 ms | 180 ms | 460 ms |
| Chinese | 100 ms | 140 ms | 360 ms |
| English and every other language | 120 ms | 170 ms | 460 ms |

## Exact lengths

- `[pause 300ms]`, `[pause 0.3s]`, and `[pause:300]` are the same pause. A number with no unit is milliseconds, and `s`, `sec`, `second`, `seconds` read it as seconds.
- Thai and full-width digits read too: `[pause ๓๐๐ms]` is `[pause 300ms]`.
- A length rounds to the nearest 10 ms.
- The longest exact pause is 500 ms. A longer one, such as `[pause 1s]` or `[pause:600]`, plays at 500 ms.

## Where a pause falls

A pause adds its length to the gap the reading already leaves after the word before the tag. That gap is longer at the end of a sentence than between two words. A `[pause]` after a full stop makes a longer silence than one inside a sentence.

## Pauses and speed

A pause tag keeps its length at every `speed`. Speed changes the gaps the reading leaves on its own, and the tag adds the same length to them.

## Billing

Pause tags are text. Every character of a tag, brackets included, counts toward the request's length and its charge. The 111-character example above costs 1.11 credits. A text of pause tags alone answers [422 unspeakable_text](https://paxalabs.com/docs/errors#unspeakable_text) before anything is charged.

## Pauses on a live connection

On a [live connection](https://paxalabs.com/docs/live-streaming) a pause tag reads as it does in a single request. A tag split across frames is read whole.

## Paxa TTS Flash

Paxa TTS Flash (`paxa-tts-flash-v1`) reads no pause tags. Its experimental voices answer `tag_invalid`, since `[pause]` is not on the [emotion tag list](https://paxalabs.com/docs/emotion-tags#tags), and on every other v1 voice the tag is text and is spoken.

> The [OpenAI-compatible endpoint](https://paxalabs.com/docs/api/speech) reads pause tags in `input` under the same rules.
