· Charlie

How to track voice agent costs in LiveKit and Pipecat (per-session, not per-invoice)

Instrument LiveKit or Pipecat voice agents with Parlot's SDK to get per-session STT + LLM + TTS cost — not monthly invoice totals you can't attribute to individual calls.

Monthly invoices from Deepgram, OpenAI, and Cartesia tell you what you spent. They don't tell you which calls were expensive, whether a prompt change improved margin, or which agent in a multi-agent flow drove cost. Per-session cost breakdown — stage by stage — is the unit you actually need to operate a voice AI product.

This post covers how to instrument LiveKit and Pipecat voice agents to get that data, what the Cost tab shows, and how to use it.

Why monthly invoices aren't enough

Three separate invoices cover three separate vendors. Reconciling them back to individual sessions requires either a lot of custom logging or waiting until month-end. By then:

  • The prompt that drove a cost spike three weeks ago has already been changed
  • You've lost the ability to compare before/after on a specific change
  • Clients on per-minute billing can't get a session-level breakdown

The alternative is to emit OpenTelemetry spans at the session level — capturing STT usage, LLM token counts, and TTS character counts for each turn — and apply your rates to get session dollars in real time.

The instrumentation model

Parlot's SDK instruments your agent with a single parlotize() call at startup. It auto-instruments the framework (LiveKit Agents or Pipecat) using OpenTelemetry, captures stage usage per turn, and exports spans to Parlot's OTLP endpoint.

You set your negotiated rates once in Parlot (or use list-price defaults). Every session's Cost tab then shows:

  • STT spend this session
  • LLM spend (input + output tokens, at your rate)
  • TTS spend (characters synthesized, at your rate)
  • Total cost and margin if you've set a bill rate

No custom logging. No manual invoice parsing.

Note on realtime & speech-to-speech models: The stage-by-stage breakdown above reflects modular pipelines (discrete STT, LLM, and TTS processors). For native speech-to-speech architectures (such as OpenAI Realtime in LiveKit Agents or Pipecat), usage and costs are computed differently based on audio input/output tokens and session connection duration. We are actively building dedicated tracking, cost attribution, and timeline support for realtime models in Parlot.

LiveKit: instrument in three steps

Install

pip install "parlot[livekit]"

Configure environment

export PARLOT_API_KEY=your_key  
export PARLOT_ENDPOINT=https://ingest.parlot.ai  

Instrument your agent

from livekit.agents import AgentSession, JobContext
from parlot.instrumentation.livekit import parlotize  

parlotize("my-agent")  


async def entrypoint(ctx: JobContext):
    await ctx.connect()  

    session = AgentSession(...)
    await session.start(agent=..., room=ctx.room)

That's the full instrumentation for a standard LiveKit agent. Full walkthrough including SIP and multi-agent setups: LiveKit guide.

A note on LiveKit Cloud Insights: LiveKit Cloud's built-in Insights gives you event-level logs for 30 days. It doesn't apply your provider rates or break out per-session STT/LLM/TTS cost. Parlot adds that layer on top — see Parlot vs LiveKit Cloud Insights.

Pipecat: instrument in three steps

Install

pip install "parlot[pipecat]"

Configure environment

export PARLOT_API_KEY=your_key  
export PARLOT_ENDPOINT=https://ingest.parlot.ai  

Instrument your pipeline

from pipecat.audio.vad.silero import SileroVADAnalyzer
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.worker import PipelineParams, PipelineWorker
from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.llm_response_universal import (
    LLMContextAggregatorPair,
    LLMUserAggregatorParams,
)
from parlot.instrumentation.pipecat import (  
    ParlotRecordingProcessor,  
    parlotize,  
)  

parlotize("my-pipecat-agent", version="0.1.0")  

context = LLMContext(messages)
user_aggregator, assistant_aggregator = LLMContextAggregatorPair(
    context,
    user_params=LLMUserAggregatorParams(
        vad_analyzer=SileroVADAnalyzer(),
    ),
)

pipeline = Pipeline([
    transport.input(),
    stt,
    user_aggregator,
    llm,
    tts,
    transport.output(),
    ParlotRecordingProcessor(),  
    assistant_aggregator,
])

worker = PipelineWorker(
    pipeline,
    params=PipelineParams(enable_metrics=True, enable_usage_metrics=True),
    enable_tracing=True,  
    enable_turn_tracking=True,  
)

Parlot captures the full Pipecat processor waterfall — which stage ran, how long it took (TTFB, processing time), and usage for each service in the pipeline. Full walkthrough: Pipecat guide.

What you see in the Cost tab

After the first instrumented session completes, open it in Parlot:

Cost tab:

  • Per-stage dollars: STT / LLM / TTS broken out
  • Comparison to your bill rate (if set) → session margin
  • Characters per turn, tokens per turn — the cost drivers

Timeline tab:

  • Turn-by-turn waterfall: STT latency → LLM TTFB → TTS first audio byte
  • Interruptions and barge-in events
  • Which processor or agent node in a multi-agent flow ran

Session log:

  • Full transcript with speaker labels
  • PII redaction if enabled

Using the data

Compare before/after a prompt change

  1. Deploy a prompt change that shortens agent replies
  2. Filter sessions in Parlot by agent version or date range
  3. Compare mean TTS chars/session and TTS $/session

This is faster than waiting for the next invoice and shows whether the change reduced synthesis on real traffic.

Find expensive sessions

Sort sessions by cost descending. Long calls with context growth, calls with many interruptions, or calls where a fallback triggered a second LLM call are the usual culprits.

Client billing export

If you bill clients per minute, Parlot's export includes session duration, cost, and stage breakdown. Use it to generate per-client cost reports without manual invoice parsing.

LangGraph workflows

If your voice agent calls a LangGraph workflow (for retrieval, tool use, or multi-step reasoning), the same OTel spans propagate through the graph. Instrument the workflow with parlot-instrumentation-langgraph and you'll see nested spans in the Timeline — which node ran, how long it took, and what it cost in LLM tokens.

Full setup: LangGraph guide.

Start here