Speech to text API in JavaScript: audio to text in Node.js
Call a speech to text API from JavaScript on your server: send the audio file's URL with the Sume SDK in Node.js, wait for the job, read the text.

For speech to text in JavaScript, choose by where the speech comes from. In a web page, the Web Speech API's SpeechRecognition interface listens to the device's microphone (or an audio track), using a service provided by the user's platform by default. To turn an audio file into text with word timings, call a hosted speech to text API from your server: send the file's URL, wait for the job, then read the transcript. With Sume's TypeScript SDK in Node.js, that is transcribeSttV1 (POST /v1/stt-1.0/transcribe), then waitForJob, then text, words, and segments from the job's result.
The Sume steps come from the TypeScript SDK and Waiting for runs and jobs docs and the STT 1.0 schema in the Sume API reference, read on 2026-09-27. The browser API is described from MDN's Web Speech API page. Installing the SDK, keeping the API key on your server, and the waitForJob pattern work as in Text to speech API in JavaScript; this post covers the transcription side.
How do I transcribe an audio file in Node.js?
Submit the recording's URL, wait for the job, then read the transcript off the job record. The code prints the detected language, the full text, and each sentence's start and end in seconds.
import { createSumeClient, transcribeSttV1, waitForJob } from "@sume-com/sdk";
const client = createSumeClient({ apiKey: process.env.SUME_API_KEY! });
const { data, error } = await transcribeSttV1({
client,
headers: { "idempotency-key": "support-call-0042" },
body: {
audio_url: "https://example.com/audio/support-call.m4a",
segmentation: { mode: "sentence" },
},
});
if (error) throw new Error(JSON.stringify(error));
const job = await waitForJob(data!.data.request_id, { client });
if (job.status !== "completed") throw new Error(`STT job ${job.status}`);
const result = job.result;
console.log(result?.language_code, result?.text);
for (const s of result?.segments ?? []) console.log(s.start, s.end, s.text);Which audio URL and options does the request take?
audio_url is the only required field, and the body has no field for file bytes, so the recording must already be at a public HTTPS address, such as your own storage; the API reference prefers a Sume media URL. Word timings need no option: they always come back.
| Body field | Rule | Effect |
|---|---|---|
audio_url | Required, public HTTPS. In current code a URL with an explicit port, a username or password, or a localhost or private-network address is refused. | The recording to transcribe. |
language_code | Optional, 2–16 characters, such as en or ko. | A hint. Omitted, the language is detected and reported as language_code, when available. |
duration_seconds | Optional integer, 1–600. | Sizes the usage reservation; omitted, Sume reserves for 1 minute. |
segmentation | { mode: "sentence" }, the only mode. | Adds segments, one per sentence. |
Where are the words and sentences in the result?
On job.result. text is the whole transcript. words is an array of { word, start, end } in seconds from the start of the audio; keep entries whose type isn't spacing when you want words only. With segmentation on, segments adds index, text, start, end, and duration_seconds per sentence: gapless time ranges over your file, with no audio cut. Speech-to-text API with word timestamps lists every result field.
Can I stream audio or transcribe the microphone live?
Not with STT 1.0. It transcribes a file at a URL as a job, and the Developer API has no SSE or WebSocket transport today. For live speech in a web page, the Web Speech API above is the browser interface. To keep a recording with word timings, save it at a public HTTPS URL and transcribe that file.
What are the limits, and what does it cost?
STT 1.0 costs $0.01 per audio minute, plus a 5.5% agent fee by default.
- One request covers up to 10 minutes of audio, the documented maximum. For a longer recording, transcribe it in parts and add each part's start time to its timestamps; see Transcribe long audio files.
- No speaker labels.
diarizeis fixed server-side, runs off in current code, and a request that sends it is rejected.
Sources
Related posts
More in Developers
- Speech to text in Python: transcribe audio with timestamps
Speech to text in Python with Requests: send the audio URL, poll the job, then read the transcript and word timestamps. A script for Sume STT 1.0.
- CORS error calling the Sume API from a browser: the fix
Browsers block direct calls from your site to api.sume.com, and API keys must never ship in frontend code. Call Sume from your server and proxy it.
- Sume API endpoints list: routes, scopes, idempotency
An index of the Sume API's public routes by family: which need no key, which scope each needs, where Idempotency-Key applies, and the post on each.
- Sume API error codes by surface: one index with next steps
Sume API error codes indexed by surface: common codes, paid generation, Formats, Scheduled runs, Agent Completions, media tools, and hosted MCP.
Written by Sume