Speech to text realtime

sarvam-saaras-live

Live Saaras. $0.005 / min. PCM16, μ-law, or A-law at 8000 or 16000 Hz.

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: wss://api.pascalai.co/v1/speech-to-text/realtime?model=sarvam-saaras-live. Live price and availability are on GET /v1/models/sarvam-saaras-live.

  • Send session.update, then binary audio, then session.close. session.sample_rate is 8000 or 16000. encoding is linear16, mulaw, or alaw. Omit either and the audio is 16000 Hz PCM16. If the bytes are a different rate, the transcript can come out degraded.
  • Diarization is not available on this socket.

Parameters

FieldTypeDescription
session.language
Default unknown
stringSame codes as the file model: en, hi, bn, gu, kn, ml, mr, pa, ta, te, or the -IN form. Odia is od or or. Both are the same. unknown detects. language_code is the same field.
session.mode
Default transcribe
stringApplied to the final transcript. Partials stay a straight transcription.
session.sample_rate
Default 16000
integer8000 or 16000. 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=sarvam-saaras-live&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' }));