Download missing assets and return the corresponding model.
model.unload() or leaving its with block
Release the model; keep cached assets.
delete_model_assets(model_id, ...)
Delete private assets; keep shared dependencies.
Loaders/downloads block until complete. Options are keyword-only: cache_dir, on_progress, and cancel_event (a threading.Event another thread can set). Cancellation is cooperative; the SDK never clears your event. Reuse the same cache_dir when loading, downloading, and deleting.
on_progress receives phases checking, downloading, loading, and ready. Download fields are downloaded_bytes, optional total_bytes, progress (0–1), bytes_per_second, and estimated_time_remaining_ms. Cached assets skip downloading; interrupted downloads retain resumable partial files.
Unload instances before deleting their assets. Files in use raise ModelAssetsInUseError; conflicting cross-process cache changes fail explicitly. Model IDs and capabilities are listed in the model catalog.
Download missing assets and return the corresponding model.
model.unload()
Release the instance and stop its operations; retain cached assets.
deleteModelAssets(id)
Delete this model's private assets; retain shared dependencies.
Load/download options include onProgress and an optional AbortSignal as signal. Aborting detaches that caller; another caller sharing the download can continue. Partial downloads are retained for resume. Deleting assets interrupts affected downloads/loads.
Progress phases are checking, downloading, loading, and ready. Verified cached assets skip downloading. Download events report aggregate downloadedBytes, and when known, totalBytes, progress (0–1), bytesPerSecond, and estimatedTimeRemainingMs. Loading progress is optional.
Separate loaded instances have separate ownership. Model IDs and available capabilities are listed in the model catalog.
App storage
Assets use app-private storage excluded from backups. There is no browser persistence option. Unloading and deleting cached files are separate operations.
Download missing assets and return the corresponding model.
model.unload()
Release the instance and stop its operations; retain cached assets.
deleteModelAssets(id)
Delete this model's private assets; retain shared dependencies.
Load/download options include onProgress and an optional AbortSignal as signal. Aborting detaches that caller; another caller sharing the download can continue. Partial downloads are retained for resume. Deleting assets interrupts affected downloads/loads.
Progress phases are checking, downloading, loading, and ready. Verified cached assets skip downloading. Download events report aggregate downloadedBytes, and when known, totalBytes, progress (0–1), bytesPerSecond, and estimatedTimeRemainingMs. Loading progress is optional.
Separate loaded instances have separate ownership. Model IDs and available capabilities are listed in the model catalog.
Browser storage
Load/download options also accept persistence: "auto" (default) requests persistent storage only in recognized browsers expected to decide silently; "request" allows a browser prompt; "off" skips the request. This applies to the website's origin, not one model. It does not disable caching or revoke an existing grant.
Persistence is best effort; browsers and users can still remove data. Storage failures reject rather than silently switching to memory-only downloads.