Request lifecycle
Request lifecycle
Section titled “Request lifecycle”This page traces a single POST /v1/audio/transcriptions (or /translations)
request from arrival to response, including exactly when the temporary audio file
is created and removed.
Step by step
Section titled “Step by step”- Authentication. When
API_KEYis set, the bearer key is checked first (constant-time). A missing or invalid key returns401— before any readiness or model work. - Readiness gate. If the model is still warming, the request returns
503model_warmingwithRetry-After: 10; if warmup failed terminally,503model_failed. If lazy loading is enabled and the model is not yet loaded, the request triggers the load. - Admission gate. The request enters the process-wide gate:
- If
QUEUE_SIZErequests are already waiting, it is rejected immediately with503queue_full(Retry-After: 5). - Otherwise it waits for a slot up to
QUEUE_TIMEOUT_S; on timeout it returns503queue_timeout(Retry-After: 10). A client disconnect while waiting releases the slot.
- If
- Spooling. The upload is streamed to a temporary file in bounded 1 MB
chunks. If cumulative bytes exceed
MAX_UPLOAD_BYTES, the request returns413and the partial temp file is removed immediately. - Validation.
response_formatandlanguageare validated; invalid values return400with an OpenAI-shaped error. - Inference. faster-whisper transcribes (or translates) the temp file in a
threadpool — off the event loop so
/healthkeeps responding — applyingBEAM_SIZE, the VAD filter,language/prompt, and word timestamps if requested. - Response. The transcript is serialized in the requested format
(
text,json,verbose_json,srt, orvtt). - Cleanup. A
finallystep removes the temporary audio file. Cleanup runs on success, on inference errors, on413, on queue shedding, and on cancellation or disconnect — no request leaves audio on disk.
Concurrency
Section titled “Concurrency”MAX_CONCURRENCY (default 1) sets how many requests run inference at once; the
rest wait in the bounded queue. The active and waiting counters are exposed
under /system → activity. See
Observability and queues.
Error envelope
Section titled “Error envelope”Every error response carries an OpenAI-shaped body
{"error": {"message", "type", "code"}} alongside a detail object the web
console reads (for example detail.error == "model_warming"). See
Common errors and the
OpenAI-compatible API reference.