How to control costs when using gemini-2.5-pro

I am using LLM across different google products, and Firebase Studio is one of them. I work very often with gemini-2.5-pro in Firebase Studio. Sometimes the cost “explode” when i work intensively to complete a feature.

  1. Can i control somewhere, what the costs ocurred just in Studio are? Could i at least check the token count in Studio? Is there a terminal command to access that?
  2. Can I clear the context window, so that token cost is lower (when i think large context is not necessary anymore for a certain task). I think there is a “clear” command?

Yep, we have documentation around cost monitoring here: Monitor costs, usage, and other metrics  |  Firebase AI Logic Please check it out!

1 Like

I tried to set a budget inside the console for Firebase Studio but I understood it was for my project. This seems as it it is not.

I set a budget of $25.

I got a bill for $307 for the month.

I feel utterly deceived and swindled by Google.

I don’t not think they make it clear anywhere that thisis some unenforce random statement rather than an enforced budget limit.

Good luck.

Jono

@Jonathan_Bean :worried: I’m sorry to hear about the surprise billing. Please file a support ticket here “I have an account or billing issue I need help with“ to open a refund case: Contact Support  |  Firebase

I’m curious. Did you set up a budget alert as described here Avoid surprise bills  |  Firebase Documentation?

A budget alert is not a budget cap. “An alert will send you communications when you’re approaching or surpassed your configured threshold so that you can take action in your app or project.“

An alternative is to disable Cloud Billing programmatically: Disable billing usage with notifications  |  Cloud Billing  |  Google Cloud

To avoid future incidents like this, please consider this alternative.

Yes I set up a budget of $25 and expected it was a budget spend limit. It was not.

The real bill always seems 10 times as much. i recently had 400$ and 230$ months which was really shocking.