API reference

Inference

Inference dispatches from the model's stored modality and task. Text models accept JSON or text fields; image models use multipart file uploads.

Input formats

curl "$FLASHML_BASE_URL/v1/models/$MODEL_ID/infer" \
  -H "Authorization: Bearer $FLASHML_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"FlashML is ready for production."}'
curl "$FLASHML_BASE_URL/v1/models/$MODEL_ID/infer" \
  -H "Authorization: Bearer $FLASHML_API_KEY" \
  -F "file=@./image.png"

Response shapes

// Text or image classification
{
  "model": "model.onnx",
  "version": "1",
  "predictions": [
    { "label": "positive", "confidence": 0.9821 },
    { "label": "negative", "confidence": 0.0179 }
  ],
  "top_result": {
    "label": "positive",
    "confidence": 0.9821
  }
}
// Text embedding
{
  "model": "model.onnx",
  "version": "1",
  "embedding": [0.012, -0.044, 0.301],
  "embedding_shape": [1, 384]
}

Object detection example

curl "$FLASHML_BASE_URL/v1/models/$MODEL_ID/infer" \
  -H "Authorization: Bearer $FLASHML_API_KEY" \
  -F "file=@./street.png"
{
  "model": "model.onnx",
  "version": "1",
  "image_size": { "width": 1280, "height": 720 },
  "detections": [
    {
      "label": "person",
      "confidence": 0.9342,
      "box": [312.4, 118.7, 421.9, 642.3]
    },
    {
      "label": "car",
      "confidence": 0.8815,
      "box": [744.0, 330.5, 1004.2, 563.8]
    }
  ],
  "num_detections": 2,
  "predictions": [
    {
      "label": "person",
      "confidence": 0.9342,
      "box": [312.4, 118.7, 421.9, 642.3]
    },
    {
      "label": "car",
      "confidence": 0.8815,
      "box": [744.0, 330.5, 1004.2, 563.8]
    }
  ]
}

Detection boxes are returned as [x1, y1, x2, y2] pixel coordinates in the original uploaded image.

POST/v1/models/{model_id}/infer

Run inference

Runs the matching pipeline for the model's stored modality and task. Image models require a file; text models accept JSON, form text, or a UTF-8 text file.

Request

curl https://api.flashml.dev/v1/models/6f2c8d9a-2e8d-4ed3-b9f2-9f3d2d2d7e8f/infer \
  -H "Authorization: Bearer $FLASHML_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"The checkout flow was fast and reliable."}'

Response

{
  "model": "model.onnx",
  "version": "1",
  "predictions": [
    { "label": "positive", "confidence": 0.9821 },
    { "label": "negative", "confidence": 0.0179 }
  ],
  "top_result": {
    "label": "positive",
    "confidence": 0.9821
  }
}