Speech to text realtime

deepgram-nova-3-streaming

Live Nova-3. $0.0048 per minute for one language, $0.0058 per minute when language is multi. Diarization adds $0.0020 per minute.

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: PCM16 mono, which Deepgram calls linear16, or μ-law or A-law. Default 16000 Hz linear16.. Live price and availability are on GET /v1/models/deepgram-nova-3-streaming.

  • Open wss://api.pascalai.co/v1/speech-to-text/realtime?model=deepgram-nova-3-streaming.
  • Send session.update, then binary PCM16 mono at session.sample_rate. Omit sample_rate and the rate is 16000. If the bytes are a different rate, the transcript can come out degraded. session.close ends the audio.
  • Deepgram field names inside session are accepted. diarize and speaker_diarization are the same switch.
  • Audio is billed by the PCM duration at the Pay As You Go rate, including a partial minute at the end.
  • Keyterm prompting adds $0.0013 per minute. Redaction adds $0.0020. Entity detection adds $0.0017.

Parameters

FieldTypeDescription
session.languagestringBCP-47 tag, or multi.
session.diarizebooleanSpeaker labels. speaker_diarization is the same switch. Adds $0.0020 per minute.
session.interim_resultsbooleanPartial results. Deepgram’s Results events are forwarded.
session.endpointinginteger or falseMilliseconds of silence, or false.
session.keytermstring or arrayKeyterm prompting. custom_terms is the same list.
session.sample_rate
Default 16000
integer8000, 16000, 24000, 44100, or 48000. Omit it and the rate is 16000 Hz. The bytes have to already be that rate. A live frame has no header, so a mismatch is still accepted and the transcript can come out degraded.
session.encoding
Default linear16
stringlinear16, mulaw, or alaw. Omit it for linear16.

Example

const socket = new WebSocket(
  'wss://api.pascalai.co/v1/speech-to-text/realtime?model=deepgram-nova-3-streaming&api_key=' + key
);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
  socket.send(JSON.stringify({
    type: 'session.update',
    session: {
      language: 'auto',
      endpointing: 'manual',
    },
  }));
};
// binary Int16 PCM16 mono frames at session.sample_rate (default 16000)
// when endpointing is manual:
socket.send(JSON.stringify({ type: 'session.commit' }));
socket.send(JSON.stringify({ type: 'session.close' }));