Realtime API cost tracking per session

Hello Experts

Is there anyway I can track the realtime api cost per session? I have an requirement to track usage per session and then report back. I would like to track only realtime api usage as other openAI API usage tracking solution been implemented already.
Thanks

Just look at usage in response.done (docs), sum them up during the whole session, and then apply some math to this total sum in the end of the session (OpenAI won’t send you total usage so you have to track it on your own).

Make sure to properly account for cached audio and cached text tokens.

1 Like