SDKsPython SDK
Installation
Install and configure the Nozle Python SDK
pip install nozle-sdkInitialize:
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 eventsnozle.can()— check entitlementsnozle.ping()— health check
Billing
nozle.plans()— list available plansnozle.checkout()— create Stripe checkout sessionnozle.subscribe()— create a subscription
Customers & Credits
nozle.customers.upsert()— create or update a customernozle.check_and_deduct()— atomically check and deduct wallet credits
LLM Auto-Capture
wrap_openai()— wrap OpenAI client for automatic token trackingwrap_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.