SDKs
SDK Overview
Nozle SDK ecosystem for React, Node.js, and Python
Nozle provides three SDKs that all connect to the Nozle API at api.nozle.app.
| SDK | Package | Version | Purpose |
|---|---|---|---|
| React | @nozle-js/react | 0.5.0 | 25 drop-in billing components + hooks |
| Node.js | @nozle-js/node | 0.2.0 | Server-side billing, event tracking, LLM auto-capture, margin queries |
| Python | nozle-sdk | 0.2.0 | Server-side billing, event tracking, LLM auto-capture, margin queries |
When to use which
- React -- Client-side billing UI (pricing tables, checkout, usage meters, feature gates)
- Node.js -- Server-side in Node/TypeScript apps (track events, check entitlements, wrap OpenAI/Anthropic, query margin)
- Python -- Server-side in Python apps (track events, check entitlements, wrap OpenAI/Anthropic, query margin)
API key rules
- React SDK uses publishable keys (
pk_) -- safe for browsers - Node.js and Python SDKs use secret keys (
sk_) -- server-only, never expose in client code
Feature matrix
| Feature | Node.js | Python | React |
|---|---|---|---|
Usage tracking (track) | ✅ | ✅ | -- |
Entitlement checks (can) | ✅ | ✅ | ✅ (hook) |
| Plans & Checkout | ✅ | ✅ | ✅ (components) |
| Customer management | ✅ | ✅ | -- |
| Credit check & deduct | ✅ | ✅ | -- |
| LLM auto-capture (OpenAI) | ✅ | ✅ | -- |
| LLM auto-capture (Anthropic) | ✅ | ✅ | -- |
| Margin intelligence | ✅ | ✅ | -- |
Health check (ping) | ✅ | ✅ | -- |
| Real-time updates (WebSocket) | -- | -- | ✅ |
| Pre-built UI components | -- | -- | ✅ (25+) |
Architecture
All three SDKs talk to the same Nozle API at api.nozle.app. The React SDK also connects via WebSocket (Centrifugo) for real-time updates, enabling live usage meters and instant entitlement changes without polling.
LLM wrappers (wrapOpenAI, wrapAnthropic) are server-side only — they intercept SDK calls and send raw token counts to the engine. Cost calculation happens server-side via the Go engine's cost model system.
Next steps
- React SDK -- Components, hooks, and BillingProvider setup
- Node.js SDK -- Server-side client, event tracking, LLM auto-capture, margin queries
- Python SDK -- Server-side client, event tracking, LLM auto-capture, margin queries