Listen: Sorry Google, I was wrong.

An analysis of a $2,000 Gemini API bill caused by the URL Context tool, which ingests entire web pages as input tokens without providing size estimates.

Listen

Transcript

I recently blamed Google for a two-thousand-dollar Gemini API bill, thinking it was a billing bug. It wasn't. The charges were completely real, and they came from a search tool I built that went viral overnight.

The culprit was Gemini's URL Context tool. When you give this tool a web address, it ingests the entire page as input tokens. You don't get to choose which parts to read, and you don't get a size estimate beforehand. If your tool hits a massive website or a long PDF, it can easily swallow a million tokens in a single call.

To make matters worse, I had set the model's thinking level to high and left the output uncapped. I also wasn't logging my token usage, so I was completely blind to the rising costs.

The Gemini API is incredibly powerful, but if you use the URL Context tool, you need to be careful. Always log your usage metadata, set strict output token limits, and build your own spending circuit breakers. Remember, Google Cloud budgets only send alerts. They won't automatically shut down your API to save you from a surprise bill.

It would be a huge help if Google implemented input size controls and hard budget caps for these tools. Until then, keep a close eye on your traffic and your tokens.