1 Prepare an API key
Dashboard access is coming soon. These examples require an existing API key. For access questions, contact api@nums.world.
Keep your key in your environment; never put a real key in a shared script or notebook.
Set your API key
export CAUSILO_KEY='csl_...'
2 Install the Python client
Use Python 3.11 or later.
Install the client
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.py
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["quota"])
Run the example
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.
| Value | What to read |
|---|---|
prediction | One entry for each query row, in query order. |
metadata.quota | Usage and allowance information for this credential. |
metadata.served_by | The 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.