> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rime.ai/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`    |
| WebSocket API                                                 | `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>
  * Send TTS requests to `users.rime.ai`, not `api.rime.ai`. The latter serves internal infrastructure and returns `404` for TTS requests.
  * 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.
  * Rime does not publish an npm or PyPI SDK. Similarly named registry packages are unrelated third-party projects.
</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 speech (WebSocket `/ws3`)

Synthesis arguments go in the query string; auth goes in the connection header. Send `{"text": ...}` messages (buffered by sentence by default) and operations (`{"operation": "flush" | "clear" | "eos"}`); receive JSON events: `chunk` (base64 audio), `timestamps` (word-level), `done`, `error`.

```python theme={null}
import asyncio, base64, json, os
import websockets  # pip install websockets

async def main():
    url = "wss://users-ws.rime.ai/ws3?speaker=astra&modelId=coda&audioFormat=mp3"
    headers = {"Authorization": f"Bearer {os.environ['RIME_API_KEY']}"}
    async with websockets.connect(url, additional_headers=headers) as ws:
        await ws.send(json.dumps({"text": "Hello from Rime over WebSockets."}))
        await ws.send(json.dumps({"operation": "eos"}))  # synthesize what's buffered, then close
        audio = b""
        async for raw in ws:
            event = json.loads(raw)
            if event["type"] == "chunk":
                audio += base64.b64decode(event["data"])
            elif event["type"] == "timestamps":
                print("words:", event["word_timestamps"]["words"])
            elif event["type"] == "done":
                break
    with open("output.mp3", "wb") as f:
        f.write(audio)
    print(f"saved {len(audio)} bytes to output.mp3")

asyncio.run(main())
```

Set `modelId` explicitly on `/ws3`. Without it, requests are served by the **Mist v3** backend, and speakers outside the Mist v3 catalog fail with a "Speaker not found" error. Message schemas: [Coda WebSocket reference](/api-reference/coda/websockets-json) · Buffering control: [Segmentation](/docs/websockets-segment) · Web-app bridge pattern: [Next.js voice-agent guide](/docs/voice-agent-nextjs#3-stream-over-websockets-when-latency-matters)

## 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) | `mp3`, `mulaw`, `pcm`                                                                          | 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
