How to get tokens for OpenAI message assistant?

Hello,
I’m interested in keeping track of each interaction with each assistant. To do this, I need the prompt tokens and completion tokens. I understand that the OpenAI Assistant API now provides information on token usages. Additionally, the run_id is now available in Make. Is it possible to obtain the tokens at this time?

I recognize that this was a previous post asking the same question. However, we now have the necessary data (run_id).

Thank you in advance for your assistance.

Welcome, @Chokmah, and a great question.

Via the OpenAI API for getRun, the token consumption information is returned.

get https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}

2 Likes

Thank you very much, @ImMichaelCannon! Including the OpenAI Make a call request with the GET method and the URL “/v1/threads/{thread_id}/runs/{run_id}” helped me to get the tokens.

1 Like