Assistants API token calculation?

If lets say we have the Assistants A1 is being used… Now the total tokens used are - Assistant Instructions + Query ( User message ) + Generated output ( Assistant message )

Now lets say we have uploaded the file to our assistant now our total token used is changed, as a RAG call is done to fetch relevant contexts and append into prompt - Instructions + Query ( User message ) + file context + Generated output ( Assistant message )

Am I correct ? If so, how to fetch the token size of the file context added to the prompt ?

1 Like