Uploading a model
The full path from "nothing" to a downloadable version, with the Python SDK.
Prerequisites#
- Write access to the namespace (role member or higher — see Authentication).
- The files you want to publish, locally.
1. Make sure the model exists#
Models are created once; versions are added over time. type is required.
1 2 3 4 5 6 7 8 9 10 11 | |
If it already exists you'll get a ConflictError — safe to ignore or catch.
2. Upload a version#
The upload session creates the version in uploading state, streams each file in
checksum-verified chunks, and finalizes it on complete():
1 2 3 4 5 6 7 8 9 10 11 12 | |
Add a whole directory instead of listing files:
1 2 3 4 | |
Progress reporting#
1 2 3 4 5 6 7 8 9 10 | |
If something goes wrong#
The session is a context manager: if an exception propagates out of the with
block before complete(), the upload is aborted and server-side state is cleaned
up automatically. You can also call up.abort() explicitly.
versionstring must be semver (1.0.0,2.1.0-beta.1) or you'll get aValidationError.formatmust be a supported format (GET /api/v1/options/formats) or the create step returns400.- Re-using an existing version string returns a
ConflictError.
Async note: upload and download are synchronous-only helpers.
AsyncScaiAtlasexposesnamespaces,models,versions,variants, andsearch, but notupload/download. Run transfers with the sync client (e.g. in a thread executor).
3. Add format variants (optional)#
Request an alternative representation of the version — e.g. a GGUF quantization:
1 2 3 4 5 6 | |
This returns immediately (the server accepts the request and converts asynchronously:
pending → converting → available). List variants to check status:
1 2 | |
4. Manage the version later#
1 2 3 4 5 6 7 | |
Under the hood (REST)#
The session maps onto these calls, which you can drive directly in any language:
POST /api/v1/namespaces/{ns}/models/{model}/versions— create (statusuploading).POST …/versions/{version}/upload/init— per file: returnsupload_id,part_size,part_count.PUT …/upload/{upload_id}/parts/{n}— push each chunk, collectetags.POST …/upload/{upload_id}/complete— assemble and verify.
See the REST API reference for exact schemas.