Introduction

Source-driven docs

Introduction

Trackly is a Python usage-tracking layer for LLM apps. It hooks into LangChain callbacks or native Ollama and Gemini SDK calls, then records provider, model, tokens, latency, and your own labels in the background.

INFO
This page is written from the actual repository code, not just the README. A few important details are easy to miss otherwise:callback() takes no arguments, native Ollama uses theollama package, native Gemini uses google-genai, and the ingest route is /api/v1/events.

What Trackly records

Provider + model

Trackly stores the provider name and exact model string so pricing and filtering stay accurate.

Token usage

Prompt, completion, and total tokens are captured when the provider exposes them.

Latency

Each event records the wall-clock duration in milliseconds when available.

Your metadata

Feature, environment, user, session, tags, and extra JSON help you slice usage later.

Provider constants

The SDK exports a tiny helper object if you prefer constants over raw strings.

python
from trackly import providers

print(providers.LANGCHAIN)  # "langchain"
print(providers.OLLAMA)     # "ollama"
print(providers.GEMINI)     # "gemini"