Agent Skills by ALSEL
Anthropic Claude音声・動画・メディア⭐ リポ 1品質スコア 53/100

deepgram-rate-limits

Deepgramのレート制限とバックオフ戦略を実装します。API クォータの管理、リクエスト スロットリングの実装、またはレート制限エラーへの対応が必要な場合に使用してください。「deepgram rate limit」「deepgram throttling」「429 error deepgram」「deepgram quota」「deepgram backoff」などのフレーズで実行されます。

description の原文を見る

Implement Deepgram rate limiting and backoff strategies. Use when handling API quotas, implementing request throttling, or dealing with rate limit errors. Trigger with phrases like "deepgram rate limit", "deepgram throttling", "429 error deepgram", "deepgram quota", "deepgram backoff".

SKILL.md 本文

Deepgram レート制限

概要

Deepgram API 統合に対して、適切なレート制限とバックオフ戦略を実装します。

Deepgram レート制限

プラン同時リクエスト数リクエスト/分音声時間/月
Pay As You Go1001000無制限
Growth2002000含まれた時間
Enterpriseカスタムカスタムカスタム

手順

ステップ 1: リクエストキューを実装する

同時リクエスト数の制限を管理するためのキューを作成します。

ステップ 2: エクスポーネンシャルバックオフを追加する

インテリジェントなリトライによってレート制限レスポンスを処理します。

ステップ 3: 使用状況を監視する

リクエスト数と音声時間を追跡します。

ステップ 4: サーキットブレーカーを実装する

レート制限中のカスケード障害を防止します。

出力

  • レート制限されたリクエストキュー
  • エクスポーネンシャルバックオフハンドラー
  • 使用状況監視ダッシュボード
  • サーキットブレーカーの実装

TypeScript レート制限機能

// lib/rate-limiter.ts
interface RateLimiterConfig {
  maxConcurrent: number;
  maxPerMinute: number;
  retryAttempts: number;
  baseDelay: number;
}

export class DeepgramRateLimiter {
  private queue: Array<{
    fn: () => Promise<unknown>;
    resolve: (value: unknown) => void;
    reject: (error: Error) => void;
  }> = [];
  private activeRequests = 0;
  private requestsThisMinute = 0;
  private minuteStart = Date.now();
  private config: RateLimiterConfig;

  constructor(config: Partial<RateLimiterConfig> = {}) {
    this.config = {
      maxConcurrent: config.maxConcurrent ?? 50,
      maxPerMinute: config.maxPerMinute ?? 500,
      retryAttempts: config.retryAttempts ?? 3,
      baseDelay: config.baseDelay ?? 1000,
    };
  }

  async execute<T>(fn: () => Promise<T>): Promise<T> {
    return new Promise((resolve, reject) => {
      this.queue.push({
        fn,
        resolve: resolve as (value: unknown) => void,
        reject,
      });
      this.processQueue();
    });
  }

  private async processQueue() {
    // Reset minute counter if needed
    const now = Date.now();
    if (now - this.minuteStart >= 60000) {
      this.requestsThisMinute = 0;
      this.minuteStart = now;
    }

    // Check limits
    if (this.activeRequests >= this.config.maxConcurrent) return;
    if (this.requestsThisMinute >= this.config.maxPerMinute) return;
    if (this.queue.length === 0) return;

    const { fn, resolve, reject } = this.queue.shift()!;
    this.activeRequests++;
    this.requestsThisMinute++;

    try {
      const result = await this.executeWithRetry(fn);
      resolve(result);
    } catch (error) {
      reject(error instanceof Error ? error : new Error(String(error)));
    } finally {
      this.activeRequests--;
      this.processQueue();
    }
  }

  private async executeWithRetry<T>(
    fn: () => Promise<T>,
    attempt = 0
  ): Promise<T> {
    try {
      return await fn();
    } catch (error) {
      const isRateLimited = error instanceof Error &&
        (error.message.includes('429') || error.message.includes('rate limit'));

      if (isRateLimited && attempt < this.config.retryAttempts) {
        const delay = this.config.baseDelay * Math.pow(2, attempt);
        const jitter = Math.random() * 1000;
        await new Promise(r => setTimeout(r, delay + jitter));
        return this.executeWithRetry(fn, attempt + 1);
      }

      throw error;
    }
  }

  getStats() {
    return {
      activeRequests: this.activeRequests,
      queuedRequests: this.queue.length,
      requestsThisMinute: this.requestsThisMinute,
    };
  }
}

ジッター付きエクスポーネンシャルバックオフ

// lib/backoff.ts
interface BackoffConfig {
  baseDelay: number;
  maxDelay: number;
  factor: number;
  jitter: boolean;
}

export class ExponentialBackoff {
  private attempt = 0;
  private config: BackoffConfig;

  constructor(config: Partial<BackoffConfig> = {}) {
    this.config = {
      baseDelay: config.baseDelay ?? 1000,
      maxDelay: config.maxDelay ?? 60000,
      factor: config.factor ?? 2,
      jitter: config.jitter ?? true,
    };
  }

