Accumulates call metrics, cost, and latency for each turn in a conversation.
// Source: https://github.com/PatterAI/Patter | License: MIT | Copyright 2026 Patter Contributors
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Call metrics accumulator — tracks cost and latency during a call.
*
* Port of the Python `CallMetricsAccumulator` from `sdk/patter/services/metrics.py`.
*/
import {
calculateLlmCost,
calculateRealtimeCachedSavings,
calculateRealtimeCost,
calculateSttCost,
calculateTelephonyCost,
calculateTtsCost,
mergePricing,
type ProviderPricing,
} from './pricing';
import type { EventBus } from './observability/event-bus';
import type {
EOUMetrics,
InterruptionMetrics,
ProcessingMetrics,
TTFBMetrics,
} from './observability/metric-types';
import type { TransferCallOptions, TransferCallResult } from './types';
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key