[Resolved] Gemini API Context Cache not hit

Model: gemini-3.5-flash / gemini-3-flash-preview / gemini-3.1-flash-lite

Hi everyone, I’ve recently discovered that the Gemini API seems to be failing to hit the context cache.

I’ve made several rounds of calls to the API using the same system instructions, and normally a context cache hit should occur.

However, I can’t read cached_content_token_count in the response usage.

Response Example:

{
…,

“usageMetadata”:{“candidatesTokenCount”:107,“promptTokenCount”:13001,“promptTokensDetails”:[{“modality”:“TEXT”,“tokenCount”:13001}],“totalTokenCount”:13108}
}

The thoughts_token_count also disappeared.

I’m sure the request had thoughtLevel='low' set.

Dozens of conversations were conducted, but these counts did not appear in the logs.

I saw a thoughtSignature appear in the tool call request log, but the response didn’t show any token usage count.

Has anyone else observed the same problem?

Hi @KuanMing_Chen ,

We tried to reproduce this but the signatures came back correctly for us. Could you provide a snippet of source code to reproduce? This will e.g. help us narrow down whether you’re using explicit or implicit caching.

Hi, I’ve roughly figured out the cause.

It’s probably because I pruned the prompts, which prevented them from reaching the context cache threshold. I kept thinking about reducing them to improve performance but overlooked this threshold limitation. I’ve changed the title to “Resolved”.