Enabling performance metrics
Setenable_metrics=True in PipelineParams when creating a worker:
Example config
| Metric | Description |
|---|---|
| TTFB | Time To First Byte in seconds |
| TTFA | Time To First Audio in seconds (TTS services only) |
| Processing Time | Time taken by the service to respond in seconds |
| Text Aggregation | Time from the first LLM token to the first complete sentence (TTS services only) |
Sample output
Limiting TTFB responses
If you only want the first TTFB measurement for each service, you can optionally passreport_only_initial_ttfb=True in PipelineParams:
Example config
Note: enable_metrics=True is required for this setting to have an
effect.
Disabling initial empty metrics
By default, Pipecat sends an initialMetricsFrame with zero values for all
services when the pipeline starts. To disable this behavior:
Example config
Enabling LLM/TTS Usage Metrics
Setenable_usage_metrics=True in PipelineParams when creating a worker:
Example config
| Metric | Description |
|---|---|
| LLM Usage | Number of prompt and completion tokens used |
| TTS Usage | Number of characters processed |
Sample output
Note: Usage metrics are recorded per interaction and do not represent running totals.
Capturing Metrics Data
When metrics are enabled, Pipecat emits aMetricsFrame for each interaction. The MetricsFrame contains a list of metrics data objects, which can include:
TTFBMetricsData— Time To First ByteTTFAMetricsData— Time To First Audio (TTS)ProcessingMetricsData— Processing timeLLMUsageMetricsData— LLM token usageTTSUsageMetricsData— TTS character usageTextAggregationMetricsData— Sentence aggregation latency (TTS)TurnMetricsData— Turn completion predictions
MetricsFrames.
Example: Using MetricsLogObserver
The simplest way to log metrics is with the built-inMetricsLogObserver. Pass it as an observer when creating your PipelineWorker:
include_metrics:
Example: Using a Custom FrameProcessor
Create a custom FrameProcessor to handle metrics data. Here’s an example Metrics Processor that can be added to your pipeline after the TTS processor.Metrics Data Reference
All metrics data classes inherit fromMetricsData, which includes processor (the name of the processor that generated the metric) and an optional model field.
TTFBMetricsData
Time To First Byte — measures how long until the first byte of a response is received from a service.| Field | Type | Description |
|---|---|---|
value | float | TTFB measurement in seconds |
TTFAMetricsData
Time To First Audio — measures the time from a TTS request to the first audible audio sample. This includes the time to first byte plus any leading silence padding added by the service.TTFAMetricsData reports the latency breakdown directly, showing how much of the perceived latency is silence padding.
| Field | Type | Description |
|---|---|---|
ttfa | float | TTFA measurement in seconds (ttfb plus leading_silence) |
ttfb | float | Time-to-first-byte in seconds. Mirrors the standalone TTFBMetricsData for convenience, not a separate measurement |
leading_silence | float | Silence padding before the first audible sample, in seconds (ttfa minus ttfb) |
ProcessingMetricsData
Measures the total time taken by a service to process a request.| Field | Type | Description |
|---|---|---|
value | float | Processing time measurement in seconds |
TextAggregationMetricsData
Measures the time from the first LLM token to the first complete sentence, representing the latency cost of sentence aggregation in the TTS pipeline.| Field | Type | Description |
|---|---|---|
value | float | Aggregation time in seconds |
LLMUsageMetricsData
Token usage for an LLM interaction. Thevalue field is an LLMTokenUsage object with:
| Field | Type | Description |
|---|---|---|
prompt_tokens | int | Number of tokens in the input prompt |
completion_tokens | int | Number of tokens in the generated completion |
total_tokens | int | Total tokens used (prompt + completion) |
cache_read_input_tokens | Optional[int] | Tokens read from cache, if applicable |
cache_creation_input_tokens | Optional[int] | Tokens used to create cache entries |
reasoning_tokens | Optional[int] | Reasoning tokens (for reasoning models) |
TTSUsageMetricsData
Character usage for a TTS interaction.| Field | Type | Description |
|---|---|---|
value | int | Number of characters processed by TTS |
TurnMetricsData
Metrics from turn completion prediction, emitted by turn analyzers like Krisp Viva Turn and Smart Turn.| Field | Type | Description |
|---|---|---|
is_complete | bool | Whether the turn is predicted to be complete |
probability | float | Confidence probability of the prediction |
e2e_processing_time_ms | float | End-to-end processing time in ms, from VAD speech-to-silence transition to turn completion |
Related Observers
In addition toMetricsLogObserver, Pipecat provides observers that track higher-level conversational metrics.