  getDelay(): number {
    const exponential = this.config.baseDelay *
      Math.pow(this.config.factor, this.attempt);
    const capped = Math.min(exponential, this.config.maxDelay);

    if (this.config.jitter) {
      // Full jitter: random value between 0 and calculated delay
      return Math.random() * capped;
    }

    return capped;
  }

  increment(): void {
    this.attempt++;
  }

  reset(): void {
    this.attempt = 0;
  }

  async wait(): Promise<void> {
    const delay = this.getDelay();
    await new Promise(resolve => setTimeout(resolve, delay));
    this.increment();
  }
}

// Usage
const backoff = new ExponentialBackoff();

async function transcribeWithBackoff(url: string) {
  const maxAttempts = 5;

  for (let i = 0; i < maxAttempts; i++) {
    try {
      return await transcribe(url);
    } catch (error) {
      if (i === maxAttempts - 1) throw error;

      if (error instanceof Error && error.message.includes('429')) {
        console.log(`Rate limited, waiting ${backoff.getDelay()}ms...`);
        await backoff.wait();
      } else {
        throw error;
      }
    }
  }
}

サーキットブレーカーパターン

// lib/circuit-breaker.ts
enum CircuitState {
  CLOSED = 'CLOSED',
  OPEN = 'OPEN',
  HALF_OPEN = 'HALF_OPEN',
}

interface CircuitBreakerConfig {
  failureThreshold: number;
  resetTimeout: number;
  halfOpenRequests: number;
}

export class CircuitBreaker {
  private state = CircuitState.CLOSED;
  private failures = 0;
  private lastFailure = 0;
  private halfOpenSuccesses = 0;
  private config: CircuitBreakerConfig;

  constructor(config: Partial<CircuitBreakerConfig> = {}) {
    this.config = {
      failureThreshold: config.failureThreshold ?? 5,
      resetTimeout: config.resetTimeout ?? 30000,
      halfOpenRequests: config.halfOpenRequests ?? 3,
    };
  }

  async execute<T>(fn: () => Promise<T>): Promise<T> {
    if (this.state === CircuitState.OPEN) {
      if (Date.now() - this.lastFailure > this.config.resetTimeout) {
        this.state = CircuitState.HALF_OPEN;
        this.halfOpenSuccesses = 0;
      } else {
        throw new Error('Circuit breaker is OPEN');
      }
    }

    try {
      const result = await fn();

      if (this.state === CircuitState.HALF_OPEN) {
        this.halfOpenSuccesses++;
        if (this.halfOpenSuccesses >= this.config.halfOpenRequests) {
          this.state = CircuitState.CLOSED;
          this.failures = 0;
        }
      }

      return result;
    } catch (error) {
      this.recordFailure();
      throw error;
    }
  }

  private recordFailure() {
    this.failures++;
    this.lastFailure = Date.now();

    if (this.failures >= this.config.failureThreshold) {
      this.state = CircuitState.OPEN;
      console.log('Circuit breaker OPENED');
    }
  }

  getState(): CircuitState {
    return this.state;
  }
}

使用状況監視

// lib/usage-monitor.ts
interface UsageStats {
  requestCount: number;
  audioSeconds: number;
  errorCount: number;
  rateLimitHits: number;
  startTime: Date;
}

export class DeepgramUsageMonitor {
  private stats: UsageStats = {
    requestCount: 0,
    audioSeconds: 0,
    errorCount: 0,
    rateLimitHits: 0,
    startTime: new Date(),
  };

  recordRequest(audioSeconds: number = 0) {
    this.stats.requestCount++;
    this.stats.audioSeconds += audioSeconds;
  }

  recordError(isRateLimit: boolean = false) {
    this.stats.errorCount++;
    if (isRateLimit) {
      this.stats.rateLimitHits++;
    }
  }

  getStats(): UsageStats & { audioDuration: string; uptimeHours: number } {
    const uptimeMs = Date.now() - this.stats.startTime.getTime();

    return {
      ...this.stats,
      audioDuration: this.formatDuration(this.stats.audioSeconds),
      uptimeHours: uptimeMs / 3600000,
    };
  }

  private formatDuration(seconds: number): string {
    const hours = Math.floor(seconds / 3600);
    const minutes = Math.floor((seconds % 3600) / 60);
    return `${hours}h ${minutes}m`;
  }

  shouldAlert(): boolean {
    // Alert if rate limit hit rate exceeds 10%
    const hitRate = this.stats.rateLimitHits / this.stats.requestCount;
    return hitRate > 0.1 && this.stats.requestCount > 10;
  }
}

Python レート制限機能

# lib/rate_limiter.py
import asyncio
import time
from collections import deque
from typing import Callable, TypeVar

T = TypeVar('T')

class RateLimiter:
    def __init__(
        self,
        max_concurrent: int = 50,
        max_per_minute: int = 500
    ):
        self.max_concurrent = max_concurrent
        self.max_per_minute = max_per_minute
        self.semaphore = asyncio.Semaphore(max_concurrent)
        self.request_times: deque = deque()

    async def execute(self, fn: Callable[[], T]) -> T:
        await self._wait_for_rate_limit()

        async with self.semaphore:
            self.request_times.append(time.time())
            return await fn()

    async def _wait_for_rate_limit(self):
        now = time.time()

        # Remove requests older than 1 minute
        while self.request_times and now - self.request_times[0] > 60:
            self.request_times.popleft()

        # Wait if at limit
        if len(self.request_times) >= self.max_per_minute:
            wait_time = 60 - (now - self.request_times[0])
            if wait_time > 0:
                await asyncio.sleep(wait_time)

