Skip to main content 홈 크리에이터 jeremylongshore tons-of-skills-marketplace deepgram-core-workflow-b
deepgram-core-workflow-b Implement real-time streaming transcription with Deepgram WebSocket.
Use when building live transcription, voice interfaces,
real-time captioning, or voice AI applications.
Trigger: "deepgram streaming", "real-time transcription", "live transcription",
"websocket transcription", "voice streaming", "deepgram live".
설치로 이동 Skills Marketplace 커뮤니티가 만든 AI 스킬을 발견하고 탐색하세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace --skill deepgram-core-workflow-b명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Zip 다운로드 다운로드 중... 이 저장소의 다른 Skills langchain-deploy-integration Deploy a LangChain 1.0 / LangGraph 1.0 app to Cloud Run, Vercel, or LangServe correctly — with timeouts sized for chain length, cold-start mitigation, SSE anti-buffering headers, and Secret Manager over .env. Use when prepping a first production deploy, debugging a stream that hangs behind a proxy, or diagnosing p99 latency spikes. Trigger with "langchain deploy", "langchain cloud run", "langchain vercel python", "langchain langserve", or "langchain docker".
langchain-langgraph-agents Build a correct LangGraph 1.0 ReAct agent with create_react_agent — typed tools, error propagation, recursion caps, and stop conditions that actually stop. Use when writing a first tool-calling agent, migrating from AgentExecutor or initialize_agent, or diagnosing an agent that loops on vague prompts. Trigger with "langgraph agent", "create_react_agent", "langgraph tool calling", "AgentExecutor migration", or "agent loop cost".
langchain-langgraph-human-in-loop Build LangGraph 1.0 human-in-the-loop approval flows with interrupt_before /
interrupt_after and Command(resume=...) — JSON-serializable state, clean
resume semantics, and UI wiring for approval decisions. Use when adding an
approval gate before an expensive tool call, wiring a Slack/web UI for agent
approvals, or debugging a graph that crashes on interrupt.
Trigger with "langgraph human in loop", "langgraph interrupt_before",
"langgraph approval flow", "Command resume", "langgraph HITL".
jeremylongshore
jeremylongshore/tons-of-skills-marketplace
GitHub 저장소 열기 name deepgram-core-workflow-b description Implement real-time streaming transcription with Deepgram WebSocket.
Use when building live transcription, voice interfaces,
real-time captioning, or voice AI applications.
Trigger: "deepgram streaming", "real-time transcription", "live transcription",
"websocket transcription", "voice streaming", "deepgram live".
allowed-tools Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep version 1.13.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","deepgram","voice-ai","transcription","streaming","websocket"] compatibility Designed for Claude Code
Deepgram Core Workflow B: Live Streaming Transcription
Overview
Real-time streaming transcription using Deepgram's WebSocket API. The SDK manages the WebSocket connection via listen.live(). Covers microphone capture, interim/final result handling, speaker diarization, UtteranceEnd detection, auto-reconnect, and building an SSE endpoint for browser clients.
Prerequisites
@deepgram/sdk installed, DEEPGRAM_API_KEY configured
Audio source: microphone (via Sox/rec), file stream, or WebSocket audio from browser
For mic capture: sox installed (apt install sox / brew install sox)
Instructions
Step 1: Basic Live Transcription
import { createClient, LiveTranscriptionEvents } from '@deepgram/sdk' ;
const deepgram = createClient (process.env .DEEPGRAM_API_KEY !);
const connection = deepgram.listen .live ({
model : 'nova-3' ,
language : 'en' ,
smart_format : true ,
punctuate : true ,
interim_results : true ,
utterance_end_ms : 1000 ,
vad_events : true ,
encoding : 'linear16' ,
sample_rate : 16000 ,
: ,
});
connection. ( . , {
. ( );
});
connection. ( . , {
. ( );
});
connection. ( . , {
. ( , err);
});
connection. ( . , {
transcript = data. . [ ]?. ;
(!transcript) ;
(data. ) {
. ( );
} {
process. . ( );
}
});
connection. ( . , {
. ( );
});
channels
1
on
LiveTranscriptionEvents
Open
() =>
console
log
'WebSocket connected to Deepgram'
on
LiveTranscriptionEvents
Close
() =>
console
log
'WebSocket closed'
on
LiveTranscriptionEvents
Error
(err ) =>
console
error
'Deepgram error:'
on
LiveTranscriptionEvents
Transcript
(data ) =>
const
channel
alternatives
0
transcript
if
return
if
is_final
console
log
`[FINAL] ${transcript} `
else
stdout
write
`\r[interim] ${transcript} `
on
LiveTranscriptionEvents
UtteranceEnd
() =>
console
log
'\n--- utterance end ---'
Step 2: Microphone Capture with Sox import { spawn } from 'child_process' ;
function startMicrophone (connection : any ) {
const mic = spawn ('rec' , [
'-q' ,
'-r' , '16000' ,
'-e' , 'signed' ,
'-b' , '16' ,
'-c' , '1' ,
'-t' , 'raw' ,
'-' ,
]);
mic.stdout .on ('data' , (chunk : Buffer ) => {
if (connection.getReadyState () === 1 ) {
connection.send (chunk);
}
});
mic.on ('error' , (err ) => {
console .error ('Microphone error:' , err.message );
console .log ('Install sox: apt install sox / brew install sox' );
});
return mic;
}
const mic = startMicrophone (connection);
process.on ('SIGINT' , () => {
mic.kill ();
connection.finish ();
setTimeout (() => process.exit (0 ), 2000 );
});
Step 3: Live Diarization const connection = deepgram.listen .live ({
model : 'nova-3' ,
smart_format : true ,
diarize : true ,
interim_results : false ,
utterance_end_ms : 1500 ,
encoding : 'linear16' ,
sample_rate : 16000 ,
channels : 1 ,
});
connection.on (LiveTranscriptionEvents .Transcript , (data ) => {
if (!data.is_final ) return ;
const words = data.channel .alternatives [0 ]?.words ?? [];
if (words.length === 0 ) return ;
let currentSpeaker = words[0 ].speaker ;
let segment = '' ;
for (const word of words) {
if (word.speaker !== currentSpeaker) {
console .log (`Speaker ${currentSpeaker} : ${segment.trim()} ` );
currentSpeaker = word.speaker ;
segment = '' ;
}
segment += ` ${word.punctuated_word ?? word.word} ` ;
}
console .log (`Speaker ${currentSpeaker} : ${segment.trim()} ` );
});
Step 4: Auto-Reconnect with Backoff class ReconnectingLiveTranscription {
private client : ReturnType <typeof createClient>;
private connection : any = null ;
private reconnectAttempts = 0 ;
private maxReconnectAttempts = 10 ;
private baseDelay = 1000 ;
constructor (apiKey : string , private options : Record <string , any > ) {
this .client = createClient (apiKey);
}
connect ( ) {
this .connection = this .client .listen .live (this .options );
this .connection .on (LiveTranscriptionEvents .Open , () => {
console .log ('Connected' );
this .reconnectAttempts = 0 ;
});
this .connection .on (LiveTranscriptionEvents .Close , () => {
this .scheduleReconnect ();
});
this .connection .on (LiveTranscriptionEvents .Error , (err : Error ) => {
console .error ('Connection error:' , err.message );
this .scheduleReconnect ();
});
return this .connection ;
}
private scheduleReconnect ( ) {
if (this .reconnectAttempts >= this .maxReconnectAttempts ) {
console .error ('Max reconnection attempts reached' );
return ;
}
const delay = this .baseDelay * Math .pow (2 , this .reconnectAttempts )
+ Math .random () * 1000 ;
this .reconnectAttempts ++;
console .log (`Reconnecting in ${Math .round(delay)} ms (attempt ${this .reconnectAttempts} )` );
setTimeout (() => this .connect (), delay);
}
send (chunk : Buffer ) {
if (this .connection ?.getReadyState () === 1 ) {
this .connection .send (chunk);
}
}
close ( ) {
this .maxReconnectAttempts = 0 ;
this .connection ?.finish ();
}
}
Step 5: SSE Endpoint for Browser Clients import express from 'express' ;
import { createClient, LiveTranscriptionEvents } from '@deepgram/sdk' ;
const app = express ();
app.get ('/api/transcribe/stream' , (req, res ) => {
res.setHeader ('Content-Type' , 'text/event-stream' );
res.setHeader ('Cache-Control' , 'no-cache' );
res.setHeader ('Connection' , 'keep-alive' );
const deepgram = createClient (process.env .DEEPGRAM_API_KEY !);
const connection = deepgram.listen .live ({
model : 'nova-3' ,
smart_format : true ,
interim_results : true ,
encoding : 'linear16' ,
sample_rate : 16000 ,
channels : 1 ,
});
connection.on (LiveTranscriptionEvents .Transcript , (data ) => {
const transcript = data.channel .alternatives [0 ]?.transcript ;
if (transcript) {
res.write (`data: ${JSON .stringify({
transcript,
is_final: data.is_final,
speech_final: data.speech_final,
})} \n\n` );
}
});
req.on ('close' , () => {
connection.finish ();
});
});
Step 6: KeepAlive for Long Sessions
connection.on (LiveTranscriptionEvents .Open , () => {
const keepAliveInterval = setInterval (() => {
if (connection.getReadyState () === 1 ) {
connection.keepAlive ();
}
}, 8000 );
connection.on (LiveTranscriptionEvents .Close , () => {
clearInterval (keepAliveInterval);
});
});
Output
Live WebSocket transcription with interim/final results
Microphone capture pipeline (Sox -> Deepgram)
Speaker diarization in streaming mode
Auto-reconnect with exponential backoff and jitter
SSE endpoint for browser integration
KeepAlive handling for long sessions
Error Handling Issue Cause Solution WebSocket closes immediately Invalid API key or bad encoding params Check key, verify encoding/sample_rate match audio No transcripts received Audio not being sent or wrong format Verify connection.send(chunk) is called with raw PCM High latency Network congestion Use interim_results: true for perceived speed rec command not foundSox not installed apt install sox or brew install soxConnection drops after 10s No audio + no KeepAlive Send connection.keepAlive() every 8s Garbled output Sample rate mismatch Ensure audio sample rate matches sample_rate option
Resources
Next Steps Proceed to deepgram-data-handling for transcript processing and storage patterns.