Skip to content

feat(audio): define usage metrics in schema 3.2 - #91

Merged
Abhijeet Prasad (AbhiPrasad) merged 3 commits into
mainfrom
davidelner/sdk-903-audio-usage-v3.2
Nov 25, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 3 commits into
mainfrom
davidelner/sdk-903-audio-usage-v3.2

Conversation

@delner

@delner David Elner (delner) commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Audio trace schema 3.2.0 defines shared fields for provider-metered duration and cached audio input. Usage stays on the model or service span that incurred it.

Trace field Change Meaning
metadata.usage_seconds New Provider-reported metered duration for the owning operation, expressed as finite, nonnegative seconds. Fractional values are allowed.
metadata["contrib.<integration>.*"] Preservation specified Native usage, including provider-specific breakdowns, and request/session IDs retain their reported names, units, and structure.
metrics.prompt_cached_audio_tokens New Input audio tokens read from cache. This count is included in both prompt_audio_tokens and prompt_cached_tokens.
Existing token metrics Reused Input/output totals and audio/cache breakdowns use the shared token contract, including prompt_audio_tokens and completion_audio_tokens.
metrics.estimated_cost Reused If the integration computes a dollar cost from metered duration, it records that cost here.
session : task
├─ pipecat.live : llm
│    metadata.model: gpt-live-1
│    metadata.usage_seconds: 6.25
└─ llm_response : task
   └─ backend operation : llm
        metadata.model: <resolved backend model>
        metrics: { prompt_tokens: 800, completion_tokens: 100, tokens: 900 }

Preserve reported zero and omit unavailable values. Later cumulative totals replace earlier ones on the same span. Metered duration represents provider-reported usage and can differ from the span duration.

@AbhiPrasad

Abhijeet Prasad (AbhiPrasad) commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

This can't live in metrics, it needs to be in metadata Edit: we need to add backend support for these metrics first.

@kevchoi kev (kevchoi) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit f8db5e6 into main Nov 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants