TensorTurn Prediction API: POST /predict Reference
TensorTurn deployed models expose a single prediction endpoint: POST /predict. Authenticate with a Bearer API key in the Authorization header, send your input in the JSON body, and receive the model's prediction as JSON. The endpoint is created when you flip on deployment for a model, runs on Modal with scale-to-zero, and serves YOLO, scikit-learn, PyTorch, ONNX, and Keras models. Each call is logged and consumes credits.
When you deploy a model in TensorTurn, its best weights are served behind an authenticated HTTPS endpoint. This reference covers authentication, the request and response shape, supported model formats, and a copy-paste cURL example. The in-app inference playground also generates equivalent snippets for cURL, JavaScript, Python, and Rust, pre-filled for your specific deployment.
Authentication
Every request must include a Bearer API key in the Authorization header: Authorization: Bearer <YOUR_API_KEY>. Keys are issued per deployment and stored server-side as a SHA-256 hash, so the raw key is shown once — keep it safe. A missing or invalid key is rejected with a 401 before any inference runs.
Endpoint
POST /predict — send a JSON body and get a JSON prediction back. The endpoint scales to zero on Modal when idle, so the first request after a period of inactivity may incur a short cold start while the container spins up; subsequent requests are served warm.
Request
Send Content-Type: application/json alongside the Authorization header. The body carries your input: for tabular models, the feature values for one or more rows; for image models (for example YOLO), the image as the deployment expects it. The inference playground shows the exact body shape for your specific deployed model.
Response
The response is JSON containing the model's output — for tabular models a predicted class or value (and probabilities where the model provides them), and for image models the detections or classification the model returns. Errors come back with an appropriate HTTP status: 401 for a missing or invalid API key, and 4xx for a malformed body.
Example request (cURL)
curl -X POST https://<your-deployment>.tensorturn.com/predict -H "Authorization: Bearer $TENSORTURN_API_KEY" -H "Content-Type: application/json" -d '{"inputs": [{"feature_1": 3.2, "feature_2": "blue", "feature_3": 18}]}' — Replace the host with your deployment's URL and the body with your model's expected fields. The inference playground generates this exact snippet, pre-filled for your model, along with JavaScript, Python, and Rust equivalents.
Supported model formats
- YOLO / Ultralytics
- scikit-learn
- PyTorch
- ONNX
- Keras
Credits and logging
Each call to /predict consumes credits from your account and is recorded in per-call logging, so you can see request volume and usage over time. How many calls you can make ties back to your plan: Free has a limited allowance and one deployment, Pro adds premium usage (5x) and multiple deployments, and Annual adds unlimited deployments. Because the endpoint scales to zero, you don't pay to keep an idle model warm.
Frequently asked questions
How do I authenticate to the prediction API?
Send an Authorization: Bearer <API_KEY> header with every POST /predict request. Keys are per deployment and stored as SHA-256 hashes, so copy your key when it's first shown.
What model formats can I deploy behind /predict?
YOLO/Ultralytics, scikit-learn, PyTorch, ONNX, and Keras models are all servable through the deployed endpoint.
Does each prediction cost credits?
Yes. Every /predict call consumes credits and is logged per call. Your plan sets the usage allowance — Free is limited, Pro adds 5x usage, and Annual adds unlimited deployments.
Why is my first request slow?
Deployed endpoints scale to zero on Modal when idle, so the first request after inactivity can hit a short cold start. Following requests are served warm.
Can I get code in languages other than cURL?
Yes. The inference playground generates ready-to-use snippets for cURL, JavaScript, Python, and Rust, pre-filled for your specific deployment.
What happens if my API key is wrong?
The request is rejected with a 401 before any inference runs. Rotate to a valid key from your deployment settings.