Skip to main content
The monitoring SDK automatically captures every AI model interaction and sends telemetry to the Know Your AI dashboard. You get real-time visibility into requests, token usage, cost, latency, errors, and more.

Installation

Basic setup

Supported operations

The Google GenAI integration automatically instruments:

What gets captured

Every AI call is captured as a CapturedAIData event containing:

Token usage

Cost estimation

The SDK automatically estimates cost based on the model and token count:

Latency metrics

For streaming responses, additional latency data is captured:

Streaming support

Streaming responses are fully supported. The SDK captures all chunks and computes streaming-specific metrics:

Chat sessions

Multi-turn conversations are tracked automatically:

Custom callback

Use onCapture to receive every captured event in your own code:

Custom HTTP transport

Send events to your own backend instead of (or in addition to) the Know Your AI dashboard:

Available transports

Privacy controls

Control what data is captured:
Per-integration privacy:

Hooks

Hooks let you intercept and modify AI calls before they reach the model or after the response:

Before-request hook

After-response hook

Hook result actions

Flushing

The SDK batches events and sends them periodically. To ensure all events are sent before your process exits:

Error tracking

Errors are automatically captured with structured metadata:

Full example