This page was auto-generated by OpenAI's GPT5.5. We are refining it to make it more helpful.
Lifecycle
let llm = PrimordialClient().localLLM()
try await llm.download()
try await llm.load()
try await llm.downloadAndLoad()
Storage Options
The default check requires enough space for remaining download bytes plus
a safety margin. Customize or disable it with PrimordialDownloadOptions.
let options = PrimordialDownloadOptions(
storageSafetyMarginFraction: 0.15,
minimumStorageSafetyMarginBytes: 512 * 1024 * 1024
)
try await llm.download(options: options)
try await llm.download(options: .withoutStorageCheck)
Progress
try await llm.download { progress in
print(progress.fractionCompleted)
print(progress.status)
print(progress.currentFilename ?? "")
print(progress.downloadedBytes)
print(progress.totalBytes ?? 0)
print(progress.currentFileDownloadedBytes)
print(progress.currentFileTotalBytes ?? 0)
print(progress.bytesPerSecond ?? 0)
}
totalBytes and currentFileTotalBytes are optional.
Use an indeterminate UI when totals are unavailable.
Cancel, Resume, Cleanup
let task = Task {
try await llm.download()
}
task.cancel()
let downloaded = await llm.isDownloaded
let bytes = try await llm.downloadedModelSize()
try await llm.removeDownloadedModel()
Starting download() again reuses valid cached state and resumes
supported partial transfers.
Voice Models
let models = PrimordialClient().voiceModelManager()
try await models.download { progress in
print(progress.fractionCompleted)
print(progress.phase)
}
try await models.load()
Voice progress is coarser than local LLM progress and does not currently include filename, byte totals, per-file bytes, or transfer speed.