> ## Documentation Index
> Fetch the complete documentation index at: https://rimelabs-docs-coda-websocket-reference.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# API cheat sheet

> Base URLs, bearer authentication, and runnable examples for Rime's HTTP, WebSocket, voice, vocabulary, and text-normalization endpoints.

Create a key on the [API Tokens page](https://app.rime.ai/tokens) before running the authenticated examples below.

## Hosts and authentication

| What                                                          | Where                       |
| ------------------------------------------------------------- | --------------------------- |
| REST API (TTS, voices, coverage)                              | `https://users.rime.ai`     |
| Coda WebSocket v1                                             | `wss://api.rime.ai/coda/ws` |
| Older WebSocket endpoints                                     | `wss://users-ws.rime.ai`    |
| Text normalization                                            | `https://optimize.rime.ai`  |
| Docs (this site, plus `/llms.txt` and per-page `.md` exports) | `https://docs.rime.ai`      |

<Warning>
  * The HTTP examples below use `users.rime.ai/v1/rime-tts`. Coda WebSocket v1 uses `api.rime.ai/coda/ws`.
  * Authenticate with `Authorization: Bearer YOUR_API_KEY`. On WebSocket connections, send the same value as a connection header.
  * Keep the key on a server. Browser `WebSocket` objects cannot set the required header, so browser applications need a server-side bridge.
  * Use standard HTTP and WebSocket clients. The `rime-api` Python package supplies Protobuf message definitions for [binary WebSocket clients](/api-reference/coda/websockets-binary); it does not manage connections.
</Warning>

## Synthesize speech (HTTP)

`POST /v1/rime-tts` returns audio bytes in the format named by your `Accept` header (`audio/mpeg`, `audio/wav`, `audio/webm;codecs=opus`, `audio/ogg;codecs=opus`, `audio/L16`, `audio/PCMU`):

```bash theme={null}
curl -X POST https://users.rime.ai/v1/rime-tts \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -H 'Accept: audio/mpeg' \
  --output hello.mp3 \
  -d '{"text": "Hello from Rime.", "speaker": "astra", "modelId": "coda"}'
```

Full parameters and streaming variants: [Coda HTTP reference](/api-reference/coda/http) · [Streaming guide](/docs/streaming)

## Stream Coda speech over WebSocket

Connect to `wss://api.rime.ai/coda/ws` with `rime.v1.json` and wait for `ready`. Send these messages separately to stream a sentence as PCM audio:

```json theme={null}
{"contextId":"turn-1","start":{"speaker":"lyra","language":"en","audioParameters":{"audioFormat":"audio/pcm","samplingRate":24000}}}
{"contextId":"turn-1","text":"Hello from Coda. "}
{"contextId":"turn-1","end":{}}
```

Decode base64 `audio` values as they arrive. Read until `done`, which leaves the socket open. To interrupt, stop playback and send `{"contextId":"turn-1","cancel":{}}`.

Use the [JSON quickstart](/api-reference/coda/websockets-json) for a runnable client and the [Coda WebSocket API reference](/api-reference/coda/websockets) for parameters, events, and binary encoding.

For Mist, use the [model-specific WebSocket reference](/docs/websockets).

## List voices

Both voice endpoints are public; no API key required.

```bash theme={null}
# Voice names, keyed by modelId then ISO 639-2 language code
curl https://users.rime.ai/data/voices/all-v2.json

# Full metadata per voice (gender, age, dialect, language, flagship flag, …)
curl https://users.rime.ai/data/voices/voice_details.json
```

Choosing a voice: [Voices guide](/docs/voices) · Reference: [List All Voices](/api-reference/data/voices-v2) · [List Voice Details](/api-reference/data/voice-details)

## Check vocabulary coverage (`/oov`)

Returns the input words that are **not** in Rime's pronunciation dictionary:

```bash theme={null}
curl -X POST https://users.rime.ai/oov \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"text": "hello kubectl blorbify"}'
# → ["kubectl","blorbify"]
```

Out-of-dictionary words still get a best-effort pronunciation; to control them, see [Custom pronunciation](/docs/custom-pronunciation). Reference: [Vocabulary Coverage](/api-reference/other/oov)

## Normalize text (`/textnorm`)

Preview exactly how numbers, dates, and phone numbers will be spoken. Note the host: `optimize.rime.ai`.

```bash theme={null}
curl -X POST https://optimize.rime.ai/textnorm \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"text": "Call 1-800-444-4141 on 3/4/2026"}'
# → {"normalized":"Call one, eight hundred, four four four, four one four one on march fourth twenty twenty six"}
```

Guide: [Text normalization](/docs/text-normalization) · Reference: [Text Normalization](/api-reference/other/textnorm)

## Common parameters

| Parameter          | Values                                                                                         | Notes                                                                                   |
| ------------------ | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `speaker`          | See [voices](/docs/voices)                                                                     | Required. Must match the model and language.                                            |
| `modelId`          | `coda` (flagship), `mistv3`                                                                    | Set it explicitly. Without one, `/ws3` serves only the Mist v3 voice catalog.           |
| `text`             | string                                                                                         | Up to 1,000 characters per request (HTTP returns `400` "text is too long" beyond that). |
| `lang`             | `en`/`eng`, `es`/`spa`, `fr`/`fra`, `pt`/`por`, `de`/`ger`, `ja`/`jpn`, `ar`/`ara`, `hi`/`hin` | Must match the speaker's language.                                                      |
| `audioFormat` (WS) | `wav`, `mp3`, `ogg`, `webm`, `pcm`, `mulaw`                                                    | HTTP uses the `Accept` header instead.                                                  |
| `segment` (WS)     | `bySentence` (default), `immediate`, `never`                                                   | When synthesis triggers; see [Segmentation](/docs/websockets-segment).                  |
| `samplingRate`     | `8000`–`96000`, default `24000`                                                                | Values above 24000 are upsampling.                                                      |

## Where to go deeper

* [API reference index](/docs/api-reference): every endpoint across every model
* [WebSocket API overview](/docs/websockets): endpoint comparison, timestamps, interruption handling
* [Build a voice agent](/docs/voice-agent-nextjs): complete apps in Next.js, Vite, Express, plain Node, and FastAPI
* [Rime CLI](/docs/quickstart-cli) and the [hosted MCP server](/docs/mcp): tooling around this same API
