◉GEMINI LABJP
●2.5 ROUTE — Since 12/1, gemini-2.5-pro routes to 3.8 Flash and gemini-2.5-flash to 3.5 Flash-Lite, billed at the new model's rates●CARBON — Intro pricing for Gemini 4 Carbon and Argon has ended. Standard rates: $4.00 input, $20.00 output per 1M tokens●OMNI 1.1 — gemini-omni-1.1-flash starts routing to 1.2 Flash on 12/3, one day from now●COMPRESS — Some Gemini CLI users report auto-compression that barely shrinks the context, round after round●FALLBACK — Planning for model changes or traffic spikes? Decide your retry count and fallback model up front●LONG DOC — Feeding Gemini a long document? State your goal and the part to read first, and fewer details get dropped●2.5 ROUTE — Since 12/1, gemini-2.5-pro routes to 3.8 Flash and gemini-2.5-flash to 3.5 Flash-Lite, billed at the new model's rates●CARBON — Intro pricing for Gemini 4 Carbon and Argon has ended. Standard rates: $4.00 input, $20.00 output per 1M tokens●OMNI 1.1 — gemini-omni-1.1-flash starts routing to 1.2 Flash on 12/3, one day from now●COMPRESS — Some Gemini CLI users report auto-compression that barely shrinks the context, round after round●FALLBACK — Planning for model changes or traffic spikes? Decide your retry count and fallback model up front●LONG DOC — Feeding Gemini a long document? State your goal and the part to read first, and fewer details get dropped
ARTICLES

All Articles

All (868)◉ Gemini Basics (71)⟐ Dev Tools (135)◈ API & SDK (450)⬡ Advanced (129)◧ Workspace (52)◎ Updates (31)
◈ API & SDK/2026-06-27Advanced

Don't Retry Every Gemini 429 — Telling Rate Limits Apart From Spend Cap Exhaustion

A 429 RESOURCE_EXHAUSTED can mean 'wait a second and it clears' or 'you're out of budget for the month.' Now that Project Spend Caps is generally available, the second case is real in production. Here's how to classify the two and build a retry layer plus a circuit breaker around them.

◈ API & SDK/2026-06-27Advanced

Stopping Runaway Costs Twice: Project Spend Caps Plus an App-Side Soft Limit

Pairing Gemini API Project Spend Caps (a monthly USD ceiling) with an app-side soft circuit breaker that trips before the hard cap. Includes a working Python and sqlite daily cost ledger.

◈ API & SDK/2026-06-27Advanced

Your Gemini Structured Output Keys Keep Reordering — Pin Them With propertyOrdering

You constrained the shape with responseSchema, yet the JSON key order shifts between calls and your snapshot tests go red for no reason. Here is why field order is not guaranteed by default, how propertyOrdering fixes it, how Pydantic sets it for you, and how to align few-shot examples — all with working code.

◈ API & SDK/2026-06-26Advanced

Is Gemini 3.5 Flash Actually Cheaper? Measuring Retry Amplification to Find the Flash vs Pro Break-Even

Now that 3.5 Flash is generally available, it is tempting to route everything to it. But once you measure effective cost per success instead of per-call price, the decision changes. Here is a small harness to measure retry amplification and find the break-even.

◈ API & SDK/2026-06-26Advanced

When Gemini's Safety Filter Silently Drops Legitimate Output — Field Notes on Catching False Positives Without Turning Everything Off

Field notes on handling Gemini API false positives in production without disabling every category. Separating input blocks from output blocks, instrumenting per-category false-positive rates, and recovering by relaxing only the offending category.

◈ API & SDK/2026-06-26Advanced

When your Gemini API spend cap trips, paying users go down too — isolating the blast radius with per-tier projects

A Project Spend Cap stops the entire project at once. To keep a runaway free tier from taking paying users down with it, this is a design note on isolating the cap's blast radius across per-tier projects and closing the ~10-minute delay with an application-side soft budget gate.

◈ API & SDK/2026-06-26Advanced

Reliable Text-in-Image with Gemini 3.1 Flash Image — an OCR-Verified Pipeline

After the preview shutdown, the GA gemini-3.1-flash-image still occasionally garbles text baked into images. Here is a generate -> read-back-verify -> regenerate/composite pipeline, with working code and an unattended retry budget.

◈ API & SDK/2026-06-25Intermediate

Turning Articles into Audio with the Gemini 3.1 Flash TTS Preview: Splitting Long Text, Stitching It Back, and What It Actually Costs

The Gemini 3.1 Flash TTS preview launched today. Here is a single-narrator pipeline that converts a written article into clean audio, including how to split long text, stitch PCM without ugly seams, keep one voice steady, and estimate the real per-article cost.

◈ API & SDK/2026-06-25Advanced

Gemini API × TypeScript Type-Safe AI Application Architecture — Integrating Zod Schemas, Structured Output, and Streaming

Type-safe AI applications with the Gemini API and TypeScript: Zod validation, Structured Output, streaming pipelines, and error handling that holds up in production.

◈ API & SDK/2026-06-25Advanced

When Gemini's Structured Output Quietly Drifts From Your Schema — Field Notes on Measuring Validation and Retries

Even with response_schema set, Gemini's structured output occasionally drifts in production. Stop swallowing failures, measure them, split causes by finish_reason, and feed errors back for a corrected retry. Field notes from stabilizing a validation pipeline.

◈ API & SDK/2026-06-25Advanced

The Morning a Preview Image Model Went Dark — Migrating to GA Gemini Image Models and Building a Deprecation-Resilient Pipeline

With gemini-3.1-flash-image-preview and gemini-3-pro-image-preview retired, here is how to migrate to the GA models and design an image pipeline that no longer gets caught off guard by deprecation dates — with code and cost math, plus video-to-image thumbnail automation.

◈ API & SDK/2026-06-24Advanced

Citing the exact page and figure in File Search answers with visual-citation metadata

File Search grounding metadata now carries media_id and page_numbers, so you can trace each sentence of an answer back to a specific page and figure. Here's how I built a sentence-level, verifiable citation layer over a mix of PDFs and images.