Quickstart

Quickstart

Install the SDK

pip install cci-sdk

The package installs the cli_sdk Python module, the offline statistics engine cli_sdk.stats, local mode (cli_sdk.local), and the cli command-line tool.

Create an API key

Sign in to the dashboard at https://cci.gitdate.ink, open API keys, and create a key. Keep the default scopes, evaluate and profiles:write. The key is shown once:

export CLI_API_KEY=cci_live_...

To use a self-hosted deployment instead, also set CLI_BASE_URL. No key is required when CLI_BASE_URL points at localhost.

Add a provider connection

The hosted service calls your model provider with your key. Open Provider connections, add an OpenAI connection with your OpenAI API key, and select Test. The key is encrypted and never shown again; it becomes the default OpenAI connection, which every OpenAIBackend uses unless it names another. See Provider connections for Anthropic, Gemini, Vertex AI, Azure OpenAI, Bedrock, OpenRouter and self-hosted vLLM or SGLang.

Without a connection, the first evaluate fails with 422 connection_required. To try the service without any provider key, use your own model through a CustomBackend.

Create a calibration profile

Every query needs a named, labelled calibration profile, and a profile calibrates exactly one query definition. Create one and add examples:

from cli_sdk import CLIClient, OpenAIBackend
 
backend = OpenAIBackend(model="gpt-4.1-2025-04-14")
 
with CLIClient() as client:
    client.calibration_profiles.create(
        name="support-routing-v1",
        backend=backend,
        method="APS",
        alpha=0.10,
    )
    profile = client.calibration_profiles.add_examples(
        "support-routing-v1",
        examples=[
            {"context": {"ticket": "I was charged twice."}, "label": "billing"},
            {"context": {"ticket": "Your app crashes on launch."}, "label": "technical"},
            # ... a few hundred to a few thousand more
        ],
    )
    print(profile.status)    # "collecting": examples are stored, not scored yet

See Calibration profiles for sizing: CLI refuses to serve a guarantee below n≥(1−α)/αn \ge (1-\alpha)/\alpha examples (9 at α=0.10\alpha = 0.10) and recommends roughly 1,000 for a stable α=0.10\alpha = 0.10 guarantee.

Ask a guaranteed question

from cli_sdk import CLIClient, OpenAIBackend, Set
 
DEPARTMENTS = {
    "billing": "Payments, invoicing, refunds",
    "technical": "Bugs, outages, integrations",
    "sales": "Pricing, upgrades, new accounts",
}
DEPARTMENT = Set(
    instructions="Which team should handle this ticket?",
    options=DEPARTMENTS,
    calibration_profile="support-routing-v1",
    alpha=0.10,
)
 
with CLIClient() as client:
    result = client.evaluate(
        context={"ticket": "I was charged twice for order A-104."},
        backend=OpenAIBackend(model="gpt-4.1-2025-04-14"),
        queries={"department": DEPARTMENT},
    )
 
answer = result.answers["department"]
print(answer.set)                    # e.g. ['billing']
print(answer.guarantee.alpha)        # 0.1
print(answer.guarantee.calibration_n)
print(answer.guarantee.describe())
print(result.request_id)             # req_..., the trace in the dashboard

The first evaluate that names the profile binds it to this query and backend, and scores the stored examples. When that takes at most 200 model calls it happens inside the request. With more examples it runs as a background job: until the job finishes, answers come back heuristic (HTTP 424, which the SDK returns rather than raises) with a warning naming the job. Wait for the profile to serve before you rely on it:

import time
 
def wait_until_serving(client, name, every_s=10, timeout_s=3600):
    deadline = time.monotonic() + timeout_s
    while True:
        profile = client.calibration_profiles.get(name)
        if profile.status == "serving":
            return profile
        if time.monotonic() > deadline:
            raise TimeoutError(f"{name} is still {profile.status}")
        time.sleep(every_s)
 
with CLIClient() as client:
    profile = wait_until_serving(client, "support-routing-v1")
    print(profile.n, profile.realized_coverage_ci)

Give every option a short description. A None description is sent as null and works, but a few words usually help the backend score the options. The options, the instructions and the query type are part of what the profile calibrates: to ask a different question, create a new profile, or the service answers 422 query_mismatch.

Act on the guarantee, not the number

if answer.is_heuristic:
    route_to_human(answer.set)            # no formal guarantee yet
elif answer.is_singleton:
    route_automatically(answer.top)
else:
    route_to_human(answer.set)

The 90% guarantee is about the set: over exchangeable tickets, the set contains the correct team at least 90% of the time. It is marginal over all tickets and not conditional on the set’s size, so the error rate among tickets that happen to get a singleton set is not bounded by 10%. A singleton is a useful signal, but to bound the error rate of the tickets you route automatically, gate the auto-route with Gate(guarantee="fdr") on its own profile, as in the support routing guide.

See the request in the dashboard

Open Observability > Requests. Every call above is there, newest first; paste result.request_id into the search box to open its trace: the backend and connection that served it, how the profile was resolved, each model call with its tokens and latency, the conformal statistic, and the guarantee card. A 424 shows which answers were heuristic and why. See Observability.

Next

  • Exchangeability: the one assumption every guarantee rests on.
  • Primitives: all seven query types.
  • Calibration profiles: the profile lifecycle, jobs and backend changes.
  • Hosted API: keys and scopes, limits, idempotency and jobs.
  • Guides: end-to-end walkthroughs, from support routing to air-gapped calibration.
  • Backends: OpenAI, Azure OpenAI, Anthropic Claude, Gemini, Vertex AI, Bedrock, OpenRouter, vLLM, SGLang, or your own model.