adventurous-nail-20177
09/02/2025, 7:54 AM{
"total_tokens": 275,
"input_tokens": 127,
"output_tokens": 148,
"input_token_details": {
"cached_tokens": 384,
"text_tokens": 119,
"audio_tokens": 8,
"cached_tokens_details": {
"text_tokens": 128,
"audio_tokens": 256
}
},
"output_token_details": {
"text_tokens": 36,
"audio_tokens": 112
}
}
the get_summary function return a brief summary i want detailed to help me calculate the cost for every session, any ideas?
thanks in advanceblue-helicopter-48420
09/02/2025, 10:06 AMon_shutdown hook).
For LLM costs, you can write something like this:
cached_input_tokens = usage_summary.llm_prompt_cached_tokens
regular_input_tokens = usage_summary.llm_prompt_tokens - cached_input_tokens
regular_input_cost = regular_input_tokens * LLM_INPUT_PRICE
cached_input_cost = cached_input_tokens * LLM_CACHED_INPUT_PRICE
output_cost = usage_summary.llm_completion_tokens * LLM_OUTPUT_PRICE
llm_cost = regular_input_cost + cached_input_cost + output_cost
You can do the same for SST and TTS, depending on your provider's pricing.adventurous-nail-20177
09/02/2025, 1:15 PMcolossal-airport-32984
09/05/2025, 8:34 PM