Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.gladia.io/llms.txt

Use this file to discover all available pages before exploring further.

When streaming audio to Gladia API, you can stream it either as binary frames or as JSON messages containing a base64-encoded chunk.

Send audio chunks

There are two ways to stream audio:
  1. As binary WebSocket frames:
// `buffer` is a Node.js Buffer / Uint8Array with raw audio bytes
socket.send(buffer);
  1. As JSON, base64-encoding the audio chunk
socket.send(
	JSON.stringify({
		type: "audio_chunk",
		data: {
			chunk: buffer.toString("base64"),
		},
	})
);

Tips

  • Keep chunks reasonably sized (≃ 100ms) for low latency.
  • Make sure your chunks are contiguous audio frames with the same format as configured during session initiation.
  • On recoverable disconnects, reconnect using the same url to continue streaming.