Skip to Content
UsageMax Docs

Python SDK

Install the UsageMax Python client to read usage, send telemetry, and report on gateway receipts.

Install usagemax on PyPI with Python 3.10 or later.

pip install usagemax

Read public usage

from usagemax import UsageMax

usage = UsageMax()
print(usage.health()["ok"])
print(usage.stats()["stats"])

Use profile(handle) for an opt-in public profile and daily_usage(handle, days=30) for daily totals. If a breakdown reaches the summary limit, call daily_detail() with a date range and pass each continueCursor back as cursor until isDone is true.

Connect a gateway or collector

ClientAuthenticationOperations
GatewayClientProject report keystatus(), receipts(), receipt(), operations()
GatewayClientProject ingest keystatus(), write_receipts()

Starting with version 0.1.1, use evals() with a project report key and publish_eval() with a project ingest key. See Hosted evaluation runs for the report format. | CollectorClient | Collector key and stable installation UUID for writes | status(), send_events(), send_traces() |

Pass keys from your server's secret manager. Reuse the original receipt fields and revision or the original telemetry idempotency key and payload when retrying. The client exposes HTTP status and retry information through APIError and reports network failures through TransportError.

For setup and payloads, see Gateway receipts, Telemetry ingestion, and the Python SDK examples.

On this page