Skip to content
Docs
Join the API waitlist

Quickstart

Use an existing API key to make one classification request and understand the returned predictions and metadata.
On this page

1 Prepare an API key

The Causilo API is in early access. Join the waitlist and we will send you an invitation. These examples require an API key.

Keep your key in your environment; never put a real key in a shared script or notebook.

Set your API keyBASH
export CAUSILO_KEY='csl_...'

2 Install the Python client

Use Python 3.11 or later.

Install the clientBASH
pip install causilo-client

3 Send context and query tables

Save the complete example as first_call.py. It sends three context rows and two query rows, with two feature columns. The renewed target belongs only to the context.

first_call.pyPYTHON
import os
import pandas as pd
from causilo_client import Causilo

cx = Causilo("https://api.nums.world", token=os.environ["CAUSILO_KEY"])
context = pd.DataFrame({
    "region": ["EU", "US", "EU"],
    "spend": [120.0, 340.0, 0.0],
    "renewed": ["yes", "yes", "no"],
})
query = pd.DataFrame({
    "region": ["EU", "US"],
    "spend": [200.0, 50.0],
})
prediction, metadata = cx.predict_with_metadata(
    context, query, target="renewed",
    model="causilo-clf", output_type="preds",
)
print(prediction)
print(metadata.get("quota"))
Run the exampleBASH
python first_call.py

4 Read the result

predict_with_metadata returns (prediction, metadata). This example asks for output_type="preds", so classification returns one class label per query row. It prints your live answer; no output values are invented here.

Quickstart: table 1
ValueWhat to read
predictionOne entry for each query row, in query order.
metadata.quotaPresent only when the request was charged: the cap that will stop this credential first, with what is used and when it resets. Read it with metadata.get("quota"), which gives None when it is absent.
metadata.served_byThe serving image, checkpoint and ensemble width. Compare this before comparing predictions across runs.

For the established six-row input, see the original first-call example in the Cookbook.