Skip to main content
Hamsa provides two options for real-time speech-to-text:
  • Realtime API (POST /v1/realtime/stt) — Send base64-encoded audio and receive the transcription directly in the response. Best for short audio clips.
  • WebSocket (wss://api.tryhamsa.com/v1/realtime/ws) — Persistent bidirectional connection for streaming audio. Best for live conversations and continuous transcription.

Realtime API

The Realtime API accepts base64-encoded audio and returns the transcription synchronously. See the Quickstart for usage examples.

Parameters

WebSocket Streaming

The WebSocket API provides a persistent connection for streaming audio in real time. Send audio chunks as you record and receive transcription results as they become available.

Endpoint

Authentication

Authenticate via query parameter or header:

Request Format

Send a JSON message with type: "stt":

Response

The server sends the transcribed text directly as a plain string (not JSON). For full WebSocket documentation including connection handling, error codes, and code examples, see the WebSocket API reference.