Nozle SDK — usage tracking, margin intelligence, and entitlement checks for AI billing
Project description
Nozle
Python SDK for usage tracking, margin intelligence, and entitlement checks.
Install
pip install nozle-sdk
Quick Start
from nozle import Nozle
client = Nozle(
api_key="your-api-key",
base_url="https://api.your-domain.com",
events_url="https://events.your-domain.com",
)
# Track usage events
client.track("customer_123", "api_call", metadata={"model": "gpt-4", "tokens": 1500})
# Check feature entitlements
result = client.can("customer_123", "advanced_analytics")
# Margin intelligence
summary = client.margin.summary()
by_customer = client.margin.by_customer()
by_model = client.margin.by_model()
trend = client.margin.trend(granularity="day")
Margin Intelligence
The margin client exposes several views into your cost and revenue data:
client.margin.summary() # overall margin summary
client.margin.by_customer() # margin broken down by customer
client.margin.by_metric() # margin broken down by billable metric
client.margin.by_plan() # margin broken down by plan
client.margin.by_model() # margin broken down by AI model
client.margin.trend(granularity="day") # margin trend over time
Plans & Checkout
# List available plans
plans = client.plans()
# Create checkout session (returns Stripe client_secret)
result = client.checkout("customer_123", "pro")
# result = { "client_secret": "...", "invoice_id": "...", "amount_cents": 2900, "currency": "USD" }
# With success URL
result = client.checkout("customer_123", "pro", success_url="https://example.com/done")
# Create subscription after payment
result = client.subscribe("customer_123", "pro")
# result = { "subscription_id": "...", "status": "active" }
Optional: OpenAI Integration
pip install nozle-sdk[openai]
License
AGPL-3.0-or-later
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nozle_sdk-0.2.0.tar.gz.
File metadata
- Download URL: nozle_sdk-0.2.0.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75f00b5d7bbe6f2f7fa7cefba86d8a466a9a086490090ca59489628803caff70
|
|
| MD5 |
a67ffbf234a8f14c32e5ff39b74625d2
|
|
| BLAKE2b-256 |
c8e1af13fc8a1eba1fc0587618639e92d498114f27fd54402f34c1a74c049d0e
|
Provenance
The following attestation bundles were made for nozle_sdk-0.2.0.tar.gz:
Publisher:
publish.yml on nozle-dev/nozle-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nozle_sdk-0.2.0.tar.gz -
Subject digest:
75f00b5d7bbe6f2f7fa7cefba86d8a466a9a086490090ca59489628803caff70 - Sigstore transparency entry: 1659825101
- Sigstore integration time:
-
Permalink:
nozle-dev/nozle-python@6c3e47c2749db5a75027d5eb229735313fd3b2b1 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/nozle-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6c3e47c2749db5a75027d5eb229735313fd3b2b1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nozle_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: nozle_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08145022488bd2a7b00fbe004fda7ba69432e09047d029783a35993882f5995e
|
|
| MD5 |
2fccd29e5843a5929e8a0065e7eceb34
|
|
| BLAKE2b-256 |
09b2359a09ad51758d9fd241d0148e56c81e065b8a4e28b3cb7c739cffcb83a6
|
Provenance
The following attestation bundles were made for nozle_sdk-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on nozle-dev/nozle-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nozle_sdk-0.2.0-py3-none-any.whl -
Subject digest:
08145022488bd2a7b00fbe004fda7ba69432e09047d029783a35993882f5995e - Sigstore transparency entry: 1659825237
- Sigstore integration time:
-
Permalink:
nozle-dev/nozle-python@6c3e47c2749db5a75027d5eb229735313fd3b2b1 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/nozle-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6c3e47c2749db5a75027d5eb229735313fd3b2b1 -
Trigger Event:
push
-
Statement type: