# SSML on Paxa TTS Flash v2, over HTTP and live sockets

Paxa TTS Flash v2 now reads SSML over HTTP and on its live sockets, and a prompt written for Azure AI Speech plays once its voice names are Paxa voice ids.

Published 2026-11-24. Paxa Labs.

Phone prompts are often written in SSML, the W3C markup for speech. A greeting, a menu, and a hold message each carry their own pauses, a slower sentence where the caller writes something down, and the marks the IVR waits on. Moving those prompts to a new voice used to mean rewriting each one as plain text, and the timing went with the markup.

Paxa TTS Flash v2 now reads SSML. `POST /v1/tts` takes a document in place of text, and `WS /v1/tts/live` and `WS /v1/tts/multi` take one as a frame in the middle of a call. The dialect is a subset of SSML 1.1 with the `mstts` extensions of Azure AI Speech. A prompt written for Azure reads once its voice names are Paxa voice ids.

## What shipped

- `POST /v1/tts` takes the document in an `ssml` field, in place of `text`. Send one of the two. `voice` is still required and speaks the text outside every `<voice>` element.
- Streamed audio (`stream: true`) and word timestamps (`timestamps: "word"`) work with a document as they do with text.
- Every mark comes back with its time, in the `x-ssml-marks` header on buffered audio and as `mark` events in a stream.
- The `x-ssml-report` header lists any markup that did not read as written, one note per element or attribute.
- `WS /v1/tts/live` and `WS /v1/tts/multi` take an `ssml` frame. Each document speaks as one leg of the connection, after any text already buffered, and sends a `report` event and its `mark` events.

## What a document can do

