Examples/ServeCLIClient/Python/README.md
A simple Python client for the WhisperKit local server using OpenAI's SDK.
Start the WhisperKit server (in another terminal):
whisperkit-cli serve
Install dependencies:
uv sync
Run commands:
# Transcribe an audio file
python whisperkit_client.py transcribe audio.wav
# Translate an audio file to English
python whisperkit_client.py translate audio.wav
# Test with sample files
python whisperkit_client.py test
transcribe <audio-file> - Transcribe audio to texttranslate <audio-file> - Translate audio to Englishtest - Test transcription and translation on sample files--server, -s - Server URL (default: http://localhost:50060)--model, -m - Model to use (default: tiny)--language, -l - Source language for transcription (default: auto-detect)--response-format - Response format: json, verbose_json (default: verbose_json)--timestamp-granularities - Comma-separated: word,segment (default: segment)--stream - Enable streaming output--debug - Show raw JSON response for debugging# Transcribe in Spanish
python whisperkit_client.py transcribe -l es audio.wav
# Translate to English (auto-detects source language)
python whisperkit_client.py translate audio.wav
# Use custom server and model
python whisperkit_client.py -s http://192.168.1.100:50060 -m large transcribe audio.wav
# Transcribe with word-level timestamps
python whisperkit_client.py transcribe --timestamp-granularities "word,segment" audio.wav
# Stream transcription
python whisperkit_client.py transcribe --stream audio.wav
# Debug mode to see raw JSON
python whisperkit_client.py transcribe --debug audio.wav
# Test with sample files
python whisperkit_client.py test
Examples/ServeCLIClient/Python/
├── whisperkit_client.py # Main CLI script with all functionality
├── test_transcribe.py # Test script for transcription
├── test_translate.py # Test script for translation
├── requirements.txt # Python dependencies
├── uv.lock # Locked dependency versions
└── README.md # This file
openai - OpenAI Python SDK for API communicationuv - Fast Python package managerThe client automatically finds test audio files from Tests/WhisperKitTests/Resources/ in the main project directory.
# Run tests on sample files
python whisperkit_client.py test
# Or run individual test scripts
python test_transcribe.py
python test_translate.py
For lightweight testing without Python dependencies, see the CurlClient which provides shell script implementations using curl.