Docs
Managing Models

Managing Models

Picking, downloading, and compiling models in your application

Downloading and Compiling Models

Argmax Pro SDK provides utilities to streamline model downloads and on-device compilation in your application. There are two main approaches:

  • ModelStore Approach (Recommended)
  • Direct Initializer Approach (Legacy)

ModelStore Approach

Key Benefits

  • Progress Tracking: Real-time download progress updates
  • Cancellation Support: Ability to cancel downloads
  • Repository Management: Utility to manage models across multiple model repositories
  • Decoupled model download and compilation: On-device model compilation (Specialization) happens separately from download, reducing blocking time

Basic Usage

@available(iOS 17.0, macOS 14.0, watchOS 10.0, visionOS 1.0, *)
public func setupWhisperKitPro() async throws -> WhisperKitPro {
 
    // First, obfuscate your Argmax API Key using `ObfuscatedKeyProvider.generateCodeExample`
    // `ObfuscatedKeyProvider` protects against casual inspection and static analysis tools.
    // In production, consider fetching apiKey securely from your backend.
    var keyProvider = ObfuscatedKeyProvider(mask: 37)
    keyProvider.apiKeyObfuscated = [4, 5, 6]
    
    guard let apiKey = keyProvider.apiKey else {
        fatalError("Missing API key")
    }
 
    // Initialize Argmax SDK to ensure Pro SDK licensed
    // This requires a connection during first use and once every 30 days
    await ArgmaxSDK.with(ArgmaxConfig(apiKey: apiKey))
 
    let modelRepo = RepoType.parakeetRepo  // e.g. RepoType.openSourceRepo, RepoType.proRepo
    
    // Fetch the recommended model for the current device
    let model = await WhisperKit.recommendedRemoteModels(
        from: modelRepo.rawValue,
    ).default
    
    let config = WhisperKitProConfig(
        model: model,
        modelRepo: modelRepo.rawValue,
    )
    let modelStore = ModelStore(whisperKitConfig: config)
    
    // Download model with progress tracking, print the progress
    // Or track the @Published `progress` in SwiftUI
    let cancellable = modelStore.$progress.sink { progress in
        if let progress = progress {
            let percentage = Int(progress.fractionCompleted * 100)
            print("\rDownload progress: \(percentage)%", terminator: "")
        }
    }
    
    // Download model (blocks until complete, track progress via modelStore.$progress)
    let modelURL = try await modelStore.downloadModel() 
 
    // Load model (blocks until complete, also compiles the model during first use or after OS update)
    let whisperKitPro = try await WhisperKitPro(config) 
    return whisperKitPro
}

Migrate from Direct Initializer Approach

If you're currently using the direct initializer approach, here's how to migrate:

Before (Direct Initializer)

// Old approach - blocks for entire process (download + compilation)
let config = WhisperKitProConfig(model: "large-v3-v20240930_626MB")
let whisperKitPro = try await WhisperKitPro(config)

After (ModelStore)

let config = WhisperKitProConfig(
    model: "large-v3-v20240930_626MB",
    modelRepo: RepoType.openSourceRepo.rawValue,
)
let modelStore = ModelStore(whisperKitConfig: config)
 
// Track progress and allow cancellation
let cancellable = modelStore.$progress.sink { progress in
    // Update UI with progress
}
 
let modelURL = try await modelStore.downloadModel()
 
// Initialize with downloaded model
let config = WhisperKitProConfig(
    modelFolder: modelURL.path(percentEncoded: false)
)
let whisperKitPro = try await WhisperKitPro(config)

Picking the Right Model

Argmax Pro SDK works with several model repositories out-of-the-box. This section shows you when and how to switch between them:

Nvidia Parakeet

This model is 9x faster than Whisper Large v3 Turbo on English speech-to-text and achieves slightly higher accuracy.

We recommend using this model for all applications that are English-only. Here is the diff to upgrade to this model:

let downloadURL = try await modelStore.downloadModel(
-    name: "large-v3-v20240930_626MB",
-    repo: .openSourceRepo
+    name: "parakeet-v2_476MB",
+    repo: .parakeetRepo
)

Nvidia Canary

Coming in late August 2025.

OpenAI Whisper

.proRepo hosts Whisper models that are further optimized for speed and energy-efficiency compared to their .openSourceRepo counterparts. During this upgrade, accuracy remains identical while speed and energy-efficiency improves significantly.

In order to use the upgraded Whisper models, simply switch to .proRepo in your initial configuration code:

let downloadURL = try await modelStore.downloadModel(
    name: "large-v3-v20240930_626MB",
-    repo: .openSourceRepo
+    repo: .proRepo
)