VocalStack LogoVocalStack Logo

Speech translation API for live audio and recordings

Stream audio and get each sentence back transcribed and translated into up to 10 languages, a second or two after it is spoken. A finished recording can be read in any of the 100 languages, up to 10 per transcription.

npm install @vocalstack/js-sdk
import { VocalStack } from '@vocalstack/js-sdk';

const vs = new VocalStack({ apiKey: process.env.VOCALSTACK_API_KEY });

// A file at full speed here. A microphone streams the same way.
const session = await vs.realtime.connect({
  input: { kind: 'file' },
  spokenLanguage: 'en',
  translate: ['es', 'de'],
  sentences: { enabled: true },
});
void session.sendFile('./keynote.mp3');

for await (const ev of session) {
  if (ev.type !== 'transcript.sentence' || ev.sentence.status !== 'closed') continue;
  const { text, translations } = ev.sentence;
  console.log(`${text}\n  es: ${translations?.es}\n  de: ${translations?.de}`);
}
Example output
Welcome, everyone, and thank you for coming.
  es: Bienvenidos a todos y gracias por venir.
  de: Willkommen und danke, dass Sie gekommen sind.
Let's start with what changed this year.
  es: Empecemos por lo que cambió este año.
  de: Beginnen wir mit dem, was sich dieses Jahr geändert hat.

What the translation API does

Translation is included in the per-second price. Ask for languages with translate on a live session, or read any transcript with lang.

  • Translated while it is spoken

    Each line is followed by its translations, usually a second or two later. Change the languages mid-stream with session.update and the change applies to what follows.

  • Whole sentences

    With sentences on, the server joins lines into sentences and translates each one whole. Its translations can still change while the sentence is open and are final once it closes.

  • Up to 10 languages at once

    A transcription carries up to 10 languages besides the one spoken, chosen from 100. Leave the spoken language out and the API detects it.

  • Each listener picks a language

    Share a transcription and each listener asks for their own language with lang=es. Listening is free, however many people follow.

  • Spoken translations

    Add voice and each translated sentence also arrives as a short audio clip. A speaker is read in a stock voice, or in their own cloned voice when they agreed to it.

  • Recordings and exports

    Read a finished transcript in another language with lang=de, or export it translated as SRT, VTT, PDF, XLSX, TXT, Markdown or JSON.

Endpoints and frames

Live translation runs over one WebSocket. Recordings are read in another language over REST.

  • POST/v1/realtime/sessionsOpen a realtime session with translate and sentences, and get the WebSocket address to stream audio to.
  • WStranscript.sentenceOne sentence and its translations, keyed by sentenceId: provisional while open, final once closed.
  • WStranscript.voiceA translated sentence read aloud as an Ogg/Opus clip, when voice asks for that language.
  • GET/v1/languagesThe languages that can be transcribed, translated into and spoken.
  • GET/v1/transcriptions/{id}/transcriptAdd lang=es to read a finished transcript in Spanish.
  • GET/v1/transcriptions/{id}/exportDownload it translated: lang=es with format=srt, vtt, pdf, xlsx, txt, md or json.
Every endpoint

Billed per second of audio

Translation and spoken translations cost nothing extra. You pay for the audio transcribed, by the second, and listeners are free.

Files and links$0.20 an hour$0.0033 a minute
Live and realtime$0.60 an hour$0.01 a minute
  • Pay as you go bills at least 5 minutes for each transcription.
  • Premium and Enterprise bill every second with no minimum.
  • New accounts get $5 of credit to try it.
See plans and pricingTranscribing thousands of hours a month? Enterprise has volume rates. Talk to sales

Frequently Asked Questions

Guides and related pages

The API reference has complete programs for every SDK and for plain HTTP.

Open the API reference