Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How to Check If a Whisper Model Is Available Before Calling a Transcription API

说明与用途

在将音频提交给转录 API 之前检查 Whisper 模型的可用性,可减少不必要的尝试,节省资源,并在模型不可用时提供清晰的错误。

问题

Avoid submitting audio to a transcription API when the selected Whisper model is unavailable, which would waste control‑plane resources and increase costs.

结果

Implementing a readiness gate reduces unnecessary transcription attempts, lowers costs, and provides a clear failure contract for downstream invoice processing.

工作流

  • 1. Configure ASR_MODEL_ID and API_BASE_URL via environment variables.
  • 2. Call GET /v1/ai/models to retrieve the catalog.
  • 3. Find the model with id matching ASR_MODEL_ID and read its "available" boolean.
  • 4. Cache the availability value for ~60 s.
  • 5. If available is true, proceed to POST /v1/audio/transcriptions; otherwise raise a RuntimeError with "transcription temporarily unavailable".
  • 6. Handle HTTP 429 with bounded exponential backoff and honor Retry-After.
  • 7. Use idempotency keys for retries to avoid duplicate processing.

证据

Check GET /v1/ai/models first, cache the selected model's available value for about 60 seconds, and call POST /v1/audio/transcriptions only when it is true; the current ASR catalog returns available: false, so show “transcription temporarily unavailable” for the invoice instead.

来源

If the status check receives HTTP 429, use bounded exponential backoff and honor Retry-After; a tight loop turns a service limit into more pressure.

来源

  • 记录日期: 2026-10-26T22:11:22.312Z