Skip to main content
The wrappers patch the supplied provider client’s create method and preserve its normal return value. They support synchronous calls, asynchronous calls, synchronous streams, and asynchronous streams. Only model, token counts, latency, and an optional feature tag are sent. Prompt and completion content are not captured.

OpenAI

OpenAI streaming

Request usage metadata so the final stream chunk contains token counts:

Anthropic

Anthropic streams read input usage from message_start and output usage from message_delta events.

Wrapper arguments

Tracked properties

Cost calculation remains server-side through your Feature and cost-model configuration.

Failure behavior

The wrappers attempt tracking after a successful provider result. Tracking failures do not replace that result; the SDK emits NozleTrackingWarning. For async provider calls, synchronous Nozle tracking runs in a worker thread through asyncio.to_thread(). The wrapper does not expose subscription_id or transaction_id, so track() resolves the customer’s single active subscription and creates a transaction UUID. Use manual queued tracking when you require durable delivery or deterministic IDs.