When an Optional Field Comes Back Three Ways: Null, Empty String, and Missing Key in Gemini Structured Output
Optional fields in Gemini structured output drift between null, empty string, and a missing key, and downstream code breaks in three different ways. Here is how I collapse all three into one shape using nullable in responseSchema and a post-output normalization gate, with numbers from a nightly batch.
When Gemini's Context Cache Quietly Expires Mid-Run: A TTL Guard for Pipelines That Pause
When a nightly batch or a retry backoff pauses your pipeline, Gemini's explicit context cache can expire on the wall clock while nothing errors out, sending later calls back to full-token billing. Here is a small lease guard that decides whether to re-arm or run uncached based on cost.
Designing Batch Image Costs with Nano Banana 2 Lite: Decide by Measuring
How to fold the fastest, cheapest image model, Nano Banana 2 Lite, into high-volume generation: measuring per-image cost, a two-tier setup with a quality model, and retry handling grounded in real numbers.
Stop a Batch Before It Overspends — A Budget Gate Built on countTokens That Survives a Default-Model Swap
Nightly batches overspend because you only learn the cost after billing. Starting from countTokens, this guide builds a budget gate that folds in thinking tokens and keeps your estimate intact even when the default model changes underneath you.
Designing a Nightly Batch That Survives a Gemini API Outage — Three Layers of Defense
This week's widespread Gemini outage cost my nightly batch three hours of work. Here is how I rebuilt it with three layers of defense: classified retries, a model fallback chain, graceful degradation, plus idempotency keys and a catch-up queue.
Auto-Categorizing 3,000 Wallpaper Images With Gemini Vision API — A Real Production Account
Manually categorizing thousands of wallpaper images doesn't scale. This is a hands-on account of building an auto-classification pipeline with Gemini Vision API — covering design, implementation, actual cost, and the failure patterns I hit running 3,000 images through it.
Gemini Batch Processing API Guide— Process Thousands of Requests at 50% Off
A comprehensive guide to Gemini's Batch Processing API. Learn how to process thousands of requests asynchronously, cut costs by 50%, and build production-grade batch pipelines with Python and TypeScript.