Metadata-Version: 2.4
Name: nozle-sdk
Version: 0.1.0
Summary: Nozle SDK — usage tracking, margin intelligence, and entitlement checks for AI billing
Author-email: Nozle <dev@nozle.ai>
License-Expression: AGPL-3.0-or-later
Project-URL: Homepage, https://nozle.ai
Project-URL: Repository, https://github.com/nozle-app/nozle-python
Project-URL: Issues, https://github.com/nozle-app/nozle-python/issues
Keywords: billing,usage-tracking,margin,ai,metering,entitlements
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28
Provides-Extra: openai
Requires-Dist: openai>=1.0; extra == "openai"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: requests-mock>=1.11; extra == "dev"
Dynamic: license-file

# Nozle

Python SDK for usage tracking, margin intelligence, and entitlement checks.

## Install

```bash
pip install nozle-sdk
```

## Quick Start

```python
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:

```python
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
```

## Optional: OpenAI Integration

```bash
pip install nozle-sdk-sdk[openai]
```

## License

AGPL-3.0-or-later
