deepgram-js-speech-to-text
/deepgram-js-speech-to-text
Obsługuje w JavaScripcie i TypeScripcie Deepgram Speech-to-Text v1 (/v1/listen) do transkrypcji nagranego i bieżącego dźwięku przez REST oraz WebSocket.
- Autor
- deepgram ↗
- Repozytorium
- deepgram-js-sdk ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 27.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 5
Brak sygnałów. Repozytorium zmienione 27.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Obsługuje w JavaScripcie i TypeScripcie Deepgram Speech-to-Text v1 (/v1/listen) do transkrypcji nagranego i bieżącego dźwięku przez REST oraz WebSocket.
Wyzwalacze z opisu
Oryginalny opis (EN)
Use when writing or reviewing JavaScript/TypeScript in this repo that calls Deepgram Speech-to-Text v1 (`/v1/listen`) for prerecorded or live audio transcription. Covers `client.listen.v1.media.transcribeUrl` / `transcribeFile` (REST) plus `client.listen.v1.createConnection()` / `connect()` (WebSocket). Use `deepgram-js-audio-intelligence` for summarize/sentiment/topics/diarize overlays, `deepgram-js-conversational-stt` for Flux turn-taking on `/v2/listen`, and `deepgram-js-voice-agent` for full-duplex assistants. Triggers include "transcribe", "speech to text", "STT", "listen.v1", "nova-3", "
Jak działa
- When to use this product
- Authentication
- Quick start — REST (prerecorded URL)
- Quick start — REST (prerecorded file)
- Quick start — WebSocket (live streaming)
- Key parameters / API surface
- API reference (layered)
- Gotchas
- Example files in this repo
- Central product skills
Podgląd SKILL.md
---
name: deepgram-js-speech-to-text
description: Use when writing or reviewing JavaScript/TypeScript in this repo that calls Deepgram Speech-to-Text v1 (`/v1/listen`) for prerecorded or live audio transcription. Covers `client.listen.v1.media.transcribeUrl` / `transcribeFile` (REST) plus `client.listen.v1.createConnection()` / `connect()` (WebSocket). Use `deepgram-js-audio-intelligence` for summarize/sentiment/topics/diarize overlays, `deepgram-js-conversational-stt` for Flux turn-taking on `/v2/listen`, and `deepgram-js-voice-agent` for full-duplex assistants. Triggers include "transcribe", "speech to text", "STT", "listen.v1", "nova-3", "live transcription", and "websocket transcription".
---
# Using Deepgram Speech-to-Text (JavaScript / TypeScript SDK)
Basic transcription for prerecorded audio (REST) or live audio (WebSocket) via `/v1/listen`.
## When to use this product
- **REST (`client.listen.v1.media.transcribeUrl` / `transcribeFile`)** — one-shot transcription of a finished URL or file. Good for batch jobs, caption generation, offline processing.
- **WebSocket (`client.listen.v1.createConnection()` / `connect()`)** — continuous streaming transcription. Good for live captions, microphone audio, telephony streams, browser or Node realtime apps.
**Use a different skill when:**
- You also want summaries, topics, intents, sentiment, language detection, or redaction guidance on the same `/v1/listen` call → `deepgram-js-audio-intelligence`.
- You need Flux turn-taking and end-of-turn events on `/v2/listen` → `deepgram-js-conversational-stt`.
- You need a full interactive assistant with STT + LLM + TTS over one socket → `deepgram-js-voice-agent`.
## Authentication
```js
require("dotenv").config();
const { DeepgramClient } = require("@deepgram/sdk");
const deepgramClient = new DeepgramClient({
apiKey: process.env.DEEPGRAM_API_KEY,
});
```
Use the exported `DeepgramClient` from `src/CustomClient.ts`, not `DefaultDeepgramClient`. The wrapper adds the required `Token` auth prefix, session headers, and patched WebSocket behavior.
## Quick start — REST (prerecorded URL)
From `examples/04-transcription-prerecorded-url.ts`:
```js
const data = await deepgramClient.listen.v1.media.transcribeUrl({
url: "https://dpgr.am/spacewalk.wav",
model: "nova-3",
language: "en",
punctuate: true,
paragraphs: true,
utterances: true,
});
console.log(
"Transcription:",
data.results?.channels?.[0]?.alternatives?.[0]?.transcript,
);
```
## Quick start — REST (prerecorded file)
From `examples/05-transcription-prerecorded-file.ts`:
```js
const { createReadStream } = require("fs");
const data = await deepgramClient.listen.v1.media.transcribeFile(
createReadStream("./examples/spacewalk.wav"),
{
model: "nova-3",
language: "en",
punctuate: true,
paragraphs: true,
utterances: true,
smart_format: true,
}
);
```
`transcribeFile(...)` accepts multiple upload shapes in this SDK: `fs.ReadStream`, `Buffer`, `ReadableStream`, `Blob`, `File`, `ArrayBuffer`, and `Uint8Array` (see `examples/23-file-upload-types.ts`).
## Quick start — WebSocket (live streaming)
From `examples/07-transcription-live-websocket.ts`:
```js
const deepgramConnection = await deepgramClient.listen.v1.createConnection({
model: "nova-3",
language: "en",
punctuate: "true",
interim_results: "true",
});
deepgramConnection.on("message", (data) => {
if (data.type === "Results") {
console.log("Transcript:", data);
}
});
deepgramConnection.connect();
await deepgramConnection.waitForOpen();
// Swap this for a mic capture (e.g. `node-microphone` / `MediaRecorder`)
// in real apps; the repo examples use `createReadStream` over a sample WAV.
const { createReadStream } = require("node:fs");
const audioStream = createReadStream("samples/spacewalk.wav");
audioStream.on("data", (chunk) => {
deepgramConnection.sendMedia(chunk);
});
audioStream.on("end", () => {
deepgramConnection.sendFinalize({ type: "Finalize" });
});
```
The repo examples use the two-step socket flow: `createConnection()` → register handlers → `connect()` → `waitForOpen()`.
## Key parameters / API surface
- REST: `model`, `language`, `punctuate`, `smart_format`, `paragraphs`, `utterances`, `multichannel`, `numerals`, `search`, `keyterm`, `keywords`, `encoding`, `sample_rate`, `callback`, `tag`.
- WSS connect args (`src/api/resources/listen/resources/v1/client/Client.ts`): `model` is required; common realtime flags include `language`, `interim_results`, `endpointing`, `utterance_end_ms`, `vad_events`, `encoding`, `sample_rate`, `multichannel`, `punctuate`, `smart_format`.
- WSS client messages (`src/api/resources/listen/resources/v1/client/Socket.ts`): `sendMedia(...)`, `sendFinalize(...)`, `sendCloseStream(...)`, `sendKeepAlive(...)`.
- WSS server events: `Results`, `Metadata`, `UtteranceEnd`, `SpeechStarted`.
## API reference (layered)
1. **In-repo reference**: `reference.md` → `Listen V1 Media` for REST; WSS behavior lives in `src/CustomClient.ts` and `src/api/resources/listen/resources/v1/client/{Client,Socket}.ts`.
2. **Canonical OpenAPI (REST)**: https://developers.deepgram.com/openapi.yaml
3. **Canonical AsyncAPI (WSS)**: https://developers.deepgram.com/asyncapi.yaml
4. **Context7**: library ID `/llmstxt/developers_deepgram_llms_txt`
5. **Product docs**:
- https://developers.deepgram.com/reference/speech-to-text/listen-pre-recorded
- https://developers.deepgram.com/reference/speech-to-text/listen-streaming
## Gotchas
1. **Use `DeepgramClient`, not `DefaultDeepgramClient`.** The custom wrapper adds `Token` auth, session IDs, browser WS auth protocols, and patched sockets.
2. **Repo examples are two-stage for WSS.** `createConnection()` does not open the socket; call `connect()` and usually `waitForOpen()`.
3. **Finalize before closing v1 streams.** `sendFinalize({ type: "Finalize" })` flushes the final partial.
4. **Keep idle streams alive.** Use audio or `sendKeepAlive({ type: "KeepAlive" })` on long pauses.
5. **Raw audio metadata must match reality.** If you send PCM, `encoding` and `sample_rate` must match the bytes.
6. **Browser auth differs from Node auth.** In browsers, the wrapper moves auth/session info into WebSocket subprotocols because custom headers are unavailable.
7. **Use `/v2/listen` only for Flux.** If you need turn-aware conversational STT, switch skills instead of forcing v1.
## Example files in this repo
- `examples/04-transcription-prerecorded-url.ts`
- `examples/05-transcription-prerecorded-file.ts`
- `examples/06-transcription-prerecorded-callback.ts`
- `examples/07-transcription-live-websocket.ts`
- `examples/08-transcription-captions.ts`
- `examples/23-file-upload-types.ts`
- `examples/27-deepgram-session-header.ts`
## Central product skills
For cross-language Deepgram product knowledge — the consolidated API reference, documentation finder, focused runnable recipes, third-party integration examples, and MCP setup — install the central skills:
```bash
npx skills add deepgram/skills
```
This SDK ships language-idiomatic code skills; `deepgram/skills` ships cross-language product knowledge (see `api`, `docs`, `recipes`, `examples`, `starters`, `setup-mcp`).
Wersje
W bazie nie ma innych skilli o nazwie deepgram-js-speech-to-text.
Migawka bazy z 28.10.2026 · wersja paczki a84f167aec89 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100deepgram-python-speech-to-text
Obsługuje w Pythonie Deepgram Speech-to-Text v1 (/v1/listen) do transkrypcji nagranego i bieżącego dźwięku przez REST oraz WebSocket. - 100deepgram-java-speech-to-text
Obsługuje w Javie Deepgram Speech-to-Text v1 (/v1/listen) dla transkrypcji nagrań i na żywo, przez REST (transcribeUrl i transcribeFile) oraz WebSocket (v1WebSocket). - 100deepgram-js-audio-intelligence
Obsługuje w JavaScripcie i TypeScripcie nakładki analityczne audio Deepgram na /v1/listen: podsumowania, tematy, intencje, sentyment, diaryzacja, redakcja, wykrywanie języka i encje, przez REST i WebSocket. - 100deepgram-js-conversational-stt
Obsługuje w JavaScripcie i TypeScripcie konwersacyjne STT Deepgram v2 (Flux, /v2/listen) z transkrypcją strumieniową świadomą tur: createConnection, modele Flux i zdarzenia TurnInfo. - 100deepgram-go-speech-to-text
Obsługuje w Go transkrypcję nagrań przez Listen v1 REST oraz strumieniowanie dźwięku na żywo przez Listen v1 WebSocket w SDK Deepgram. - 100deepgram-python-audio-intelligence
Obsługuje w Pythonie nakładki analityczne audio Deepgram na /v1/listen: podsumowania, tematy, intencje, sentyment, diaryzacja, redakcja, wykrywanie języka i encje, przez REST i WebSocket.