Endpoint

wss://geoff.ai/api/v1/t2a/ws

Authentication

Pass your API key as a query parameter or in the initial message:
wss://geoff.ai/api/v1/t2a/ws?token=YOUR_API_KEY

Connection Flow

  1. Open WebSocket connection
  2. Send text chunks as JSON messages
  3. Receive audio chunks in real-time
  4. Close connection when done

Message Format

Send (Text)

{
  "text": "Hello, this is a streaming example.",
  "voice_id": "default",
  "format": "mp3"
}

Receive (Audio)

Binary audio data is streamed back as WebSocket binary frames.

Example

const ws = new WebSocket("wss://geoff.ai/api/v1/t2a/ws?token=YOUR_API_KEY");

ws.onopen = () => {
  ws.send(JSON.stringify({
    text: "Hello, this is streaming speech synthesis.",
    voice_id: "default",
    format: "mp3",
  }));
};

const audioChunks = [];
ws.onmessage = (event) => {
  if (event.data instanceof Blob) {
    audioChunks.push(event.data);
  }
};

ws.onclose = () => {
  const audioBlob = new Blob(audioChunks, { type: "audio/mp3" });
  const url = URL.createObjectURL(audioBlob);
  // Play or download the audio
};