Has anyone here managed to get context caching working for gemini-2.0-flash-001 on a free tier account?

Hi there,

According to this pricing page, the context caching is supported for gemini-2.0-flash-001 even for free tier account:

I tried it, but getting the following error:
google.genai.errors.ClientError: 429 RESOURCE_EXHAUSTED. {‘error’: {‘code’: 429, ‘message’: ‘TotalCachedContentStorageTokensPerModelFreeTier limit exceeded for model gemini-2.0-flash: limit=0, requested=116251’, ‘status’: ‘RESOURCE_EXHAUSTED’}}

Please advise. Thank you.

2 Likes

Hi @limcheekin, You will face this error when you send too many requests per minute with the free tier Gemini API. Please try after some time. Thank You.

1 Like


@Kiran_Sai_Ramineni Here’s this stat from an account with all 0’s
From the first request ever with this account
i get the same error as above (only when using cache context)

Any suggestions ?

2 Likes

Thanks for quick response.

I faced this error from the first request too.

Thanks for sharing the screen.

Where could I find this screen?

Hi @Ayoub_Kazar @limcheekin, May I know the number of tokens you are trying to cache. Also could you please confirm you are facing this error while creating the cache or while making a request on the cached content. Thank You.

1 Like

I am facing this error when the app creating the cache.

I think the number of tokens is stated in the error message above ‘requested=116251’.

Hope this clarify.

Thank you.

Hi, I try to create a cache for gemini-2.0-flash, but I always receive HTTP 503, do you meet the same issue? Thank you!

This is on creating the cache
Here’s the number of tokens: 298263 tokens

429 RESOURCE_EXHAUSTED. {'error': {'code': 429, 'message': 'TotalCachedContentStorageTokensPerModelFreeTier limit exceeded for model gemini-2.0-flash: limit=0, requested=298263', 'status': 'RESOURCE_EXHAUSTED'}}

No, recheck the docs on how to create a cache, then maybe you’ll reach our issue too lol

1 Like

@Long_Peng @Kiran_Sai_Ramineni Please checkout the following code I used to create the cache at TelegramGPT/gemini.py at main · limcheekin/TelegramGPT · GitHub. The same code working for gemini-1.5-flash-002.

Hope this help to resolve the issue faster. Thanks.

2 Likes

Got the same issue.

My account is on free tier.

Hi @Long_Peng, @Ayoub_Kazar @limcheekin While reproducing i have also received the same error while using the free tire account. will escalate this issue to the engineering team. Thank You.

1 Like

Great! Please keep us posted once the issue has been resolved.

Thanks.

@Kiran_Sai_Ramineni May I know any update for this issue?

Hello @Kiran_Sai_Ramineni ,
do we have a workaround/solution for this issue?

I am currently encountering this issue and I have a deadline coming up where I wanted to use the 2.0 Flash model.

Or if anyone managed to get explicit context caching working please let me know.