Skip to content
Docs

Cookbook

Choose a task and run a complete script. Each example preserves the stdout recorded against the live API; it is a record, rather than a promised result for your next call.

Choose a task

The scripts read your key from CAUSILO_KEY. CAUSILO_ENDPOINT overrides the API address. Start with the Quickstart for one minimal call, or inspect the API reference for exact request and response fields.

Original first-call example

You need an existing API key. See API access for availability and support. Install the Python client and pass the key to it:

TerminalBASH
pip install causilo-client
Python
import pandas as pd
from causilo_client import Causilo

cx = Causilo("https://api.nums.world", token="csl_...")

context = pd.DataFrame({
    "region":   ["EU", "EU", "US", "US", "APAC", "APAC"],
    "plan":     ["pro", "free", "pro", "free", "pro", "free"],
    "spend":    [120.0, 0.0, 340.0, 12.0, 90.0, 4.0],
    "renewed":  ["yes", "no", "yes", "no", "yes", "no"],
})
query = pd.DataFrame({
    "region": ["EU", "APAC"],
    "plan":   ["pro", "free"],
    "spend":  [200.0, 1.0],
})

print(cx.predict(context, query, target="renewed", model="causilo-clf"))

The quickstart makes the same kind of call on a real dataset for both classification and regression and shows the output it produced.