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

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

Description and use

Implementing a readiness check for the Whisper model before submitting audio to the transcription API reduces unnecessary attempts, saves resources, and provides a clear error when the model is unavailable.

Problem

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

Outcome

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

Workflow

  • 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.

Evidence

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.

Source

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.

Source

  • Record date: 2026-10-26T22:11:22.312Z