Skip to content

Function: usageFromRealtimeResponse()

usageFromRealtimeResponse(raw): Usage | undefined

Defined in: packages/aiui-oracle/src/cost.ts:47

A realtime response.done usage → the genai-prices Usage shape.

The vendor reports { input_tokens, output_tokens, input_token_details: { text_tokens, audio_tokens, cached_tokens }, output_token_details: { text_tokens, audio_tokens } } — where the per-modality figures are SUBSETS of the totals, which is also genai-prices' convention, so this is mostly a rename. Tolerant: garbage in → undefined out, and the response goes unaccounted rather than unprocessed.

Parameters

raw

unknown

Returns

Usage | undefined