Get started

Quickstart

Create an API key, upload a versioned model bundle through a presigned URL, then use the returned model ID for inference.

Want the full path?

The Colab walkthrough trains a tiny text classifier, exports it to ONNX, writes preprocess.json, packages a .tar.gz bundle, uploads it to FlashML, and calls inference with the returned model ID.

Set environment variables

export FLASHML_API_KEY="flashml_sk_..."
export FLASHML_BASE_URL="https://api.flashml.dev"

Reserve an 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
  }'
{
  "upload_id": "upl_ZdvJxLqgP6QeVnkn8SLcWg",
  "status": "pending_upload",
  "model_key": "user-id/sentiment-classifier-v1.tar.gz",
  "version": 1,
  "upload_url": "https://...",
  "expires_in": 300,
  "expires_at": "2026-05-21T16:48:03.120000+00:00",
  "method": "PUT"
}

Response fields

Save upload_id and upload_url. The upload URL expires after 300 seconds and is used only for the object storage PUT request.

Upload and validate

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"
{
  "status": "validated",
  "upload": {
    "id": "upl_ZdvJxLqgP6QeVnkn8SLcWg",
    "status": "validated",
    "model_id": "6f2c8d9a-2e8d-4ed3-b9f2-9f3d2d2d7e8f"
  },
  "model": {
    "id": "6f2c8d9a-2e8d-4ed3-b9f2-9f3d2d2d7e8f",
    "name": "sentiment-classifier",
    "modality": "text",
    "task": "classification",
    "version": 1,
    "status": "validated"
  }
}

Completion validates the tarball contents, creates the model record, and returns the model ID to use for inference requests. If the response model has status: validated, it is ready to infer immediately.

Run inference

export FLASHML_MODEL_ID="6f2c8d9a-2e8d-4ed3-b9f2-9f3d2d2d7e8f"

curl "$FLASHML_BASE_URL/v1/models/$FLASHML_MODEL_ID/infer" \
  -H "Authorization: Bearer $FLASHML_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"The checkout flow was fast and reliable."}'
{
  "model": "model.onnx",
  "version": "1",
  "predictions": [
    { "label": "positive", "confidence": 0.9821 },
    { "label": "negative", "confidence": 0.0179 }
  ],
  "top_result": {
    "label": "positive",
    "confidence": 0.9821
  }
}