Why is my Gemini API bill so high? How to check it and cut it
Find where the money went, cap it, and plan for the 2027 price change.
Quick answer
Check the AI Studio Billing page by project and model first. The usual causes are thinking tokens billed at the output rate, Google Search grounding past the free 5,000 requests a month, a pricier model than you meant, chat history resent on every turn, and leaked keys. Set a monthly Project Spend Cap in AI Studio, lower the thinking level for easy tasks, and use Batch or context caching for bulk work.
Where to see what you spent
- AI Studio, Billing: daily cost per project, filterable by model, from the last 7 days to the whole month.
- AI Studio, Usage: requests, tokens, errors, and tool use such as Grounding with Google Search.
- Cloud Billing reports: which SKU spiked. Use this when the AI Studio view is not enough.
The usual causes
- Thinking tokens. Google's pricing page lists output price "including thinking tokens". A classification call that thinks for 2,000 tokens before answering in 5 is billed for 2,005 output tokens. Check
thoughts_token_counton a few real responses. - Search grounding. 5,000 grounded requests a month are free, shared across Gemini 3 and newer models, then $14 per 1,000. One request can run several search queries, and each query is charged.
- The wrong model. Gemini 3.1 Pro Preview is $2 input and $12 output per million tokens, several times a Flash model. A default copied from a demo is a common reason a bill jumps.
- Chat history. Every turn resends the whole conversation as input. Long chats cost more per message as they go.
- Leaked or unrestricted keys. A sudden spike at odd hours, on models you do not use, is a stolen key until proven otherwise. See Gemini API key leaked.
Plan for January 2027
Google lists Gemini 3.8 Flash and 3.6 Flash at $0.75 input and $3.75 output per million tokens through December 31, 2026, and $1.50 and $7.50 from January 1, 2027. If your current bill is fine only because of the 2026 price, do the cost work before the switch, not after the first invoice.
How to cut it
- Lower
thinking_levelfor classification, extraction and short rewrites. Gemini 3.8 Flash defaults to medium and goes down to low. - Do not use a tiny
max_output_tokensto save money. It counts thinking tokens, so the answer can come back empty and the thinking is still billed. - Use a Flash or Flash Lite model for easy calls and keep Pro for hard ones.
- Trim or summarize old chat turns instead of resending all of them.
- Use the Batch API (50% off) for anything that does not need an answer now.
- Use context caching for a long system prompt or document reused across calls.
from google import genai
from google.genai import types
client = genai.Client()
resp = client.models.generate_content(
model="gemini-3.8-flash",
contents="Classify this ticket: refund, bug or question. ...",
config=types.GenerateContentConfig(
thinking_config=types.ThinkingConfig(thinking_level="low"), # default is medium
),
)
u = resp.usage_metadata
print(u.prompt_token_count, u.candidates_token_count, u.thoughts_token_count)Cap it so it cannot surprise you
Since March 2026, AI Studio has a Project Spend Cap: Spend tab, Monthly spend cap, Edit spend cap. It applies with about a 10 minute delay, and batch jobs and agent sessions can run past it. Billing accounts also have a tier cap (Tier 1 is $250 a month, Tier 2 $2,000), and on Prepay billing all keys on the account stop with 402 when credits hit $0.
If you are paying from India
Google's prices are listed in US dollars. Billing accounts in India pay the equivalent in rupees, and tax can be added on the invoice, so your card statement will not match the price page line for line. Two other things catch people out: the $300 Google Cloud free trial credit cannot be used for the Gemini API, and on the free tier your prompts can be used to improve Google's products. Paid tier prompts are not.
Doing this with Prune
Prune is an AI gateway that works with Gemini for standard and streaming calls. Your Gemini key goes into Prune's encrypted vault, and your code only holds a Prune key. Shield gives each Prune key a daily spend cap that counts input and output tokens, including thinking, and blocks before the call reaches Google, so you are not waiting 10 minutes for a monthly cap to notice. Repeated prompts are served from cache, easy calls on Pro can be routed to Flash, and every response shows the model that served it and what it saved.
With a single line of code, Prune cuts your AI bill and protects your team from runaway spend, leaked keys and dangerous calls.