Downloading a model
Pull a whole version, a single file, or stream bytes — with resume and checksum verification.
Download a whole version#
python
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Use latest to always get the newest semantic version:
python
1 | |
Download a single file#
python
1 2 3 4 5 6 | |
Stream without touching disk#
python
1 2 3 4 5 | |
Progress reporting#
python
1 2 3 4 5 6 7 8 | |
Downloading a specific variant#
By default you get the primary variant. To pull a conversion (e.g. the GGUF build),
target it over REST with the variant query parameter:
bash
1 | |
List variants first to see what's available and available:
python
1 2 | |
How resume + verification behave#
- Resume (
resume=True): if a partial file exists, the client issues aRangerequest and appends from the last byte. A fully-present file whose checksum already matches is skipped. - Verification (
verify_checksum=True, the default): after writing, the client recomputes SHA-256 and compares against the registry's value. On mismatch it raisesChecksumErrorcarryingexpectedandactual.
Errors to handle#
| Exception | When |
|---|---|
NotFoundError |
Namespace, model, version, variant, or file doesn't exist. |
AuthorizationError |
You lack download permission on the namespace. |
ChecksumError |
Downloaded bytes don't match the recorded checksum. |
DownloadError |
Transfer failed (network, storage). |
python
1 2 3 4 5 6 7 8 | |
Under the hood (REST)#
GET …/versions/{version}/download— file metadata + URLs (optionalvariant,file).GET …/versions/{version}/download/files/{path}— streamed bytes,Range-aware (206 Partial Content,X-Checksum-SHA256,Accept-Ranges: bytes).
Downloads require the namespace DOWNLOAD permission and the version to be in an
available/ready state.