URGENT: Huge cost increase of Gemini API

Hello,

We were billed for a very large amount of Gemini API usage, but we cannot identify any activity on our side that would explain this traffic. Starting on August 12th, the usage gradually increased and then on August 17th skyrocketed and it reached nearly $5,000 per day ($40,000 in total).
We have various models in the billing statistics that we have never used. Mostly expensive models!

The only way we were able to stop the charges was by completely disabling the Gemini API.

This looks like it may have been caused by an issue on Gemini’s side rather than our usage. Can you please investigate and provide clarity on what generated these charges?

Thank you for your urgent assistance.
We can provide all what is needed.

4 Likes

Hi @George_M,

Welcome to the Google AI Forum! :confetti_ball: :confetti_ball:

I apologize for the loss.. As you have mentioned that there are various models in billing statistics, it looks to me that one of your API keys associated with your GCP project might have leaked and the hacker must have increased usage which explains models listing in your billing statistics.

Architectural Patterns to prevent such issues in future
Establish OAuth and frequently refreshing API keys pattern (simple) OR completely avoid access to API key access to project users by using use OAuth + Proxy + token + refresh token pattern.

These approaches help you gain user level tracking with authentication and prevents exposing API keys thereby completely avoiding leaks.

I hope this helps resolve your issue.

2 Likes

Thank you for fast response, but to me this does not look like leaked key. To much of coincidence that there are many report of this being happening around the same time. (Gemini 2.5 Model Bug Causing Massive Bills, Google Support Unresponsive to Core Issue - #11 by Chris_Frederick or [CRITICAL-BUG] Massive Overbilling by Gemini API (Over $70k), Charges Still Increasing by $10k Daily Even After Deleting All API Keys and a few more…)

How can we get a list of remote ip addresses that was accessing our API Keys? Or any confirmation about this?

Last month, there was a billing bug in the Gemini API, which was officially announced.

It says the bug will be fixed and reflected in your account within 48 hours, but it has not been fixed yet.

Logan Kilpatrick also shared his situation on X.

1 Like

I’ve being nailed with $260 and $275 charges 2 days in a row on a deactivated API key.
HOW DO WE STOP THIS??

It started Yesterday!

1 Like

Just to give you a glimpse of all this mess… As you can see there are tons of tokens used for input on gemini pro 2.5 but not just input… the long input!

There is no output related to this amount of this much input data… We need a clear explanation of this. You have the tool (API endpoints), it’s your job to make sure you can explain key leak or whatever you say it is.

​​

1 Like

There are other posts with the same issue…
https://discuss.ai.google.dev/t/gemini-api-cost-suddenly-skyrocketed/99479

The sad part is that Google does not make it easy to disable a service when quota is exceeded. It feels intentional.

1 Like

Isn’t that pretty basic? Google certainly turns off your ads when you have exhausted your Google AdWords spend. Seems like a very similar situation.

I would suggest that anything which has the ability to bill you due to automated processes needs a few safety features. It should support:

  • Spend cannot exceed $X in Y time (could be dollars a day, but it also could be an hour or a minute – better to catch problems early)
  • Spend cannot exceed monthly total of {total].
  • Messages to the account holders email and smart devices should be triggered at at least these caps, and ideally would be configurable to alert you before you reach the cap.
  • IP addresses should be reported.*

*Privacy concern? Not really. No one else has permission to use the key. If they are trying to hack my account, I think we can all agree that they have given up their right to privacy. In the case where it turns out to be someone in my company, then the agreement signed with Google should make it clear that this data can and will be revealed in the event of a charge dispute.

These things are so obvious, and yet if they are not being done, as the OP said, it makes you wonder if it isn’t on purpose.

2 Likes

So what would be the solution for ALL of us? Be able to set a hard daily limit on the API instead of a soft budget reminder. Can you give us a reason why this wouldn’t be considered as a standard feature in the near future.

1 Like

I agree. It almost feels like that they want you to exceed your budget. But they will shutt off ads once you exceed your budget!

1 Like

This would be a cloud wide feature, not just gemini. just saying

1 Like

Come on Google - you need to help out your community here. You want us developers to be trying out new features and functionality without this kind of fear. Please - a simple - cash value cap on developer account - a kill switch at a value determined by me - eg $100 per month as a default - but customisable up or down as preferred by the developer. This would not be difficult to implement. I understand the many arguments against this in prod - but for a dev account - developing - and by implication venturing into the unknown / likely to make some mistakes / misconfigurations, and even for some not being aware enough of how to protect their API keys. I think Google has a massive opportunity right now - with the expansive and truly top notch products across the whole stack (including AI). To make it easy for developers to standardise on your stack (and hence turn that into more paying customers down the line). This one doesn’t seem like rocket science to me. Interested on thoughts of other developers currently learning. experimenting - and hence choosing their tech stack for this AI revolution.

This is definitely a serious bug. That has huge business implications. I think they reverted some costs in August, but it has again started.
We are just testing our concept on a single machine, still you can still check out that the number of hours they calculated is way higher and unrealistic to comprehend.
In these screenshots, you can see the latest screen is not showing up with high charges for 7th and 8th Sept anymore.

1 Like

I see similar issue since Sep-12 - list caches API returns nothing, but it still counts in billing

1 Like


Continuing the discussion from URGENT: Huge cost increase of Gemini API:

1 Like

Were you able to resolve this? We have a similar issue where our caching has just skyrocketed in the past two days

1 Like

I think the bug came back today. Ramped up my Generate content cached content storage token hours gemini 2.5 pro by a lot very rapidly.

1 Like