Initialize:
from nozle import Nozle
nozle = Nozle(
api_key="sk_live_...",
base_url="https://api.nozle.app",
events_url="https://api.nozle.app",
timeout=10, # seconds (default: 10)
)
Parameters
- api_key (
str, required): Your secret key (sk_)
- base_url (
str, default: "http://localhost:8080"): Nozle API URL
- events_url (
str, default: "http://localhost:3000"): Events ingestion URL (Lago)
- timeout (
int, default: 10): Request timeout in seconds
Available methods
Core
nozle.track() — send usage events
nozle.can() — check entitlements
nozle.ping() — health check
Billing
nozle.plans() — list available plans
nozle.checkout() — create Stripe checkout session
nozle.subscribe() — create a subscription
Customers & Credits
nozle.customers.upsert() — create or update a customer
nozle.check_and_deduct() — atomically check and deduct wallet credits
LLM Auto-Capture
wrap_openai() — wrap OpenAI client for automatic token tracking
wrap_anthropic() — wrap Anthropic client for automatic token tracking
Margin Intelligence
nozle.margin.summary() / by_customer() / by_metric() / by_plan() / by_model() / trend()
The Python SDK mirrors the Node.js SDK’s API surface exactly.
Use sk_ (secret) keys only. This SDK is for server-side use.