LiveKit Integration
Automatically track usage for LiveKit Agents using the LiveKitPaygentHook.
Prerequisite: Complete the Voice Agent Setup before implementing voice tracking.
How it works. The LiveKitPaygentHook intercepts metrics from LiveKit’s AgentSession or VoicePipelineAgent and maps them to Paygent’s voice tracking API. It handles LLM tokens, STT duration, and TTS character counts automatically.
Manual Configuration. If your LiveKit metrics don’t include provider/model information, or if you want to override the detected values, you can pass llm_config, stt_config, and tts_config directly to the hook.
Example Usage
Integrating Paygent into your LiveKit Agent is as simple as creating a hook and attaching it to your session:
Why use the LiveKit Hook?
Automatic Conversion: Automatically converts LiveKit metric formats (seconds, tokens) into Paygent-ready billing data.
Session Lifecycle: Automatically starts and finalizes voice sessions in Paygent based on LiveKit session events.
Multi-Component Tracking: Simultaneously tracks LLM tokens, STT minutes, and TTS characters without additional manual tracking code.
