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

# Text to speech overview

> Convert text to speech with Chariot over REST, HTTP streaming, or WebSocket.

Chariot converts text into natural speech through three transports that share the same voices, model, and billing. They differ in latency and how you feed text in.

| Transport          | Endpoint                                                    | Output                    | Best for                                       |
| ------------------ | ----------------------------------------------------------- | ------------------------- | ---------------------------------------------- |
| **REST (sync)**    | [`POST /v1/tts`](/api-reference/endpoint/text-to-speech)    | Complete `audio/wav` file | Short text where you want one finished file    |
| **HTTP streaming** | [`POST /v1/tts/stream`](/api-reference/endpoint/tts-stream) | Raw PCM stream            | Low time-to-first-byte for a single utterance  |
| **WebSocket**      | `wss://api.chariot.in/v1/tts/ws`                            | Per-sentence audio frames | Real-time, incremental, or long-running speech |

Not sure which to use? See [Choosing an API](/guides/text-to-speech/which-api).

## The request

All three take the same core inputs:

<ParamField body="voice_id" type="string" required>
  UUID of the voice to synthesize with. Get one from [`GET /v1/voices`](/api-reference/endpoint/get-voices).
</ParamField>

<ParamField body="text" type="string" required>
  The text to speak. 1 to 500 characters (after trimming whitespace) for the REST and streaming endpoints. The WebSocket accepts text incrementally across messages.
</ParamField>

<ParamField body="model_type" type="string" default="v0">
  The TTS model. Only `v0` is available today. See [Models](/guides/models).
</ParamField>

## Example

```bash theme={null}
curl -X POST https://api.chariot.in/v1/tts \
  -H "chariotai-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "voice_id": "bac7d666-094d-4698-91fa-741d60fce662",
    "text": "Chariot turns text into speech."
  }' \
  --output speech.wav
```

## Response metadata

The synchronous endpoint returns audio in the body and metadata in headers:

| Header                | Description                         |
| --------------------- | ----------------------------------- |
| `Inference-Id`        | Unique id for the generation        |
| `Audio-Url`           | Persistent URL to the audio         |
| `Credit-Utilized`     | Credits charged (= character count) |
| `Content-Disposition` | Suggested download filename         |

The streaming endpoint uses `X-inference-id` and `X-audio-url` for the same purpose.

## Formats and sample rate

* **Sync (`POST /v1/tts`):** WAV, 44.1 kHz, mono.
* **Streaming (`POST /v1/tts/stream`):** raw signed 16-bit little-endian PCM (`audio/L16`), 44.1 kHz, mono, no WAV header. The complete WAV is available at `X-audio-url` after the stream ends.

## Cost

TTS costs **1 credit per input character**. A 200-character request costs 200 credits. If a generation fails after you were charged, the credits are refunded. See [Credits & pricing](/guides/resources/credits).

## Next steps

<CardGroup cols={2}>
  <Card title="Choosing an API" icon="signs-post" href="/guides/text-to-speech/which-api">
    REST vs. streaming vs. WebSocket, with a decision table.
  </Card>

  <Card title="WebSocket streaming" icon="bolt" href="/guides/text-to-speech/websocket">
    The full real-time protocol.
  </Card>

  <Card title="Voices" icon="microphone-lines" href="/guides/text-to-speech/voices">
    Browse the voice catalog.
  </Card>

  <Card title="Rate limits & concurrency" icon="gauge-high" href="/guides/resources/rate-limits">
    How many requests you can run at once.
  </Card>
</CardGroup>
