> This page is for Models.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.hams.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.hams.ai/_mcp/server.

# Overview

> HAMS's real-time speech models, the two WebSocket endpoints that expose them, and what a client needs to use them.

HAMS runs two speech models built for Arabic, including speech that switches between Arabic and
English mid-sentence. Both are exposed as streaming WebSocket APIs so that audio and text flow in
real time, with one persistent connection per stream.

| Model          | Endpoint                     | Direction                                                                    |
| -------------- | ---------------------------- | ---------------------------------------------------------------------------- |
| Speech-to-text | `wss://voice.hams.ai/asr/ws` | You send 16 kHz PCM audio, you receive interim and final transcripts as JSON |
| Text-to-speech | `wss://tts.hams.ai/ws`       | You send text as JSON, you receive 24 kHz PCM audio as it is synthesized     |

#### [Authentication and limits](/models/authentication)

The bearer API key on the WebSocket upgrade, the connection limit, the status codes and how to
reconnect.

#### [Speech-to-text](/models/speech-to-text)

Audio format, frame sizes, server-side voice activity detection, interim and final results.

#### [Text-to-speech](/models/text-to-speech)

Prompts, voices, the audio frame sequence, inter-sentence silence, cancelling for barge-in.

## What a client needs

Any server-side WebSocket client works. It must be able to:

1. Set a custom `Authorization` header on the WebSocket handshake.
2. Send and receive binary messages, which carry the PCM audio.
3. Send and receive text messages, which carry JSON configuration, prompts, metadata and results.
4. Keep one socket open for the whole session or stream, rather than reconnecting per message.

> **Warning**
>
> The API key must stay on a trusted server. Do not put it in browser code, mobile applications,
> URLs or client-side logs. If your framework cannot attach headers to a WebSocket connection,
> connect from a server-side service that can.

## Audio in and out

Both APIs work with raw, headerless PCM: signed 16-bit little-endian samples, mono. Speech-to-text
expects 16,000 Hz; text-to-speech returns 24,000 Hz. Decode and resample other formats before
sending, and write the received bytes straight to a PCM sink or wrap them in a container yourself.