@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / ecb37e276a
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

[docs] transcriptions API audio upload (#25446)

Signed-off-by: zxw <1020938856@qq.com>

yyzxw committed Sep 27, 2025 at 23:00 UTC ecb37e276a8c261312a2b0dc011182216d895917
1 file changed +80 -1
docs/serving/openai_compatible_server.md
+80 -1
@@ -351,13 +351,92 @@ you can use the [official OpenAI Python client](https://github.com/openai/openai
351 To use the Transcriptions API, please install with extra audio dependencies using `pip install vllm[audio]`.
352
353 Code example: <gh-file:examples/online_serving/openai_transcription_client.py>
354 -<!-- TODO: api enforced limits + uploading audios -->
354
355 #### API Enforced Limits
356
357 Set the maximum audio file size (in MB) that VLLM will accept, via the
358 `VLLM_MAX_AUDIO_CLIP_FILESIZE_MB` environment variable. Default is 25 MB.
359
360 +#### Uploading Audio Files
361 +
362 +The Transcriptions API supports uploading audio files in various formats including FLAC, MP3, MP4, MPEG, MPGA, M4A, OGG, WAV, and WEBM.
363 +
364 +**Using OpenAI Python Client:**
365 +
366 +??? code
367 +
368 + ```python
369 + from openai import OpenAI
370 +
371 + client = OpenAI(
372 + base_url="http://localhost:8000/v1",
373 + api_key="token-abc123",
374 + )
375 +
376 + # Upload audio file from disk
377 + with open("audio.mp3", "rb") as audio_file:
378 + transcription = client.audio.transcriptions.create(
379 + model="openai/whisper-large-v3-turbo",
380 + file=audio_file,
381 + language="en",
382 + response_format="verbose_json"
383 + )
384 +
385 + print(transcription.text)
386 + ```
387 +
388 +**Using curl with multipart/form-data:**
389 +
390 +??? code
391 +
392 + ```bash
393 + curl -X POST "http://localhost:8000/v1/audio/transcriptions" \
394 + -H "Authorization: Bearer token-abc123" \
395 + -F "file=@audio.mp3" \
396 + -F "model=openai/whisper-large-v3-turbo" \
397 + -F "language=en" \
398 + -F "response_format=verbose_json"
399 + ```
400 +
401 +**Supported Parameters:**
402 +
403 +- `file`: The audio file to transcribe (required)
404 +- `model`: The model to use for transcription (required)
405 +- `language`: The language code (e.g., "en", "zh") (optional)
406 +- `prompt`: Optional text to guide the transcription style (optional)
407 +- `response_format`: Format of the response ("json", "text") (optional)
408 +- `temperature`: Sampling temperature between 0 and 1 (optional)
409 +
410 +For the complete list of supported parameters including sampling parameters and vLLM extensions, see the [protocol definitions](https://github.com/vllm-project/vllm/blob/main/vllm/entrypoints/openai/protocol.py#L2182).
411 +
412 +**Response Format:**
413 +
414 +For `verbose_json` response format:
415 +
416 +??? code
417 +
418 + ```json
419 + {
420 + "text": "Hello, this is a transcription of the audio file.",
421 + "language": "en",
422 + "duration": 5.42,
423 + "segments": [
424 + {
425 + "id": 0,
426 + "seek": 0,
427 + "start": 0.0,
428 + "end": 2.5,
429 + "text": "Hello, this is a transcription",
430 + "tokens": [50364, 938, 428, 307, 275, 28347],
431 + "temperature": 0.0,
432 + "avg_logprob": -0.245,
433 + "compression_ratio": 1.235,
434 + "no_speech_prob": 0.012
435 + }
436 + ]
437 + }
438 + ```
439 +
440 #### Extra Parameters
441
442 The following [sampling parameters][sampling-params] are supported.