Skip to main content

Overview

The WhisperKitConfig class provides a comprehensive configuration interface for initializing WhisperKit. It allows you to customize model selection, download settings, compute options, audio processing, and logging behavior.

Class Definition

Initializer

Properties

Model Selection

String?
Name of the Whisper model variant to use. Options include:
  • "tiny" - Smallest, fastest model
  • "tiny.en" - English-only tiny model
  • "base" - Base model
  • "base.en" - English-only base model
  • "small" - Small model
  • "small.en" - English-only small model
  • "medium" - Medium model
  • "medium.en" - English-only medium model
  • "large" - Large model (multilingual)
  • "large-v2" - Large v2 model
  • "large-v3" - Large v3 model
If not specified, WhisperKit will automatically select a recommended model based on your device.

Model Download Configuration

URL?
Base URL for downloading models. If not specified, uses the default Hugging Face Hub endpoint.
String?
Repository identifier for downloading models. Default is "argmaxinc/whisperkit-coreml".
String?
Authentication token for accessing the model repository, if required.
String?
Custom Hugging Face Hub compatible endpoint URL for model downloads.
String?
Local file system path to a folder containing pre-downloaded model files. If specified, WhisperKit will use these models instead of downloading.
URL?
Local file system path to a folder containing tokenizer files.

Compute Configuration

ModelComputeOptions?
Configuration for ML compute units. Allows you to specify which hardware (CPU, GPU, Neural Engine) to use for each model component:

Audio Configuration

AudioInputConfig?
Configuration for audio input processing, including channel mode settings:

Custom Components

(any AudioProcessing)?
Custom audio processor implementation. If not provided, uses the default AudioProcessor.
(any FeatureExtracting)?
Custom feature extractor implementation for converting audio to mel spectrograms.
(any AudioEncoding)?
Custom audio encoder implementation for encoding mel spectrograms to embeddings.
(any TextDecoding)?
Custom text decoder implementation for generating text from embeddings.
[any LogitsFiltering]?
Array of custom logits filters to apply during text decoding.
(any SegmentSeeking)?
Custom segment seeker implementation for managing audio window processing.
VoiceActivityDetector?
Voice activity detector for intelligent audio chunking. See VoiceActivityDetector for details.

Logging Configuration

Bool
default:"true"
Enable verbose logging output for debugging and monitoring.
Logging.LogLevel
default:".info"
Maximum log level to display. Options:
  • .debug - Detailed debug information
  • .info - General information
  • .error - Only errors
  • .none - No logging

Performance Configuration

Bool?
Enable model prewarming for reduced peak memory usage during initialization.What is Prewarming?WhisperKit uses Core ML models that need to be “specialized” to your device’s chip before use. This specialization happens automatically on first load. The resulting specialized models are cached by Core ML.Trade-offs:
  • Pro: Reduces peak memory usage by loading models sequentially
  • Con: Doubles load time (~2x) when cache is hit and specialization isn’t needed
When to use:
  • Enable when minimizing peak memory is critical
  • Disable if you cannot afford 2x longer load time
Bool?
Whether to load models immediately during initialization. If nil, models are loaded automatically when modelFolder is provided.

Download Configuration

Bool
default:"true"
Whether to download models automatically if they are not available locally.
Bool
default:"false"
Use a background URLSession for model downloads. Useful for downloading large models that may take significant time.

Example Usage

Basic Configuration

Specify Model

Local Model

Custom Compute Options

With Voice Activity Detection

Memory-Optimized Configuration

Custom Repository

Multi-Channel Audio

DecodingOptions

While WhisperKitConfig configures the WhisperKit instance, DecodingOptions configures individual transcription requests.

Common Parameters

Bool
default:"false"
Display decoding progress and details
DecodingTask
default:".transcribe"
Either .transcribe (X→X) or .translate (X→English)
String?
Language code (e.g., “en”, “es”, “fr”). If nil, language is auto-detected.
Float
default:"0.0"
Sampling temperature (0.0 = deterministic, higher = more random)
Float
default:"0.2"
Temperature increment when decoding fails and needs retry
Int
default:"5"
Maximum number of temperature fallback attempts
Bool
default:"false"
Disable timestamp prediction
Bool
default:"false"
Enable word-level timestamps (requires more computation)
[Float]
default:"[]"
Array of timestamps (in seconds) to split audio into segments
[Int]?
Token IDs to use as conditioning prompt
Bool
default:"false"
Suppress blank tokens during decoding
Float?
default:"2.4"
Threshold for detecting repetitive text (triggers fallback)
Float?
default:"-1.0"
Minimum average log probability (triggers fallback if below)
Float?
default:"0.6"
Probability threshold for detecting silence
Int
Number of concurrent workers for parallel transcription (default: 16 on macOS, 4 on iOS)
ChunkingStrategy?
Strategy for chunking long audio:
  • .none - No chunking
  • .vad - Voice activity detection based chunking

Example Usage