Skip to main content

Javascript SDK

LLM Strategy

Wrap any LLM model from the @ai-sdk/* library, to automatically fire prompt- & completion tokens used by every model call.

Ingestion Payload

Python SDK

Our Python SDK includes an ingestion helper and strategies for common use cases. It’s installed as part of the Polar SDK.

Ingestion helper

The ingestion helper is a simple wrapper around the Polar events ingestion API. It takes care of batching and sending events to Polar in the background, without blocking your main thread.

PydanticAI Strategy

PydanticAI is an AI agent framework for Python. A common use-case with AI applications is to track the usage of LLMs, like the number of input and output tokens, and bill the customer accordingly. With our PydanticAI strategy, you can easily track the usage of LLMs and send the data to Polar for billing.
This example is inspired from the Pydantic Model example of PydanticAI documentation.

Ingestion Payload