Is there a way to get the proccessed tokens of file that is uploaded?

It is great that Gemini API proccesses the file when it is uploaded and each page is convered into fixed number of tokens. Is there a way to retrieve ans store these tokens somewhere for future use, so that we use lesser token in processing next time? This way it would be efficinet use of google’s compute as well. Same file need not be proccessed again and again when uploaded.

Hi @mr_mechanic ,Welcome to the forum.

You can utilize the Gemini API context caching feature, which allows you to pass some content to the model once, cache the input tokens, and then refer to the cached tokens for subsequent requests.
For more information, you can follow the documentation link.