Thulean Tabular Foundation Model API
In-context classification and regression for structured tabular data with sub-second GPU inference. Upload a labeled training table once as a cached context, or send support + query tables together for one-shot prediction.
https://api.thulean.ai
Model: thulean-tfm-57m
Tasks: classification · regression
Wire formats: Arrow IPC · Parquet · CSV · JSON
- Stateful Contexts (recommended for production):
POST /v1/contextscaches your support table's KV state on GPU/disk. SubsequentPOST /v1/contexts/{id}/predictcalls skip fitting and score in milliseconds. - One-Shot Prediction:
POST /v1/predictaccepts both support and query tables in one call (zero disk persistence, ephemeral RAM cache).
Authentication & Daily Row Quotas
Pass your API key in the Authorization: Bearer <key> header on all /v1/* endpoints. Keys are strictly tenant-isolated: contexts created by one key are invisible to all other keys.
Each API key has a configurable predicted rows per UTC day quota (only query/scored rows count; uploading support contexts does not deduct daily rows) plus a per-minute request rate limit. Every response includes live quota headers:
| Header | Description |
|---|---|
X-RateLimit-Rows-Limit | Daily predicted-row quota for your key (or unlimited). |
X-RateLimit-Rows-Used | Predicted rows consumed today (UTC). |
X-RateLimit-Rows-Remaining | Remaining predicted rows before UTC midnight reset. |
X-RateLimit-Rows-Reset | Unix timestamp of the next UTC midnight quota reset. |
Retry-After | Seconds until retry when HTTP 429 is returned. |
Check your live quota at any time with GET /v1/usage (does not consume rows or wake the GPU).
Python SDK Quickstart
Install the lightweight Python client (no PyTorch required — uses zero-copy Apache Arrow IPC):
pip install git+https://github.com/Thulean-labs/thulean-api.git
Stateful Context (Fit Once, Predict Fast)
import os
import pyarrow.parquet as pq
from thulean_api import ThuleanClient
client = ThuleanClient(
base_url=os.environ.get("THULEAN_API_URL", "https://api.thulean.ai"),
api_key=os.environ["THULEAN_API_KEY"],
)
# 1. Check your daily row quota
print(client.usage())
# 2. Fit and cache support context (works with pandas, polars, pyarrow, dicts, or numpy)
train_df = pq.read_table("train.parquet")
test_df = pq.read_table("test.parquet").drop(["target"])
ctx = client.create_context(
train_df,
target="target",
task="classification", # or "regression"
preset="balanced", # "fast" (1), "balanced" (8), "best" (16)
context_id="my-model-v1",
ttl_seconds=86400, # cached up to 7 days
)
# 3. Predict in milliseconds over Arrow IPC
pred = ctx.predict(test_df, return_probabilities=True)
print("Predictions:", pred.predictions[:5])
print("Classes:", pred.classes)
print(f"Latency: {pred.predict_ms:.1f} ms")
# 4. Clean up when done
ctx.delete()
One-Shot Prediction
pred = client.predict(
support=train_df,
query=test_df,
target="target",
task="regression",
preset="balanced",
)
print(pred.predictions[:5])
cURL / HTTP Examples
Check Quota & Auth
curl -s "https://api.thulean.ai/v1/usage" \
-H "Authorization: Bearer $THULEAN_API_KEY" | jq
One-Shot JSON Prediction
curl -s -X POST "https://api.thulean.ai/v1/predict" \
-H "Authorization: Bearer $THULEAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"task": "classification",
"target": "default",
"preset": "fast",
"support": {
"columns": {
"age": [34, 51, 27, 45, 23, 60],
"income": [62000, 95000, 41000, 78000, 32000, 120000],
"home": ["rent", "mortgage", "rent", "own", "rent", "own"],
"default": ["no", "no", "yes", "no", "yes", "no"]
}
},
"query": {
"columns": {
"age": [29, 55],
"income": [48000, 110000],
"home": ["rent", "own"]
}
}
}' | jq
Endpoints
| Endpoint | Purpose |
|---|---|
GET/healthz | Liveness probe (public). |
GET/readyz | Readiness probe (public). |
GET/v1/usage | Current key's daily row quota, remaining rows, UTC reset time, and 14-day history. |
GET/v1/models | Logical model metadata, active presets, and guardrails. |
POST/v1/contexts | Fit & cache a support table. Returns 201 Created (or 409 if duplicate unless overwrite=true). |
GET/v1/contexts | List cached contexts owned by your API key. |
GET/v1/contexts/{id} | Inspect a cached context's metadata. |
POST/v1/contexts/{id}/predict | Score query rows against a cached context. Deducts query rows from daily quota. |
DELETE/v1/contexts/{id} | Delete a cached context from memory and persistent storage. |
POST/v1/predict | Stateless one-shot prediction (JSON or multipart Arrow/Parquet/CSV). |
Data Formats & Limits
Send tables as Apache Arrow IPC (application/vnd.apache.arrow.stream, fastest), Parquet (application/vnd.apache.parquet), CSV (text/csv), or JSON (application/json). Request Accept: application/vnd.apache.arrow.stream for zero-copy binary predictions with exact class types preserved.
- Max HTTP body: 64 MiB
- Max support rows: 200,000 · Max query rows per call: 100,000
- Max features: 2,000 · Max table cells: 10,000,000
- Temporal/timestamp columns should be converted to numeric features (e.g. epoch seconds, day-of-week) before sending.
Presets & Ensemble Size
| Preset | Members | Best For |
|---|---|---|
fast | 1 | Ultra-low latency interactive scoring and prototyping. |
balanced | 8 | Default production trade-off between accuracy and speed. |
best | 16 | Maximum accuracy on complex or noisy tabular datasets. |
Error & Quota Codes
| Status | error_type | Meaning |
|---|---|---|
401 | — | Missing, invalid, revoked, or expired Bearer API key. |
404 | context_not_found | Context does not exist, expired, or belongs to a different key. |
409 | context_conflict | context_id already exists; pass overwrite=true to replace. |
413 | payload_too_large | Request exceeds 64 MiB body limit. |
422 | codec_error / schema_error | Malformed payload, missing feature columns, or table limits exceeded. |
429 | daily_row_quota_exceeded | Daily predicted-row limit reached; resets at X-RateLimit-Rows-Reset (UTC midnight). |
429 | rate_limit_exceeded | Per-minute request limit exceeded; retry after Retry-After seconds. |