◉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/API / SDK
◈ API / SDK/2026-04-29Advanced

Gemini API × Inngest: Building Fault-Tolerant AI Workflows for Production

Build Gemini API jobs that survive 429s, timeouts, and partial failures with Inngest v4 durable execution — v3-to-v4 rewrite, fan-out, approval gates, budget guards, onFailure, and a troubleshooting table, current as of November 2026.

gemini-api291inngestdurable-executionworkflow12production140

✦ Premium Article

I pasted my own sample code into a fresh Next.js project, ran npm install, and got the latest inngest. Before I had even opened the dashboard, the editor was covered in red squiggles. The trigger I'd passed as the second argument no longer type-checked, and EventSchemas didn't exist. I had written the guide against v3; npm had quietly moved on to v4.

My first instinct was to make the errors go away one at a time. I cast a few things to any, got something running, and almost called it done. Reading the logs the next morning, I saw the SDK had started in Cloud mode and was hunting for a signing key instead of talking to the local Dev Server. That was when it clicked for me: "it runs" and "it runs in the mode I intended" are two different claims.

This guide is built on that rewrite. It walks through a setup that works as of November 2026 for Gemini API jobs that can fail halfway and resume without throwing away the tokens you've already paid for.

Check Your Versions First (as of November 2026, verified against official docs)

Before copying any code, it's worth confirming your project matches this table. If it doesn't, the samples below won't compile as-is.

ComponentWhat this guide assumesHow to checkWhat breaks if it differs
Inngest TypeScript SDKv4 (npm latest is 4.26.2)npm ls inngestOn v3 there are no triggers-in-options or eventType helpers
Gemini SDK@google/genai (npm latest is 3.3.0)npm ls @google/genaiThe legacy @google/generative-ai has a different call shape
Main generation modelgemini-4-hydrogenModel list in AI Studio2.5 models are auto-routed elsewhere from December 1
High-volume light summariesgemini-3.5-flash-liteSameYour cost and latency estimates shift
Local runsnpx inngest-cli@latest devDoes the dashboard open?v4 defaults to cloud mode, so dev mode must be explicit

On models: Google's deprecation page states that from December 1, 2026, API requests to gemini-2.5-pro are automatically routed to gemini-3.8-flash, and gemini-2.5-flash to gemini-3.5-flash-lite, billed at the destination model's rates. The original samples here used 2.5 models, so I replaced every one of them. I'd recommend pulling model IDs into environment variables — the next switch then won't touch your code at all.

Why Gemini Workloads Need Durable Execution

The core idea of durable execution is simple: the engine persists a function's progress, so when something fails, only the failed step runs again. Inngest, Temporal, and Restate are all built around this.

Run Gemini in production for a while and you'll meet the same handful of situations: a transient HTTP 429 (RESOURCE_EXHAUSTED) that stalls everything unless you retry; a stream that drops before the final chunk; a video or PDF analysis that times out; a function-calling result that triggers another API which fails for reasons unrelated to Gemini.

The naive try/catch plus setTimeout approach has one painful flaw: every retry pays again for the calls that had already succeeded. If a 10,000-item batch dies at item 5,000 and restarts from zero, that's real money on top. That's the gap durable execution fills.

I chose Inngest for three reasons. Anything inside step.run('name', fn) has its result saved on success and is skipped on replay. npx inngest-cli@latest dev shows each step on a timeline. And once event types are defined, the function side autocompletes, so a renamed field shows up at build time instead of in production.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦You'll be able to resume long Gemini jobs after a timeout, 429, or mid-run crash without paying again for the steps that already succeeded
✦You'll rewrite v3-style code (EventSchemas, three-argument createFunction) into v4 triggers and eventType, then build fan-out, approval gates, and dead-letter handling in working TypeScript
✦You'll be able to diagnose the production traps that bite first — the December 1, 2026 auto-routing of 2.5 models, the Cloud-mode signing key error, and more — straight from the symptom
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◈ API / SDK2026-07-15
Sample what you already accepted — an audit budget that catches silent quality drift
A confidence gate only ever looks at output the model hesitated on. Silent drift sinks into the batch that sailed through. Working from a fixed 30-minutes-a-day review budget, this walks through deriving detection time from the binomial, reallocating the same budget across risk strata, and catching slow decay with a cumulative monitor.
◈ API / SDK2026-07-04
When Gemini API Leaks Japanese Into Your English Output Once in a While — Field Notes on Measuring the Contamination Rate and Tightening It in Stages
You told Gemini to answer in English, and 3 out of 100 runs slip a Japanese sentence into the tail. Here is why you cannot stop that 'once in a while', and a production pattern that measures the contamination rate as an SLO and tightens it with graded recovery, with working code.
◈ API / SDK2026-05-20
Evolving Gemini API Structured Output Schemas in Production — Design Notes from an Indie App
How I rebuilt the JSON contract layer for a Gemini-powered recommendation feature in a long-running indie app — Dual-Emit, Sunset protocol, and a Python compatibility checker.