Text to speech realtime

deepgram-aura-2-live

Live Aura-2. $30 per million characters. Same voices as the file model.

The call is Pascal’s. Send Authorization: Bearer with a Pascal key, and Pascal’s body: model, the file or the text, and params. Inside params, a Pascal name and the provider’s own name are both accepted. If both are sent and they disagree, the request is rejected. The provider’s SDK and host are not this API. The API request fee is not charged. A studio call needs a Creator plan or an API balance.

Native stream: Linear16 at 24 kHz unless sample_rate is set.. Live price and availability are on GET /v1/models/deepgram-aura-2-live.

  • Open wss://api.pascalai.co/v1/text-to-speech/realtime?model=deepgram-aura-2-live.
  • Send {"type":"speak","text":"…"}. Speak, Flush, Clear, and Close are also accepted.
  • Audio comes back as linear16. The charge is the character count.

Parameters

FieldTypeDescription
session.model
Default aura-2-thalia-en
stringAura-2 voice id. voice is the same field.
session.speednumberSpeaking rate.

Example

const socket = new WebSocket(
  'wss://api.pascalai.co/v1/text-to-speech/realtime?model=deepgram-aura-2-live&api_key=' + key
);
socket.binaryType = 'arraybuffer';
socket.onmessage = (event) => {
  if (typeof event.data !== 'string') return;
  const payload = JSON.parse(event.data);
  if (payload.type === 'session.created') {
    socket.send(JSON.stringify({ type: 'session.update', session: { speed: 1 } }));
    socket.send(JSON.stringify({
    type: 'speak',
    text: 'Keep walking toward the river.',
  }));
  }
};
// binary Int16 PCM16 frames, then response.done