How to get input and output bytes

How to get the bytes that are being consumed in input and output of the openai api?

I have a chatbot and i need to get the input and output of the user conversation with the chatbot. the chatbot uses the openai api.