Home › Blog › How to Cut Your Gemini API Costs
How to Cut Your Gemini API Costs
Gemini gives you cheap model tiers, built-in caching and a batch mode. Most teams use only one of them.
Keep repeated context at the start of the prompt so implicit caching can kick in, or create an explicit cache for large shared documents. Run non-urgent jobs through Batch Mode at half price, route simple tasks to Flash or Flash-Lite, and cap thinking and output tokens.
1. Measure from usage metadata
Every Gemini response includes usageMetadata with prompt, output, cached and thinking token counts. Log it per route and work out cost per request before you change anything.
2. Use caching
- Implicit caching: recent Gemini models reuse a repeated prompt prefix automatically and pass the saving on. Keep stable instructions and documents at the start of the prompt.
- Explicit caching: create a cache for a large document or system instruction with a time-to-live. You pay a storage fee for that time, so it suits content reused many times.
3. Send background work to Batch Mode
Batch Mode runs requests asynchronously at half the standard price, with results targeted within 24 hours. It suits evals, backfills, enrichment and nightly reports.
4. Route by difficulty
Keep Pro models for hard reasoning, and send high-volume, simple work like classification and extraction to Flash or Flash-Lite. Test each route on your evals before switching.
5. Control thinking and output
Thinking tokens bill as output tokens. Use the lowest thinking setting that still passes your evals, set a maximum output length, and use structured output instead of long prose.
Using Vertex AI?
The same levers apply to Gemini on Vertex AI, but prices and feature availability can differ, so check Vertex AI pricing for your region. For the general playbook, read the LLM cost optimization guide.
Want us to find your 20%?
Book a free 15-minute API cost teardown. Bring last month's provider usage and we'll show you your biggest waste and the first fix we'd ship.
Get My Free 15-Minute API Cost TeardownFrequently asked questions
Is Gemini Batch Mode cheaper?
Yes. It costs half the standard price, but results arrive asynchronously, targeted within 24 hours, so use it only for work no one is waiting on.
Do cached Gemini tokens cost less?
Yes, cached tokens are billed at a reduced rate. Explicit caches also charge a storage fee for as long as they live.
Do these tips work on Vertex AI?
Mostly. The same levers exist on Vertex AI, but check its pricing and feature availability for your region.