Guides

Upload models

Uploads are split into API reservation and direct object storage transfer, which keeps large model files out of the API process.

Workflow

1. Package

Create one .tar.gz bundle with the ONNX model, preprocess.json, and any task-specific labels or tokenizer files.

2. Reserve

Call POST /v1/models/uploads with filename, modality, task, and optional size_bytes to reserve a version and receive upload_url.

3. Transfer

PUT the tarball directly to upload_url within 300 seconds. Do not include your FlashML API key in the S3 request.

4. Validate

Call POST /v1/models/uploads/{upload_id}/complete. FlashML checks the object, validates bundle contents, and creates the model.

Reserve upload

curl "$FLASHML_BASE_URL/v1/models/uploads" \
  -H "Authorization: Bearer $FLASHML_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "sentiment-classifier.tar.gz",
    "modality": "text",
    "task": "classification",
    "size_bytes": 44040192
  }'

Transfer and complete

curl -X PUT "$UPLOAD_URL" \
  --upload-file ./sentiment-classifier.tar.gz

curl -X POST "$FLASHML_BASE_URL/v1/models/uploads/$UPLOAD_ID/complete" \
  -H "Authorization: Bearer $FLASHML_API_KEY"

Upload statuses are pending_upload, uploaded, validating, validated, failed, and expired.

Model records are created only after validation succeeds. A returned model with status: validated is ready for inference; validation failures stay on the upload record as status: failed with an error message.

Once completion returns validated, there is no separate deployment step. Use the returned model ID with the inference endpoint right away.