Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nozle_sdk-0.2.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nozle_sdk-0.2.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

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

Hashes for nozle_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 75f00b5d7bbe6f2f7fa7cefba86d8a466a9a086490090ca59489628803caff70
MD5 a67ffbf234a8f14c32e5ff39b74625d2
BLAKE2b-256 c8e1af13fc8a1eba1fc0587618639e92d498114f27fd54402f34c1a74c049d0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nozle_sdk-0.2.0.tar.gz:

Publisher: publish.yml on nozle-dev/nozle-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for nozle_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08145022488bd2a7b00fbe004fda7ba69432e09047d029783a35993882f5995e
MD5 2fccd29e5843a5929e8a0065e7eceb34
BLAKE2b-256 09b2359a09ad51758d9fd241d0148e56c81e065b8a4e28b3cb7c739cffcb83a6

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page