[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F699NGW05STBJPEH1RY5B8":3,"skill-same:01M6F699NGW05STBJPEH1RY5B8":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":45,"linkOnly":46,"markdownContent":47,"markdownBody":48,"frontMatter":49,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":57,"repositoryHtmlUrl":58,"repositoryHomepageUrl":6,"ownerHtmlUrl":59,"ownerBlogUrl":60,"ownerDescription":61,"updatedAt":62,"install":63,"resources":76},"01M6F699NGW05STBJPEH1RY5B8","deepgram-cost-tuning",null,"Optimize Deepgram costs and usage for budget-conscious deployments.\nUse when reducing transcription costs, implementing usage controls,\nor optimizing pricing tier utilization.\nTrigger with phrases like \"deepgram cost\", \"reduce deepgram spending\",\n\"deepgram pricing\", \"deepgram budget\", \"optimize deepgram usage\".","Dicklesworthstone\u002Fpi_agent_rust","Dicklesworthstone","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F35050222?v=4","01M6CG26AR942CSVMN1M5E3DSE","Jeff Emanuel","01M6CG26EPP71PSHW1VDS71121",1992,"MIT","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fdeepgram-pack\u002Fskills\u002Fdeepgram-cost-tuning\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],"tuning","deepgram cost tuning","deepgram","cost","when","pricing","reduce","for","implementing","spending","usage","with","controls","trigger","io","optimize","deployments","use","utilization","edit","write","read","curl","gh","Bash","Budget","2026-11-10 10:12:30",false,"---\nname: deepgram-cost-tuning\ndescription: |\n  Optimize Deepgram costs and usage for budget-conscious deployments.\n  Use when reducing transcription costs, implementing usage controls,\n  or optimizing pricing tier utilization.\n  Trigger with phrases like \"deepgram cost\", \"reduce deepgram spending\",\n  \"deepgram pricing\", \"deepgram budget\", \"optimize deepgram usage\".\nallowed-tools: Read, Write, Edit, Bash(gh:*), Bash(curl:*)\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\n---\n\n# Deepgram Cost Tuning\n\n## Overview\nOptimize Deepgram usage and costs through smart model selection, audio preprocessing, and usage monitoring.\n\n## Deepgram Pricing Overview\n\n| Model | Price per Minute | Best For |\n|-------|-----------------|----------|\n| Nova-2 | $0.0043 | General transcription |\n| Nova | $0.0043 | General transcription |\n| Whisper Cloud | $0.0048 | Multilingual |\n| Enhanced | $0.0145 | Legacy support |\n| Base | $0.0048 | Basic transcription |\n\nAdditional Features:\n- Speaker Diarization: +$0.0044\u002Fmin\n- Smart Formatting: Included\n- Punctuation: Included\n\n## Cost Optimization Strategies\n\n### 1. Model Selection\nChoose the most cost-effective model for your use case.\n\n### 2. Audio Preprocessing\nReduce audio duration and optimize format.\n\n### 3. Usage Monitoring\nTrack and control usage in real-time.\n\n### 4. Caching\nAvoid re-transcribing the same content.\n\n## Examples\n\n### Cost-Optimized Transcription Service\n```typescript\n\u002F\u002F services\u002Fcost-optimized-transcription.ts\nimport { createClient } from '@deepgram\u002Fsdk';\n\ninterface CostConfig {\n  maxMonthlySpend: number;\n  warningThreshold: number; \u002F\u002F percentage\n  model: string;\n  enabledFeatures: {\n    diarization: boolean;\n    smartFormat: boolean;\n  };\n}\n\ninterface CostMetrics {\n  currentMonthMinutes: number;\n  currentMonthCost: number;\n  projectedMonthlyCost: number;\n}\n\nexport class CostOptimizedTranscription {\n  private client;\n  private config: CostConfig;\n  private metrics: CostMetrics;\n  private modelCosts: Record\u003Cstring, number> = {\n    'nova-2': 0.0043,\n    'nova': 0.0043,\n    'base': 0.0048,\n    'enhanced': 0.0145,\n  };\n\n  constructor(apiKey: string, config: Partial\u003CCostConfig> = {}) {\n    this.client = createClient(apiKey);\n    this.config = {\n      maxMonthlySpend: config.maxMonthlySpend ?? 100,\n      warningThreshold: config.warningThreshold ?? 80,\n      model: config.model ?? 'nova-2',\n      enabledFeatures: config.enabledFeatures ?? {\n        diarization: false,\n        smartFormat: true,\n      },\n    };\n    this.metrics = {\n      currentMonthMinutes: 0,\n      currentMonthCost: 0,\n      projectedMonthlyCost: 0,\n    };\n  }\n\n  private calculateCost(durationMinutes: number): number {\n    let cost = durationMinutes * this.modelCosts[this.config.model];\n\n    if (this.config.enabledFeatures.diarization) {\n      cost += durationMinutes * 0.0044;\n    }\n\n    return cost;\n  }\n\n  private checkBudget(estimatedMinutes: number): void {\n    const estimatedCost = this.calculateCost(estimatedMinutes);\n    const projectedTotal = this.metrics.currentMonthCost + estimatedCost;\n\n    if (projectedTotal > this.config.maxMonthlySpend) {\n      throw new Error(`Budget exceeded. Current: $${this.metrics.currentMonthCost.toFixed(2)}, Estimated: $${estimatedCost.toFixed(2)}, Limit: $${this.config.maxMonthlySpend}`);\n    }\n\n    const percentage = (projectedTotal \u002F this.config.maxMonthlySpend) * 100;\n    if (percentage >= this.config.warningThreshold) {\n      console.warn(`Budget warning: ${percentage.toFixed(1)}% of monthly limit used`);\n    }\n  }\n\n  async transcribe(audioUrl: string, estimatedDurationMinutes: number) {\n    this.checkBudget(estimatedDurationMinutes);\n\n    const startTime = Date.now();\n\n    const { result, error } = await this.client.listen.prerecorded.transcribeUrl(\n      { url: audioUrl },\n      {\n        model: this.config.model,\n        smart_format: this.config.enabledFeatures.smartFormat,\n        diarize: this.config.enabledFeatures.diarization,\n      }\n    );\n\n    if (error) throw error;\n\n    \u002F\u002F Track actual usage\n    const actualDuration = result.metadata.duration \u002F 60; \u002F\u002F seconds to minutes\n    const cost = this.calculateCost(actualDuration);\n\n    this.metrics.currentMonthMinutes += actualDuration;\n    this.metrics.currentMonthCost += cost;\n\n    return {\n      transcript: result.results.channels[0].alternatives[0].transcript,\n      metadata: {\n        duration: actualDuration,\n        cost,\n        model: this.config.model,\n      },\n    };\n  }\n\n  getMetrics(): CostMetrics & { budgetRemaining: number } {\n    return {\n      ...this.metrics,\n      budgetRemaining: this.config.maxMonthlySpend - this.metrics.currentMonthCost,\n    };\n  }\n}\n```\n\n### Audio Duration Reducer\n```typescript\n\u002F\u002F lib\u002Faudio-reducer.ts\nimport ffmpeg from 'fluent-ffmpeg';\n\ninterface ReductionOptions {\n  silenceThreshold: string; \u002F\u002F dB\n  silenceMinDuration: number; \u002F\u002F seconds\n  speed: number; \u002F\u002F 1.0 = normal, 1.25 = 25% faster\n}\n\nexport async function reduceDuration(\n  inputPath: string,\n  outputPath: string,\n  options: Partial\u003CReductionOptions> = {}\n): Promise\u003C{ originalDuration: number; reducedDuration: number; savings: number }> {\n  const {\n    silenceThreshold = '-30dB',\n    silenceMinDuration = 0.5,\n    speed = 1.0,\n  } = options;\n\n  return new Promise((resolve, reject) => {\n    let originalDuration = 0;\n    let reducedDuration = 0;\n\n    ffmpeg(inputPath)\n      .on('codecData', (data) => {\n        originalDuration = parseDuration(data.duration);\n      })\n      \u002F\u002F Remove silence\n      .audioFilters([\n        `silenceremove=start_periods=1:start_silence=${silenceMinDuration}:start_threshold=${silenceThreshold}`,\n        `silenceremove=stop_periods=-1:stop_silence=${silenceMinDuration}:stop_threshold=${silenceThreshold}`,\n        \u002F\u002F Optionally speed up\n        ...(speed !== 1.0 ? [`atempo=${speed}`] : []),\n      ])\n      .output(outputPath)\n      .on('end', () => {\n        ffmpeg.ffprobe(outputPath, (err, metadata) => {\n          if (err) return reject(err);\n          reducedDuration = metadata.format.duration || 0;\n          resolve({\n            originalDuration,\n            reducedDuration,\n            savings: ((originalDuration - reducedDuration) \u002F originalDuration) * 100,\n          });\n        });\n      })\n      .on('error', reject)\n      .run();\n  });\n}\n\nfunction parseDuration(duration: string): number {\n  const parts = duration.split(':').map(Number);\n  return parts[0] * 3600 + parts[1] * 60 + parts[2];\n}\n```\n\n### Usage Dashboard\n```typescript\n\u002F\u002F lib\u002Fusage-dashboard.ts\nimport { createClient } from '@deepgram\u002Fsdk';\n\ninterface UsageSummary {\n  period: { start: Date; end: Date };\n  totalMinutes: number;\n  totalCost: number;\n  byModel: Record\u003Cstring, { minutes: number; cost: number }>;\n  byDay: Array\u003C{ date: string; minutes: number; cost: number }>;\n  projections: {\n    monthlyMinutes: number;\n    monthlyCost: number;\n  };\n}\n\nexport class UsageDashboard {\n  private client;\n  private projectId: string;\n\n  constructor(apiKey: string, projectId: string) {\n    this.client = createClient(apiKey);\n    this.projectId = projectId;\n  }\n\n  async getUsageSummary(daysBack = 30): Promise\u003CUsageSummary> {\n    const end = new Date();\n    const start = new Date(end.getTime() - daysBack * 24 * 60 * 60 * 1000);\n\n    \u002F\u002F Get usage data from Deepgram API\n    const { result, error } = await this.client.manage.getProjectUsageRequest(\n      this.projectId,\n      {\n        start: start.toISOString(),\n        end: end.toISOString(),\n      }\n    );\n\n    if (error) throw error;\n\n    \u002F\u002F Aggregate data\n    const byModel: Record\u003Cstring, { minutes: number; cost: number }> = {};\n    const byDay: Map\u003Cstring, { minutes: number; cost: number }> = new Map();\n\n    let totalMinutes = 0;\n    let totalCost = 0;\n\n    for (const request of result.requests || []) {\n      const minutes = (request.duration || 0) \u002F 60;\n      const model = request.model || 'unknown';\n      const cost = this.calculateCost(minutes, model);\n      const dateKey = new Date(request.created).toISOString().split('T')[0];\n\n      totalMinutes += minutes;\n      totalCost += cost;\n\n      if (!byModel[model]) {\n        byModel[model] = { minutes: 0, cost: 0 };\n      }\n      byModel[model].minutes += minutes;\n      byModel[model].cost += cost;\n\n      if (!byDay.has(dateKey)) {\n        byDay.set(dateKey, { minutes: 0, cost: 0 });\n      }\n      const day = byDay.get(dateKey)!;\n      day.minutes += minutes;\n      day.cost += cost;\n    }\n\n    \u002F\u002F Calculate projections\n    const dailyAverage = totalMinutes \u002F daysBack;\n    const daysInMonth = 30;\n\n    return {\n      period: { start, end },\n      totalMinutes,\n      totalCost,\n      byModel,\n      byDay: Array.from(byDay.entries()).map(([date, data]) => ({\n        date,\n        ...data,\n      })),\n      projections: {\n        monthlyMinutes: dailyAverage * daysInMonth,\n        monthlyCost: (totalCost \u002F daysBack) * daysInMonth,\n      },\n    };\n  }\n\n  private calculateCost(minutes: number, model: string): number {\n    const rates: Record\u003Cstring, number> = {\n      'nova-2': 0.0043,\n      'nova': 0.0043,\n      'base': 0.0048,\n      'enhanced': 0.0145,\n    };\n    return minutes * (rates[model] || 0.0043);\n  }\n}\n```\n\n### Cost Alerts\n```typescript\n\u002F\u002F lib\u002Fcost-alerts.ts\nimport { UsageDashboard } from '.\u002Fusage-dashboard';\n\ninterface AlertConfig {\n  dailyLimit: number;\n  weeklyLimit: number;\n  monthlyLimit: number;\n  alertChannels: Array\u003C'email' | 'slack' | 'webhook'>;\n}\n\nexport class CostAlerts {\n  private dashboard: UsageDashboard;\n  private config: AlertConfig;\n  private alertsSent: Set\u003Cstring> = new Set();\n\n  constructor(dashboard: UsageDashboard, config: Partial\u003CAlertConfig> = {}) {\n    this.dashboard = dashboard;\n    this.config = {\n      dailyLimit: config.dailyLimit ?? 10,\n      weeklyLimit: config.weeklyLimit ?? 50,\n      monthlyLimit: config.monthlyLimit ?? 200,\n      alertChannels: config.alertChannels ?? ['email'],\n    };\n  }\n\n  async checkAndAlert(): Promise\u003Cvoid> {\n    const daily = await this.dashboard.getUsageSummary(1);\n    const weekly = await this.dashboard.getUsageSummary(7);\n    const monthly = await this.dashboard.getUsageSummary(30);\n\n    const alerts: string[] = [];\n\n    if (daily.totalCost > this.config.dailyLimit) {\n      alerts.push(`Daily spend ($${daily.totalCost.toFixed(2)}) exceeds limit ($${this.config.dailyLimit})`);\n    }\n\n    if (weekly.totalCost > this.config.weeklyLimit) {\n      alerts.push(`Weekly spend ($${weekly.totalCost.toFixed(2)}) exceeds limit ($${this.config.weeklyLimit})`);\n    }\n\n    if (monthly.totalCost > this.config.monthlyLimit) {\n      alerts.push(`Monthly spend ($${monthly.totalCost.toFixed(2)}) exceeds limit ($${this.config.monthlyLimit})`);\n    }\n\n    \u002F\u002F Send alerts (deduplicated)\n    for (const alert of alerts) {\n      const alertKey = `${new Date().toDateString()}-${alert}`;\n      if (!this.alertsSent.has(alertKey)) {\n        await this.sendAlert(alert);\n        this.alertsSent.add(alertKey);\n      }\n    }\n  }\n\n  private async sendAlert(message: string): Promise\u003Cvoid> {\n    console.log(`COST ALERT: ${message}`);\n\n    for (const channel of this.config.alertChannels) {\n      switch (channel) {\n        case 'slack':\n          await this.sendSlackAlert(message);\n          break;\n        case 'email':\n          await this.sendEmailAlert(message);\n          break;\n        case 'webhook':\n          await this.sendWebhookAlert(message);\n          break;\n      }\n    }\n  }\n\n  private async sendSlackAlert(message: string): Promise\u003Cvoid> {\n    const webhookUrl = process.env.SLACK_WEBHOOK_URL;\n    if (!webhookUrl) return;\n\n    await fetch(webhookUrl, {\n      method: 'POST',\n      headers: { 'Content-Type': 'application\u002Fjson' },\n      body: JSON.stringify({\n        text: `Deepgram Cost Alert: ${message}`,\n      }),\n    });\n  }\n\n  private async sendEmailAlert(message: string): Promise\u003Cvoid> {\n    \u002F\u002F Implement email sending\n  }\n\n  private async sendWebhookAlert(message: string): Promise\u003Cvoid> {\n    \u002F\u002F Implement webhook sending\n  }\n}\n```\n\n### Model Selection for Cost\n```typescript\n\u002F\u002F lib\u002Fcost-aware-model.ts\ninterface ModelRecommendation {\n  model: string;\n  estimatedCost: number;\n  qualityLevel: 'high' | 'medium' | 'low';\n  reason: string;\n}\n\nexport function recommendModel(params: {\n  audioDurationMinutes: number;\n  monthlyBudget: number;\n  currentMonthSpend: number;\n  qualityRequirement: 'high' | 'medium' | 'any';\n}): ModelRecommendation {\n  const { audioDurationMinutes, monthlyBudget, currentMonthSpend, qualityRequirement } = params;\n  const budgetRemaining = monthlyBudget - currentMonthSpend;\n\n  const models = [\n    { name: 'nova-2', rate: 0.0043, quality: 'high' as const },\n    { name: 'nova', rate: 0.0043, quality: 'high' as const },\n    { name: 'base', rate: 0.0048, quality: 'low' as const },\n  ];\n\n  \u002F\u002F Filter by quality requirement\n  const eligible = models.filter(m => {\n    if (qualityRequirement === 'high') return m.quality === 'high';\n    if (qualityRequirement === 'medium') return m.quality !== 'low';\n    return true;\n  });\n\n  \u002F\u002F Find cheapest that fits budget\n  for (const model of eligible.sort((a, b) => a.rate - b.rate)) {\n    const cost = audioDurationMinutes * model.rate;\n    if (cost \u003C= budgetRemaining) {\n      return {\n        model: model.name,\n        estimatedCost: cost,\n        qualityLevel: model.quality,\n        reason: `Best value within budget ($${budgetRemaining.toFixed(2)} remaining)`,\n      };\n    }\n  }\n\n  \u002F\u002F Fallback to cheapest\n  const cheapest = eligible[0];\n  return {\n    model: cheapest.name,\n    estimatedCost: audioDurationMinutes * cheapest.rate,\n    qualityLevel: cheapest.quality,\n    reason: 'Warning: May exceed budget',\n  };\n}\n```\n\n## Resources\n- [Deepgram Pricing](https:\u002F\u002Fdeepgram.com\u002Fpricing)\n- [Usage API Reference](https:\u002F\u002Fdevelopers.deepgram.com\u002Freference\u002Fget-usage)\n- [Cost Optimization Guide](https:\u002F\u002Fdevelopers.deepgram.com\u002Fdocs\u002Fcost-optimization)\n\n## Next Steps\nProceed to `deepgram-reference-architecture` for architecture patterns.\n","# Deepgram Cost Tuning\n\n## Overview\nOptimize Deepgram usage and costs through smart model selection, audio preprocessing, and usage monitoring.\n\n## Deepgram Pricing Overview\n\n| Model | Price per Minute | Best For |\n|-------|-----------------|----------|\n| Nova-2 | $0.0043 | General transcription |\n| Nova | $0.0043 | General transcription |\n| Whisper Cloud | $0.0048 | Multilingual |\n| Enhanced | $0.0145 | Legacy support |\n| Base | $0.0048 | Basic transcription |\n\nAdditional Features:\n- Speaker Diarization: +$0.0044\u002Fmin\n- Smart Formatting: Included\n- Punctuation: Included\n\n## Cost Optimization Strategies\n\n### 1. Model Selection\nChoose the most cost-effective model for your use case.\n\n### 2. Audio Preprocessing\nReduce audio duration and optimize format.\n\n### 3. Usage Monitoring\nTrack and control usage in real-time.\n\n### 4. Caching\nAvoid re-transcribing the same content.\n\n## Examples\n\n### Cost-Optimized Transcription Service\n```typescript\n\u002F\u002F services\u002Fcost-optimized-transcription.ts\nimport { createClient } from '@deepgram\u002Fsdk';\n\ninterface CostConfig {\n  maxMonthlySpend: number;\n  warningThreshold: number; \u002F\u002F percentage\n  model: string;\n  enabledFeatures: {\n    diarization: boolean;\n    smartFormat: boolean;\n  };\n}\n\ninterface CostMetrics {\n  currentMonthMinutes: number;\n  currentMonthCost: number;\n  projectedMonthlyCost: number;\n}\n\nexport class CostOptimizedTranscription {\n  private client;\n  private config: CostConfig;\n  private metrics: CostMetrics;\n  private modelCosts: Record\u003Cstring, number> = {\n    'nova-2': 0.0043,\n    'nova': 0.0043,\n    'base': 0.0048,\n    'enhanced': 0.0145,\n  };\n\n  constructor(apiKey: string, config: Partial\u003CCostConfig> = {}) {\n    this.client = createClient(apiKey);\n    this.config = {\n      maxMonthlySpend: config.maxMonthlySpend ?? 100,\n      warningThreshold: config.warningThreshold ?? 80,\n      model: config.model ?? 'nova-2',\n      enabledFeatures: config.enabledFeatures ?? {\n        diarization: false,\n        smartFormat: true,\n      },\n    };\n    this.metrics = {\n      currentMonthMinutes: 0,\n      currentMonthCost: 0,\n      projectedMonthlyCost: 0,\n    };\n  }\n\n  private calculateCost(durationMinutes: number): number {\n    let cost = durationMinutes * this.modelCosts[this.config.model];\n\n    if (this.config.enabledFeatures.diarization) {\n      cost += durationMinutes * 0.0044;\n    }\n\n    return cost;\n  }\n\n  private checkBudget(estimatedMinutes: number): void {\n    const estimatedCost = this.calculateCost(estimatedMinutes);\n    const projectedTotal = this.metrics.currentMonthCost + estimatedCost;\n\n    if (projectedTotal > this.config.maxMonthlySpend) {\n      throw new Error(`Budget exceeded. Current: $${this.metrics.currentMonthCost.toFixed(2)}, Estimated: $${estimatedCost.toFixed(2)}, Limit: $${this.config.maxMonthlySpend}`);\n    }\n\n    const percentage = (projectedTotal \u002F this.config.maxMonthlySpend) * 100;\n    if (percentage >= this.config.warningThreshold) {\n      console.warn(`Budget warning: ${percentage.toFixed(1)}% of monthly limit used`);\n    }\n  }\n\n  async transcribe(audioUrl: string, estimatedDurationMinutes: number) {\n    this.checkBudget(estimatedDurationMinutes);\n\n    const startTime = Date.now();\n\n    const { result, error } = await this.client.listen.prerecorded.transcribeUrl(\n      { url: audioUrl },\n      {\n        model: this.config.model,\n        smart_format: this.config.enabledFeatures.smartFormat,\n        diarize: this.config.enabledFeatures.diarization,\n      }\n    );\n\n    if (error) throw error;\n\n    \u002F\u002F Track actual usage\n    const actualDuration = result.metadata.duration \u002F 60; \u002F\u002F seconds to minutes\n    const cost = this.calculateCost(actualDuration);\n\n    this.metrics.currentMonthMinutes += actualDuration;\n    this.metrics.currentMonthCost += cost;\n\n    return {\n      transcript: result.results.channels[0].alternatives[0].transcript,\n      metadata: {\n        duration: actualDuration,\n        cost,\n        model: this.config.model,\n      },\n    };\n  }\n\n  getMetrics(): CostMetrics & { budgetRemaining: number } {\n    return {\n      ...this.metrics,\n      budgetRemaining: this.config.maxMonthlySpend - this.metrics.currentMonthCost,\n    };\n  }\n}\n```\n\n### Audio Duration Reducer\n```typescript\n\u002F\u002F lib\u002Faudio-reducer.ts\nimport ffmpeg from 'fluent-ffmpeg';\n\ninterface ReductionOptions {\n  silenceThreshold: string; \u002F\u002F dB\n  silenceMinDuration: number; \u002F\u002F seconds\n  speed: number; \u002F\u002F 1.0 = normal, 1.25 = 25% faster\n}\n\nexport async function reduceDuration(\n  inputPath: string,\n  outputPath: string,\n  options: Partial\u003CReductionOptions> = {}\n): Promise\u003C{ originalDuration: number; reducedDuration: number; savings: number }> {\n  const {\n    silenceThreshold = '-30dB',\n    silenceMinDuration = 0.5,\n    speed = 1.0,\n  } = options;\n\n  return new Promise((resolve, reject) => {\n    let originalDuration = 0;\n    let reducedDuration = 0;\n\n    ffmpeg(inputPath)\n      .on('codecData', (data) => {\n        originalDuration = parseDuration(data.duration);\n      })\n      \u002F\u002F Remove silence\n      .audioFilters([\n        `silenceremove=start_periods=1:start_silence=${silenceMinDuration}:start_threshold=${silenceThreshold}`,\n        `silenceremove=stop_periods=-1:stop_silence=${silenceMinDuration}:stop_threshold=${silenceThreshold}`,\n        \u002F\u002F Optionally speed up\n        ...(speed !== 1.0 ? [`atempo=${speed}`] : []),\n      ])\n      .output(outputPath)\n      .on('end', () => {\n        ffmpeg.ffprobe(outputPath, (err, metadata) => {\n          if (err) return reject(err);\n          reducedDuration = metadata.format.duration || 0;\n          resolve({\n            originalDuration,\n            reducedDuration,\n            savings: ((originalDuration - reducedDuration) \u002F originalDuration) * 100,\n          });\n        });\n      })\n      .on('error', reject)\n      .run();\n  });\n}\n\nfunction parseDuration(duration: string): number {\n  const parts = duration.split(':').map(Number);\n  return parts[0] * 3600 + parts[1] * 60 + parts[2];\n}\n```\n\n### Usage Dashboard\n```typescript\n\u002F\u002F lib\u002Fusage-dashboard.ts\nimport { createClient } from '@deepgram\u002Fsdk';\n\ninterface UsageSummary {\n  period: { start: Date; end: Date };\n  totalMinutes: number;\n  totalCost: number;\n  byModel: Record\u003Cstring, { minutes: number; cost: number }>;\n  byDay: Array\u003C{ date: string; minutes: number; cost: number }>;\n  projections: {\n    monthlyMinutes: number;\n    monthlyCost: number;\n  };\n}\n\nexport class UsageDashboard {\n  private client;\n  private projectId: string;\n\n  constructor(apiKey: string, projectId: string) {\n    this.client = createClient(apiKey);\n    this.projectId = projectId;\n  }\n\n  async getUsageSummary(daysBack = 30): Promise\u003CUsageSummary> {\n    const end = new Date();\n    const start = new Date(end.getTime() - daysBack * 24 * 60 * 60 * 1000);\n\n    \u002F\u002F Get usage data from Deepgram API\n    const { result, error } = await this.client.manage.getProjectUsageRequest(\n      this.projectId,\n      {\n        start: start.toISOString(),\n        end: end.toISOString(),\n      }\n    );\n\n    if (error) throw error;\n\n    \u002F\u002F Aggregate data\n    const byModel: Record\u003Cstring, { minutes: number; cost: number }> = {};\n    const byDay: Map\u003Cstring, { minutes: number; cost: number }> = new Map();\n\n    let totalMinutes = 0;\n    let totalCost = 0;\n\n    for (const request of result.requests || []) {\n      const minutes = (request.duration || 0) \u002F 60;\n      const model = request.model || 'unknown';\n      const cost = this.calculateCost(minutes, model);\n      const dateKey = new Date(request.created).toISOString().split('T')[0];\n\n      totalMinutes += minutes;\n      totalCost += cost;\n\n      if (!byModel[model]) {\n        byModel[model] = { minutes: 0, cost: 0 };\n      }\n      byModel[model].minutes += minutes;\n      byModel[model].cost += cost;\n\n      if (!byDay.has(dateKey)) {\n        byDay.set(dateKey, { minutes: 0, cost: 0 });\n      }\n      const day = byDay.get(dateKey)!;\n      day.minutes += minutes;\n      day.cost += cost;\n    }\n\n    \u002F\u002F Calculate projections\n    const dailyAverage = totalMinutes \u002F daysBack;\n    const daysInMonth = 30;\n\n    return {\n      period: { start, end },\n      totalMinutes,\n      totalCost,\n      byModel,\n      byDay: Array.from(byDay.entries()).map(([date, data]) => ({\n        date,\n        ...data,\n      })),\n      projections: {\n        monthlyMinutes: dailyAverage * daysInMonth,\n        monthlyCost: (totalCost \u002F daysBack) * daysInMonth,\n      },\n    };\n  }\n\n  private calculateCost(minutes: number, model: string): number {\n    const rates: Record\u003Cstring, number> = {\n      'nova-2': 0.0043,\n      'nova': 0.0043,\n      'base': 0.0048,\n      'enhanced': 0.0145,\n    };\n    return minutes * (rates[model] || 0.0043);\n  }\n}\n```\n\n### Cost Alerts\n```typescript\n\u002F\u002F lib\u002Fcost-alerts.ts\nimport { UsageDashboard } from '.\u002Fusage-dashboard';\n\ninterface AlertConfig {\n  dailyLimit: number;\n  weeklyLimit: number;\n  monthlyLimit: number;\n  alertChannels: Array\u003C'email' | 'slack' | 'webhook'>;\n}\n\nexport class CostAlerts {\n  private dashboard: UsageDashboard;\n  private config: AlertConfig;\n  private alertsSent: Set\u003Cstring> = new Set();\n\n  constructor(dashboard: UsageDashboard, config: Partial\u003CAlertConfig> = {}) {\n    this.dashboard = dashboard;\n    this.config = {\n      dailyLimit: config.dailyLimit ?? 10,\n      weeklyLimit: config.weeklyLimit ?? 50,\n      monthlyLimit: config.monthlyLimit ?? 200,\n      alertChannels: config.alertChannels ?? ['email'],\n    };\n  }\n\n  async checkAndAlert(): Promise\u003Cvoid> {\n    const daily = await this.dashboard.getUsageSummary(1);\n    const weekly = await this.dashboard.getUsageSummary(7);\n    const monthly = await this.dashboard.getUsageSummary(30);\n\n    const alerts: string[] = [];\n\n    if (daily.totalCost > this.config.dailyLimit) {\n      alerts.push(`Daily spend ($${daily.totalCost.toFixed(2)}) exceeds limit ($${this.config.dailyLimit})`);\n    }\n\n    if (weekly.totalCost > this.config.weeklyLimit) {\n      alerts.push(`Weekly spend ($${weekly.totalCost.toFixed(2)}) exceeds limit ($${this.config.weeklyLimit})`);\n    }\n\n    if (monthly.totalCost > this.config.monthlyLimit) {\n      alerts.push(`Monthly spend ($${monthly.totalCost.toFixed(2)}) exceeds limit ($${this.config.monthlyLimit})`);\n    }\n\n    \u002F\u002F Send alerts (deduplicated)\n    for (const alert of alerts) {\n      const alertKey = `${new Date().toDateString()}-${alert}`;\n      if (!this.alertsSent.has(alertKey)) {\n        await this.sendAlert(alert);\n        this.alertsSent.add(alertKey);\n      }\n    }\n  }\n\n  private async sendAlert(message: string): Promise\u003Cvoid> {\n    console.log(`COST ALERT: ${message}`);\n\n    for (const channel of this.config.alertChannels) {\n      switch (channel) {\n        case 'slack':\n          await this.sendSlackAlert(message);\n          break;\n        case 'email':\n          await this.sendEmailAlert(message);\n          break;\n        case 'webhook':\n          await this.sendWebhookAlert(message);\n          break;\n      }\n    }\n  }\n\n  private async sendSlackAlert(message: string): Promise\u003Cvoid> {\n    const webhookUrl = process.env.SLACK_WEBHOOK_URL;\n    if (!webhookUrl) return;\n\n    await fetch(webhookUrl, {\n      method: 'POST',\n      headers: { 'Content-Type': 'application\u002Fjson' },\n      body: JSON.stringify({\n        text: `Deepgram Cost Alert: ${message}`,\n      }),\n    });\n  }\n\n  private async sendEmailAlert(message: string): Promise\u003Cvoid> {\n    \u002F\u002F Implement email sending\n  }\n\n  private async sendWebhookAlert(message: string): Promise\u003Cvoid> {\n    \u002F\u002F Implement webhook sending\n  }\n}\n```\n\n### Model Selection for Cost\n```typescript\n\u002F\u002F lib\u002Fcost-aware-model.ts\ninterface ModelRecommendation {\n  model: string;\n  estimatedCost: number;\n  qualityLevel: 'high' | 'medium' | 'low';\n  reason: string;\n}\n\nexport function recommendModel(params: {\n  audioDurationMinutes: number;\n  monthlyBudget: number;\n  currentMonthSpend: number;\n  qualityRequirement: 'high' | 'medium' | 'any';\n}): ModelRecommendation {\n  const { audioDurationMinutes, monthlyBudget, currentMonthSpend, qualityRequirement } = params;\n  const budgetRemaining = monthlyBudget - currentMonthSpend;\n\n  const models = [\n    { name: 'nova-2', rate: 0.0043, quality: 'high' as const },\n    { name: 'nova', rate: 0.0043, quality: 'high' as const },\n    { name: 'base', rate: 0.0048, quality: 'low' as const },\n  ];\n\n  \u002F\u002F Filter by quality requirement\n  const eligible = models.filter(m => {\n    if (qualityRequirement === 'high') return m.quality === 'high';\n    if (qualityRequirement === 'medium') return m.quality !== 'low';\n    return true;\n  });\n\n  \u002F\u002F Find cheapest that fits budget\n  for (const model of eligible.sort((a, b) => a.rate - b.rate)) {\n    const cost = audioDurationMinutes * model.rate;\n    if (cost \u003C= budgetRemaining) {\n      return {\n        model: model.name,\n        estimatedCost: cost,\n        qualityLevel: model.quality,\n        reason: `Best value within budget ($${budgetRemaining.toFixed(2)} remaining)`,\n      };\n    }\n  }\n\n  \u002F\u002F Fallback to cheapest\n  const cheapest = eligible[0];\n  return {\n    model: cheapest.name,\n    estimatedCost: audioDurationMinutes * cheapest.rate,\n    qualityLevel: cheapest.quality,\n    reason: 'Warning: May exceed budget',\n  };\n}\n```\n\n## Resources\n- [Deepgram Pricing](https:\u002F\u002Fdeepgram.com\u002Fpricing)\n- [Usage API Reference](https:\u002F\u002Fdevelopers.deepgram.com\u002Freference\u002Fget-usage)\n- [Cost Optimization Guide](https:\u002F\u002Fdevelopers.deepgram.com\u002Fdocs\u002Fcost-optimization)\n\n## Next Steps\nProceed to `deepgram-reference-architecture` for architecture patterns.\n",{"name":5,"author":50,"license":15,"version":51,"description":52,"allowed-tools":53},"Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Optimize Deepgram costs and usage for budget-conscious deployments.\nUse when reducing transcription costs, implementing usage controls,\nor optimizing pricing tier utilization.\nTrigger with phrases like \"deepgram cost\", \"reduce deepgram spending\",\n\"deepgram pricing\", \"deepgram budget\", \"optimize deepgram usage\".\n","Read, Write, Edit, Bash(gh:*), Bash(curl:*)","main","90b50ed0778745a80fd5bfb13b1843d45b9e82f7","tests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fdeepgram-pack\u002Fskills\u002Fdeepgram-cost-tuning",233,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust","https:\u002F\u002Fgithub.com\u002FDicklesworthstone","https:\u002F\u002Fwww.jeffreyemanuel.com\u002F","Building in NY","2026-11-15 01:54:15",{"source":8,"skillName":5,"commands":64,"prompt":74,"zipAvailable":75},[65,68,71],{"tool":66,"command":67},"npx","npx skills add Dicklesworthstone\u002Fpi_agent_rust --skill deepgram-cost-tuning",{"tool":69,"command":70},"bunx","bunx skills add Dicklesworthstone\u002Fpi_agent_rust --skill deepgram-cost-tuning",{"tool":72,"command":73},"pnpm","pnpm dlx skills add Dicklesworthstone\u002Fpi_agent_rust --skill deepgram-cost-tuning","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Fdeepgram-pack\u002Fskills\u002Fdeepgram-cost-tuning\u002FSKILL.md",true,[],[78,111,145,168,194,221],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":82,"licenseFileUrl":83,"sourceHtmlUrl":84,"categories":85,"keywords":91,"publishedAt":110},"01M6FCR7G5A005P364Z6ZWCJDP","theme-factory","Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors\u002Ffonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FSKILL.md",[86],{"categoryNo":87,"categoryName":88,"taxonomyType":89,"taxonomyTypeDesc":90},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",[92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,30,108,109],"theme factory","factory","theme","docs","toolkit","generate","artifacts","SET","fly","slides","landing","html","styling","artifact","pages","themes","you","fonts","2026-11-11 15:11:14",{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":82,"licenseFileUrl":115,"sourceHtmlUrl":116,"categories":117,"keywords":121,"publishedAt":45},"01M6FEGPPK0ZTKCCM0R3E3KS33","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FSKILL.md",[118],{"categoryNo":119,"categoryName":120,"taxonomyType":89,"taxonomyTypeDesc":90},"01JBSEEDCAT000000000000009","前端开发",[122,123,98,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,36,103,139,140,141,142,26,143,144],"web artifacts builder","web","artifacts builder","builder","frontend","css","components","react","component","routing","state management","state","shadcn","file","ui","Tools","Tailwind","single-file","simple","ui components","multi","jsx","suite",{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":82,"licenseFileUrl":149,"sourceHtmlUrl":150,"categories":151,"keywords":156,"publishedAt":45},"01M6FEE9VTK1W4GY21AKREJXRG","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FSKILL.md",[152,155],{"categoryNo":153,"categoryName":154,"taxonomyType":89,"taxonomyTypeDesc":90},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":119,"categoryName":120,"taxonomyType":89,"taxonomyTypeDesc":90},[157,158,159,126,160,161,123,162,96,163,136,164,165,166,167,30,26],"testing","webapp testing","webapp","screenshots","playwright","debugging","browser","logs","applications","behavior","local",{"skillNo":169,"name":170,"nameZh":6,"description":171,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":172,"sourceHtmlUrl":173,"categories":174,"keywords":175,"publishedAt":45},"01M6FE20F7ZTQBFWKF4MPJ2SBX","neuropixels-analysis","Neuropixels neural recording analysis. Load SpikeGLX\u002FOpenEphys data, preprocess, motion correction, Kilosort4 spike sorting, quality metrics, Allen\u002FIBL curation, AI-assisted visual analysis, for Neuropixels 1.0\u002F2.0 extracellular electrophysiology. Use when working with neural recordings, spike sorting, extracellular electrophysiology, or when the user mentions Neuropixels, SpikeGLX, Open Ephys, Kilosort, quality metrics, or unit curation.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FSKILL.md",[],[176,177,178,179,180,181,182,183,36,184,185,186,187,188,189,190,30,191,192,193,26,23],"analysis","neuropixels analysis","spike","metrics","data","open","quality","user","recordings","Neural","motion","visual","quality metrics","unit","sorting","curation","recording","load",{"skillNo":195,"name":196,"nameZh":6,"description":197,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":82,"licenseFileUrl":198,"sourceHtmlUrl":199,"categories":200,"keywords":204,"publishedAt":45},"01M6FDP0PDK6F1GGX395C7625Z","skill-creator","Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FSKILL.md",[201],{"categoryNo":202,"categoryName":203,"taxonomyType":89,"taxonomyTypeDesc":90},"01JBSEEDCAT000000000000023","Skill与智能体开发",[205,206,207,208,209,210,211,212,213,214,215,216,217,218,30,26,219,23,220],"skill creator","creator","workflows","create","update","capabilities","knowledge","tool","integrations","specialized","guide","new skill","existing skill","users","Existing","new",{"skillNo":222,"name":223,"nameZh":6,"description":224,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":225,"sourceHtmlUrl":226,"categories":227,"keywords":229,"publishedAt":45},"01M6FDM8Y7VK7NYG9SM7QPA3PW","notebooklm","Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FSKILL.md",[228],{"categoryNo":202,"categoryName":203,"taxonomyType":89,"taxonomyTypeDesc":90},[223,230,231,232,233,234,235,163,236,237,36,238,239,240,241,26,242],"google","browser automation","gemini","automation","auth","code","library","management","only","document","query","Citation","source"]