Deepgram Production Checklist
Overview
Comprehensive go-live checklist for Deepgram integrations. Covers singleton client, health checks, Prometheus metrics, alert rules, error handling, and a phased go-live timeline.
Production Readiness Matrix
| Category |
Item |
Status |
| Auth |
Production API key with scoped permissions |
[ ] |
| Auth |
Key stored in secret manager (not env file) |
[ ] |
| Auth |
Key rotation schedule (90-day) configured |
[ ] |
| Auth |
Fallback key provisioned and tested |
[ ] |
| Resilience |
Retry with exponential backoff on 429/5xx |
[ ] |
| Resilience |
Circuit breaker for cascade failure prevention |
[ ] |
| Resilience |
Request timeout set (30s pre-recorded, 10s TTS) |
[ ] |
| Resilience |
Graceful degradation when API unavailable |
[ ] |
| Performance |
Singleton client (not creating per-request) |
[ ] |
| Performance |
Concurrency limited (50-80% of plan limit) |
[ ] |
| Performance |
Audio preprocessed (16kHz mono for best results) |
[ ] |
| Performance |
Large files use callback URL (async) |
[ ] |
| Monitoring |
Health check endpoint testing Deepgram API |
[ ] |
| Monitoring |
Prometheus metrics: latency, error rate, usage |
[ ] |
| Monitoring |
Alerts: error rate >5%, latency >10s, circuit open |
[ ] |
| Security |
PII redaction enabled if handling sensitive audio |
[ ] |
| Security |
Audio URLs validated (HTTPS, no private IPs) |
[ ] |
| Security |
Audit logging on all operations |
[ ] |
Instructions
Step 1: Production Singleton Client
import { createClient, DeepgramClient } from '@deepgram/sdk';
class ProductionDeepgram {
private static client: DeepgramClient | null = null;
static getClient(): DeepgramClient {
if (!this.client) {
const key = process.env.DEEPGRAM_API_KEY;
if (!key) throw new Error('DEEPGRAM_API_KEY required for production');
this.client = createClient(key);
}
return this.client;
}
// Force re-init (for key rotation)
static reset() { this.client = null; }
}
Step 2: Health Check Endpoint
import express from 'express';
import { createClient } from '@deepgram/sdk';
const app = express();
const deepgram = createClient(process.env.DEEPGRAM_API_KEY!);
app.get('/health', async (req, res) => {
const start = Date.now();
try {
// Test API connectivity by listing projects
const { error } = await deepgram.manage.getProjects();
const latency = Date.now() - start;
if (error) {
return res.status(503).json({
status: 'unhealthy',
deepgram: 'error',
error: error.message,
latency_ms: latency,
});
}
res.json({
status: 'healthy',
deepgram: 'connected',
latency_ms: latency,
timestamp: new Date().toISOString(),
});
} catch (err: any) {
res.status(503).json({
status: 'unhealthy',
deepgram: 'unreachable',
error: err.message,
latency_ms: Date.now() - start,
});
}
});
Step 3: Prometheus Metrics
import { Counter, Histogram, Gauge, Registry } from 'prom-client';
const registry = new Registry();
const transcriptionRequests = new Counter({
name: 'deepgram_requests_total',
help: 'Total Deepgram API requests',
labelNames: ['method', 'model', 'status'],
registers: [registry],
});
const transcriptionLatency = new Histogram({
name: 'deepgram_latency_seconds',
help: 'Deepgram API request latency',
labelNames: ['method', 'model'],
buckets: [0.5, 1, 2, 5, 10, 30],
registers: [registry],
});
const audioProcessed = new Counter({
name: 'deepgram_audio_seconds_total',
help: 'Total audio seconds processed',
labelNames: ['model'],
registers: [registry],
});
const activeConnections = new Gauge({
name: 'deepgram_active_connections',
help: 'Active WebSocket connections',
registers: [registry],
});
// Instrumented transcription
async function instrumentedTranscribe(url: string, model = 'nova-3') {
const timer = transcriptionLatency.startTimer({ method: 'prerecorded', model });
try {
const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
{ url }, { model, smart_format: true }
);
timer();
transcriptionRequests.inc({ method: 'prerecorded', model, status: error ? 'error' : 'ok' });
if (result?.metadata?.duration) {
audioProcessed.inc({ model }, result.metadata.duration);
}
if (error) throw error;
return result;
} catch (err) {
timer();
transcriptionRequests.inc({ method: 'prerecorded', model, status: 'error' });
throw err;
}
}
// Expose metrics endpoint
app.get('/metrics', async (req, res) => {
res.set('Content-Type', registry.contentType);
res.send(await registry.metrics());
});
Step 4: Alert Rules (Prometheus/AlertManager)
groups:
- name: deepgram
rules:
- alert: DeepgramHighErrorRate
expr: rate(deepgram_requests_total{status="error"}[5m]) / rate(deepgram_requests_total[5m]) > 0.05
for: 5m
labels:
severity: critical
annotations:
summary: "Deepgram error rate > 5%"
- alert: DeepgramHighLatency
expr: histogram_quantile(0.95, rate(deepgram_latency_seconds_bucket[5m])) > 10
for: 5m
labels:
severity: warning
annotations:
summary: "Deepgram P95 latency > 10s"
- alert: DeepgramHealthCheckFailed
expr: up{job="deepgram-service"} == 0
for: 2m
labels:
severity: critical
annotations:
summary: "Deepgram health check failed for 2+ minutes"
Step 5: Error Handling Wrapper
async function safeTranscribe(url: string, options: Record<string, any> = {}) {
const timeout = options.timeout ?? 30000;
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), timeout);
try {
const result = await Promise.race([
instrumentedTranscribe(url, options.model ?? 'nova-3'),
new Promise((_, reject) =>
setTimeout(() => reject(new Error('Transcription timeout')), timeout)
),
]);
clearTimeout(timeoutId);
return result;
} catch (err: any) {
clearTimeout(timeoutId);
// Log structured error
console.error(JSON.stringify({
level: 'error',
service: 'deepgram',
message: err.message,
url: url.substring(0, 100),
timestamp: new Date().toISOString(),
}));
throw err;
}
}
Step 6: Go-Live Timeline
| Phase |
When |
Actions |
| D-7 |
1 week before |
Load test at 2x expected volume, security review |
| D-3 |
3 days before |
Smoke test with production key, verify all alerts fire |
| D-1 |
Day before |
Confirm on-call rotation, validate dashboards |
| D-0 |
Launch |
Shadow mode (10% traffic), monitoring open |
| D+1 |
Day after |
Review error rate, latency, verify no anomalies |
| D+7 |
1 week after |
Full traffic, tune alert thresholds based on baselines |
Output
- Singleton client with reset capability
- Health check endpoint with latency reporting
- Prometheus metrics (requests, latency, audio, connections)
- AlertManager rules for error rate, latency, availability
- Timeout-safe transcription wrapper
- Phased go-live timeline
Error Handling
| Issue |
Cause |
Solution |
| Health check 503 |
API key expired |
Rotate key, check secret manager |
| Metrics not scraped |
Wrong port/path |
Verify Prometheus target config |
| Alert storms |
Thresholds too tight |
Add for: duration, tune values |
| Timeout on large files |
Sync mode too slow |
Switch to callback URL pattern |
Resources
Source: jeremylongshore/claude-code-plugins-plus-skills → skills/.curated/deepgram-prod-checklist/SKILL.md
Also appears in: jeremylongshore/claude-code-plugins-plus-skills/plugins/saas-packs/deepgram-pack/skills/deepgram-prod-checklist/SKILL.md
1---
2name: deepgram-prod-checklist
3description: "'Execute Deepgram production deployment checklist. Use when preparing for production launch, auditing production readiness, or verifying deployment configurations. Trigger: \"deepgram production\", \"deploy deepgram\", \"deepgram prod checklist\", \"deepgram go-live\", \"production ready deepgram\". '"
4allowed-tools: "Read, Write, Edit, Grep, Bash(curl:*)"
5category: productivity-and-workflow
6source_repo: jeremylongshore/claude-code-plugins-plus-skills
7source_path: "skills/.curated/deepgram-prod-checklist/SKILL.md"
8source_url: https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/HEAD/skills/.curated/deepgram-prod-checklist/SKILL.md
9metadata:
10 source: https://skillmd.com/skills/thedixitjain/deepgram-prod-checklist
11---
12
13# Deepgram Production Checklist
14
15## Overview
16
17Comprehensive go-live checklist for Deepgram integrations. Covers singleton client, health checks, Prometheus metrics, alert rules, error handling, and a phased go-live timeline.
18
19## Production Readiness Matrix
20
21| Category | Item | Status |
22|----------|------|--------|
23| **Auth** | Production API key with scoped permissions | [ ] |
24| **Auth** | Key stored in secret manager (not env file) | [ ] |
25| **Auth** | Key rotation schedule (90-day) configured | [ ] |
26| **Auth** | Fallback key provisioned and tested | [ ] |
27| **Resilience** | Retry with exponential backoff on 429/5xx | [ ] |
28| **Resilience** | Circuit breaker for cascade failure prevention | [ ] |
29| **Resilience** | Request timeout set (30s pre-recorded, 10s TTS) | [ ] |
30| **Resilience** | Graceful degradation when API unavailable | [ ] |
31| **Performance** | Singleton client (not creating per-request) | [ ] |
32| **Performance** | Concurrency limited (50-80% of plan limit) | [ ] |
33| **Performance** | Audio preprocessed (16kHz mono for best results) | [ ] |
34| **Performance** | Large files use callback URL (async) | [ ] |
35| **Monitoring** | Health check endpoint testing Deepgram API | [ ] |
36| **Monitoring** | Prometheus metrics: latency, error rate, usage | [ ] |
37| **Monitoring** | Alerts: error rate >5%, latency >10s, circuit open | [ ] |
38| **Security** | PII redaction enabled if handling sensitive audio | [ ] |
39| **Security** | Audio URLs validated (HTTPS, no private IPs) | [ ] |
40| **Security** | Audit logging on all operations | [ ] |
41
42## Instructions
43
44### Step 1: Production Singleton Client
45
46```typescript
47import { createClient, DeepgramClient } from '@deepgram/sdk';
48
49class ProductionDeepgram {
50 private static client: DeepgramClient | null = null;
51
52 static getClient(): DeepgramClient {
53 if (!this.client) {
54 const key = process.env.DEEPGRAM_API_KEY;
55 if (!key) throw new Error('DEEPGRAM_API_KEY required for production');
56 this.client = createClient(key);
57 }
58 return this.client;
59 }
60
61 // Force re-init (for key rotation)
62 static reset() { this.client = null; }
63}
64```
65
66### Step 2: Health Check Endpoint
67
68```typescript
69import express from 'express';
70import { createClient } from '@deepgram/sdk';
71
72const app = express();
73const deepgram = createClient(process.env.DEEPGRAM_API_KEY!);
74
75app.get('/health', async (req, res) => {
76 const start = Date.now();
77 try {
78 // Test API connectivity by listing projects
79 const { error } = await deepgram.manage.getProjects();
80 const latency = Date.now() - start;
81
82 if (error) {
83 return res.status(503).json({
84 status: 'unhealthy',
85 deepgram: 'error',
86 error: error.message,
87 latency_ms: latency,
88 });
89 }
90
91 res.json({
92 status: 'healthy',
93 deepgram: 'connected',
94 latency_ms: latency,
95 timestamp: new Date().toISOString(),
96 });
97 } catch (err: any) {
98 res.status(503).json({
99 status: 'unhealthy',
100 deepgram: 'unreachable',
101 error: err.message,
102 latency_ms: Date.now() - start,
103 });
104 }
105});
106```
107
108### Step 3: Prometheus Metrics
109
110```typescript
111import { Counter, Histogram, Gauge, Registry } from 'prom-client';
112
113const registry = new Registry();
114
115const transcriptionRequests = new Counter({
116 name: 'deepgram_requests_total',
117 help: 'Total Deepgram API requests',
118 labelNames: ['method', 'model', 'status'],
119 registers: [registry],
120});
121
122const transcriptionLatency = new Histogram({
123 name: 'deepgram_latency_seconds',
124 help: 'Deepgram API request latency',
125 labelNames: ['method', 'model'],
126 buckets: [0.5, 1, 2, 5, 10, 30],
127 registers: [registry],
128});
129
130const audioProcessed = new Counter({
131 name: 'deepgram_audio_seconds_total',
132 help: 'Total audio seconds processed',
133 labelNames: ['model'],
134 registers: [registry],
135});
136
137const activeConnections = new Gauge({
138 name: 'deepgram_active_connections',
139 help: 'Active WebSocket connections',
140 registers: [registry],
141});
142
143// Instrumented transcription
144async function instrumentedTranscribe(url: string, model = 'nova-3') {
145 const timer = transcriptionLatency.startTimer({ method: 'prerecorded', model });
146 try {
147 const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
148 { url }, { model, smart_format: true }
149 );
150 timer();
151 transcriptionRequests.inc({ method: 'prerecorded', model, status: error ? 'error' : 'ok' });
152 if (result?.metadata?.duration) {
153 audioProcessed.inc({ model }, result.metadata.duration);
154 }
155 if (error) throw error;
156 return result;
157 } catch (err) {
158 timer();
159 transcriptionRequests.inc({ method: 'prerecorded', model, status: 'error' });
160 throw err;
161 }
162}
163
164// Expose metrics endpoint
165app.get('/metrics', async (req, res) => {
166 res.set('Content-Type', registry.contentType);
167 res.send(await registry.metrics());
168});
169```
170
171### Step 4: Alert Rules (Prometheus/AlertManager)
172
173```yaml
174groups:
175 - name: deepgram
176 rules:
177 - alert: DeepgramHighErrorRate
178 expr: rate(deepgram_requests_total{status="error"}[5m]) / rate(deepgram_requests_total[5m]) > 0.05
179 for: 5m
180 labels:
181 severity: critical
182 annotations:
183 summary: "Deepgram error rate > 5%"
184
185 - alert: DeepgramHighLatency
186 expr: histogram_quantile(0.95, rate(deepgram_latency_seconds_bucket[5m])) > 10
187 for: 5m
188 labels:
189 severity: warning
190 annotations:
191 summary: "Deepgram P95 latency > 10s"
192
193 - alert: DeepgramHealthCheckFailed
194 expr: up{job="deepgram-service"} == 0
195 for: 2m
196 labels:
197 severity: critical
198 annotations:
199 summary: "Deepgram health check failed for 2+ minutes"
200```
201
202### Step 5: Error Handling Wrapper
203
204```typescript
205async function safeTranscribe(url: string, options: Record<string, any> = {}) {
206 const timeout = options.timeout ?? 30000;
207
208 const controller = new AbortController();
209 const timeoutId = setTimeout(() => controller.abort(), timeout);
210
211 try {
212 const result = await Promise.race([
213 instrumentedTranscribe(url, options.model ?? 'nova-3'),
214 new Promise((_, reject) =>
215 setTimeout(() => reject(new Error('Transcription timeout')), timeout)
216 ),
217 ]);
218 clearTimeout(timeoutId);
219 return result;
220 } catch (err: any) {
221 clearTimeout(timeoutId);
222 // Log structured error
223 console.error(JSON.stringify({
224 level: 'error',
225 service: 'deepgram',
226 message: err.message,
227 url: url.substring(0, 100),
228 timestamp: new Date().toISOString(),
229 }));
230 throw err;
231 }
232}
233```
234
235### Step 6: Go-Live Timeline
236
237| Phase | When | Actions |
238|-------|------|---------|
239| D-7 | 1 week before | Load test at 2x expected volume, security review |
240| D-3 | 3 days before | Smoke test with production key, verify all alerts fire |
241| D-1 | Day before | Confirm on-call rotation, validate dashboards |
242| D-0 | Launch | Shadow mode (10% traffic), monitoring open |
243| D+1 | Day after | Review error rate, latency, verify no anomalies |
244| D+7 | 1 week after | Full traffic, tune alert thresholds based on baselines |
245
246## Output
247
248- Singleton client with reset capability
249- Health check endpoint with latency reporting
250- Prometheus metrics (requests, latency, audio, connections)
251- AlertManager rules for error rate, latency, availability
252- Timeout-safe transcription wrapper
253- Phased go-live timeline
254
255## Error Handling
256
257| Issue | Cause | Solution |
258|-------|-------|----------|
259| Health check 503 | API key expired | Rotate key, check secret manager |
260| Metrics not scraped | Wrong port/path | Verify Prometheus target config |
261| Alert storms | Thresholds too tight | Add `for:` duration, tune values |
262| Timeout on large files | Sync mode too slow | Switch to `callback` URL pattern |
263
264## Resources
265
266- Deepgram Production Guide
267- [Prometheus Best Practices](https://prometheus.io/docs/practices/)
268- Deepgram SLA
269
270---
271
272**Source:** [`jeremylongshore/claude-code-plugins-plus-skills`](https://github.com/jeremylongshore/claude-code-plugins-plus-skills) → `skills/.curated/deepgram-prod-checklist/SKILL.md`
273
274**Also appears in:** `jeremylongshore/claude-code-plugins-plus-skills/plugins/saas-packs/deepgram-pack/skills/deepgram-prod-checklist/SKILL.md`