These elements read, with the attributes [the SSML guide](https://paxalabs.com/docs/ssml#elements) lists:

| Element | What it does |
| --- | --- |
| `voice` | Speaks its text in the Paxa voice its `name` gives, by voice id. |
| `break`, `mstts:silence` | Add silence by `time` or `strength`, or before, after, and between sentences. |
| `prosody` | Changes the rate, pitch, pitch range, and volume of its text. |
| `emphasis` | Stresses the words inside it. |
| `mstts:express-as` | Plays one of 34 Azure speaking styles, such as `customerservice` or `cheerful`, as a delivery direction. |
| `mark`, `bookmark` | Places a named point whose time comes back with the audio. |
| `audio` | Plays a recording by URL, and reads the element's own text when the recording cannot play. |
| `mstts:backgroundaudio` | Lays one recording, such as hold music, under the whole output. |
| `p`, `s`, `sub` | Mark paragraphs and sentences, and speak an alias in place of a word. |

`say-as`, `phoneme`, `lexicon`, `lang`, `w`, `token`, and `lookup` are dropped. Their text reads as written, and the report lists each one. Write a date, an amount, or a code in the words it should be spoken in, or give it a `sub` alias. Every Paxa TTS Flash v2 voice speaks English, Thai, and Mandarin and changes language without a `lang` switch.

## Where it fits

### Contact centers and phone menus

A [contact center](https://paxalabs.com/use-cases/call-centers) moves its greeting, menu, and hold messages over as they are written. The breaks keep the pause a caller needs to find a key, and a `prosody` span still slows the sentence with the account number. The mark before the menu comes back with its time, which tells the IVR when the options start. Ask for the audio in mu-law or A-law, the formats a phone line carries, and nothing needs transcoding.

### Voice agents

A [voice agent](https://paxalabs.com/use-cases/voice-agents) streaming its replies on `WS /v1/tts/live` can drop a scripted prompt into the same call. The opening greeting, a legal notice, or a confirmation read back with a pause between its parts goes out as an `ssml` frame between the agent's `text` frames. It speaks in the connection's voice and format, after the text already buffered, and bills into the connection's running total.

On `WS /v1/tts/multi`, the frame carries the call's `context_id`, as every frame there does.

### Announcements

Station, store, and building [announcements](https://paxalabs.com/use-cases/announcements) are written once and played many times. One document can hold the chime as an `audio` clip, a pause, and the message in English, Thai, and Mandarin, with a `voice` element for each speaker.

## How a document is sent

Here is a greeting for a Thai support line, written as an Azure prompt would be, with the voice name changed to a Paxa voice id. It holds a speaking style, a break, a slower sentence, and a mark before the menu.

SSML:

```xml
<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="http://www.w3.org/2001/mstts" xml:lang="th-TH">
  <voice name="khanomkrok">
    <mstts:express-as style="customerservice">สวัสดีครับ ขอบคุณที่โทรหาศูนย์บริการลูกค้า</mstts:express-as>
    <break time="500ms"/>
    <prosody rate="-10%">กรุณาฟังตัวเลือกต่อไปนี้ครับ</prosody>
    <mark name="menu"/>
    กด 1 เพื่อตรวจสอบยอดค้างชำระ กด 2 เพื่อคุยกับเจ้าหน้าที่ครับ
  </voice>
</speak>
```

Over HTTP, the document goes in `ssml`. `voice` names the voice for any text outside a `<voice>` element, and `model` is `paxa-tts-flash-v2`, the one model that reads SSML.

POST /v1/tts:

```json
{
  "model": "paxa-tts-flash-v2",
  "voice": "khanomkrok",
  "ssml": "<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\" xmlns:mstts=\"http://www.w3.org/2001/mstts\" xml:lang=\"th-TH\"> <voice name=\"khanomkrok\"> <mstts:express-as style=\"customerservice\">สวัสดีครับ ขอบคุณที่โทรหาศูนย์บริการลูกค้า</mstts:express-as> <break time=\"500ms\"/> <prosody rate=\"-10%\">กรุณาฟังตัวเลือกต่อไปนี้ครับ</prosody> <mark name=\"menu\"/> กด 1 เพื่อตรวจสอบยอดค้างชำระ กด 2 เพื่อคุยกับเจ้าหน้าที่ครับ </voice> </speak>"
}
```

The response is the audio file. `x-ssml-marks` gives the time of `menu`, and `x-ssml-report` lists anything that did not read as written. With `stream: true`, a document that holds a mark streams NDJSON, with the `mark` event among the audio chunks.

On a live socket, the same document is one frame. A call can open on the scripted greeting and go on with the agent's streamed reply:

WS /v1/tts/live:

```
client  {"type":"start","model":"paxa-tts-flash-v2","voice":"khanomkrok"}
server  started
client  {"type":"ssml","ssml":"<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\" xmlns:mstts=\"http://www.w3.org/2001/mstts\" xml:lang=\"th-TH\"> <voice name=\"khanomkrok\"> <mstts:express-as style=\"customerservice\">สวัสดีครับ ขอบคุณที่โทรหาศูนย์บริการลูกค้า</mstts:express-as> <break time=\"500ms\"/> <prosody rate=\"-10%\">กรุณาฟังตัวเลือกต่อไปนี้ครับ</prosody> <mark name=\"menu\"/> กด 1 เพื่อตรวจสอบยอดค้างชำระ กด 2 เพื่อคุยกับเจ้าหน้าที่ครับ </voice> </speak>"}
server  charged  leg 1
server  report   leg 1
server  audio    ...
server  mark     menu
server  audio    ...
server  flushed  leg 1
client  {"type":"text","text":"ยอดค้างชำระเดือนนี้คือ 1,250 บาท ครบกำหนดวันที่ 5 ธันวาคมครับ\n"}
server  charged  leg 2
server  audio    ...
```

The server charges the leg, sends its `report`, then its audio with the `mark` event for `menu`, and `flushed` once the leg has played. A frame holds up to 64 KiB, and a clip in a socket document points to its recording by URL.

## Billing

The text a document compiles to bills at the speech rate, 10 credits per 1,000 characters, including the tags it writes for styles, prosody, and short pauses. The markup itself does not bill. Audio clips, background audio, and the silence between stretches of speech bill nothing.

A document is checked before any charge. One that is not well-formed XML or passes a limit answers `ssml_invalid` with the line and column of the fault. A voice name the API does not serve answers `unknown_voice`, and a document with nothing to say, only clips and silence, answers `unspeakable_text`.

## Prompts written for Azure

A document written for Azure AI Speech uses the same SSML base and the same `mstts` namespace. Most prompts need three changes:

- Send the document as `ssml` in a JSON body to `POST /v1/tts`, with `"model": "paxa-tts-flash-v2"` and a Paxa API key.
- Replace each `voice` name with a voice id from [the voices page](https://paxalabs.com/voices). Azure voice names do not map to Paxa voices.
- Where a prompt uses `say-as` or `phoneme`, write the date, amount, or code as it should be spoken, or give it a `sub` alias.

[Migrate from Azure](https://paxalabs.com/docs/ssml#azure) lists every other difference, and [the style map](https://paxalabs.com/docs/ssml#styles) gives the delivery each of the 34 styles plays.

## Common questions

### Is this the full SSML standard?

It is a subset of SSML 1.1 with Azure's `mstts` extensions. Voices, breaks, prosody, emphasis, styles, silences, marks, and audio read. The dropped elements read as plain text, each with a note in `x-ssml-report`.

### Does the markup cost extra?

The markup itself never bills. The text it compiles to bills at 10 credits per 1,000 characters, the same rate as plain text. Clips, background audio, and the silence between stretches of speech bill nothing.

### Can one call mix streamed text and SSML?

Yes. On `WS /v1/tts/live` and `WS /v1/tts/multi`, an `ssml` frame speaks after the text already buffered, on the same connection, with the connection's voice for any text outside a `voice` element. Text frames keep streaming around it.

### Which voices read SSML?

Every Paxa TTS Flash v2 voice, and the account's designed voices. A request for another model answers a validation error before any charge.

### What happens when an audio clip cannot load?

The text inside the `audio` element reads in its place, and the report carries a `fallback` note with the reason. Put a spoken version of the recording inside the element, and a failed fetch still says something.

## Next steps

- Read [the SSML guide](https://paxalabs.com/docs/ssml) for every element, attribute, value, and limit.
- Read [What is SSML?](https://paxalabs.com/guides/what-is-ssml) for the standard itself and its common tags.
- Open [the SSML page](https://paxalabs.com/ssml) for what Paxa reads and the teams it serves.

The contract itself lives in the docs.

- [Speak SSML documents](https://paxalabs.com/docs/ssml): Every element, attribute, and limit
- [Synthesize speech](https://paxalabs.com/docs/api/text-to-speech): The ssml field on POST /v1/tts
- [Live speech](https://paxalabs.com/docs/api/live): The ssml frame on the live socket