リソース

次のステップ

セキュリティのベストプラクティスについては、deepgram-security-basics に進んでください。

ライセンス: MIT(寛容ライセンスのため全文を引用しています) · 原本リポジトリ

詳細情報

作者
Brmbobo
リポジトリ
Brmbobo/Web2podcast
ライセンス
MIT
最終更新
2026/1/26

Source: https://github.com/Brmbobo/Web2podcast / ライセンス: MIT

関連スキル

汎用音声・動画・メディア⭐ リポ 1,982

listenhub

あらゆることを説明できます。アイデアをポッドキャスト、解説動画、または音声ナレーションに変換します。 ユーザーが「ポッドキャストを作りたい」「解説動画を作成したい」「これを読み上げてほしい」「画像を生成したい」、または知識を音声・映像形式で共有したいときに使用します。トピックの説明、YouTubeリンク、記事URL、プレーンテキスト、画像プロンプトに対応しています。

by LeoYeAI
汎用音声・動画・メディア⭐ リポ 1,982

best-youtube-video-editor

ClawHub上の「best-youtube-video-editor」スキルは、YouTube クリエイターのコンテンツ制作を革新します。タイムラインや複雑なソフトウェアを必要とせず、会話形式のAI駆動型ビデオ編集が可能です。無音部分のカット、チャプターマーカーの追加、字幕の挿入、ペーシングの調整、エクスポートの最適化——すべてが自然言語の指示で実現します。初回使用時には NemoVideo API を通じて認証情報を自動設定するため、有効化後数秒で編集を開始できます。YouTuber、教育関係者、ポッドキャスター、ブランドチャネル向けに開発され、品質を損なわず高速な納期対応が必要な方に最適です。mp4、mov、avi、webm、mkv 形式に対応しています。

by LeoYeAI
汎用音声・動画・メディア⭐ リポ 27,990

video

ユーザーがAIツールやプログラマティックフレームワークを使用してビデオコンテンツを作成、生成、または制作したい場合に使用します。また、ユーザーが「ビデオ制作」「AIビデオ」「Remotion」「Hyperframes」「HeyGen」「Synthesia」「Veo」「Runway」「Kling」「Pika」「ビデオ生成」「AIアバター」「トーキングヘッドビデオ」「プログラマティックビデオ」「ビデオテンプレート」「解説ビデオ」「プロダクトデモビデオ」「ビデオパイプライン」または「ビデオを作ってほしい」と言及している場合にも使用します。ビデオ作成、生成、制作のワークフロー全般に対応できます。ビデオコンテンツの戦略や投稿内容については「social-content」を、有料ビデオ広告クリエイティブについては「ad-creative」をご参照ください。

by coreyhaines31
汎用音声・動画・メディア⭐ リポ 317

clipify

ビデオから最も面白い瞬間を検出し、スタンドアロンクリップとしてカットできます。オプションで16:9から9:16へのリフォーマット(フェイスパンまたはスプリットスクリーン)に対応し、Opus風の単語ごとのキャプションを焼き込みます。ユーザーが「clipify」「このビデオからクリップをカットして」「これからショーツを作って」「面白い瞬間を見つけて」「9:16にリフレーミングして」「縦型クリップ」と言及したり、ビデオファイルパスを貼り付けてSNS対応のクリップを求める場合に使用します。

by louisedesadeleer
OpenAI音声・動画・メディア⭐ リポ 18,898

speech

ユーザーが音声生成、ナレーション、アクセシビリティ対応の読み上げ、音声プロンプト、またはOpenAI Audio APIによるバッチ音声生成をリクエストした場合に使用します。組み込みボイスを備えたバンドルCLI(`scripts/text_to_speech.py`)を実行でき、ライブ呼び出しには`OPENAI_API_KEY`が必要です。カスタムボイスの作成には対応していません。

by openai
汎用音声・動画・メディア⭐ リポ 2,743

depth-estimation

Depth Anything v2を使用したリアルタイム深度マップのプライバシー変換(CoreML + PyTorch対応) このスキルは、Depth Anything v2モデルを活用して、画像やビデオから取得した深度情報をリアルタイムで処理し、プライバシーを保護しながら変換します。CoreMLとPyTorchの両方に対応しており、エッジデバイスでの高速処理とクラウド環境での柔軟な運用が可能です。顔認識データのぼかしや背景の匿名化など、プライバシー関連の処理を効率的に実行できます。

by SharpAI
本サイトは GitHub 上で公開されているオープンソースの SKILL.md ファイルをクロール・インデックス化したものです。 各スキルの著作権は原作者に帰属します。掲載に問題がある場合は info@alsel.co.jp または /takedown フォームよりご連絡ください。
原作者: Brmbobo · Brmbobo/Web2podcast · ライセンス: MIT