Skip to main content
The platform client: sign in, push traces, read the account. 12 public names. import whileai, then whileai.name.

auth

Sign in or sign up from a terminal or a coding agent.

LoginError

Unspecified run-time error.

account

Tier, limits and today’s usage for the key in use (GET /me). tier is "trial" for an account made by signup that has not signed in yet; trial["lift"] says how to lift it.

login

Run the device login. Returns the API key, or None if still pending. wait=False prints the link and returns at once; run again to finish. timeout caps the wait in seconds (default: until the code expires).

logout

Delete the saved credentials. Returns whether anything was removed.

resolve_api_key

explicit > WHILEAI_API_KEY > the saved credentials file.

signup

Create an account for email and save its API key. Returns the key. No browser and no password: the person opens the dashboard later by signing in with an email code. Raises LoginError if the address already has an account (run login instead).

ingest

OTLP trace ingest for the While token gate.

WhileIngestError

Raised when the gate rejects a trace batch.

ZeroProofIngestError

Raised when the gate rejects a trace batch.

ingest_traces

Push a local OTLP batch file end to end and return \{datasetId, dataset, rows\}. dataset overrides the dataset name by setting the dataset resource attribute on every resourceSpan, which requires reading the batch; leave it unset to send the bytes untouched.

list_traces

What this key’s account has ingested: one entry per dataset name per day, with row counts and sizes, plus the account totals. for t in list_traces()[“traces”]: print(t[“name”], t[“rows”], t[“sizeBytes”]) api_key resolves like every other platform call: the argument, then WHILEAI_API_KEY, then the key whileai login saved.

otel_env

Environment for an OpenTelemetry OTLP/HTTP exporter. The exporter sends the batch body itself and forwards OTEL_EXPORTER_OTLP_HEADERS as request headers, so the key reaches the gate. http/json is required: the gate parses the OTLP JSON wire format and answers protobuf batches with a 415.

send_traces

POST one OTLP/HTTP JSON batch (raw or gzipped) and return the 202 body.