What problem does it solve?
This Skill provides a production-ready pattern for integrating AI models (specifically Google Gemini) with automatic fallback, retry logic, and structured output using Zod schemas. It helps you deliver reliable AI generation even when models are overloaded or rate-limited, while returning type-safe results.
Core Features & Use Cases
- Model Cascade: Auto-fallback: lite → flash → pro to maximize uptime.
- Structured Output: Convert Zod schemas to Gemini-compatible formats for safe consumption.
- Retry Logic: Automatic retries on 503/429 errors to recover from transient failures.
- Observability: Token usage metrics for monitoring and cost control.
- Timeouts & Error Handling: Timeouts prevent hangs; errors categorized as retryable vs fatal.
Quick Start
Use this skill by creating a Gemini client, configuring the cascade, and calling generateWithFallback(prompt, config). Provide a prompt like "Summarize Q3 revenue while preserving structured fields" and observe a typed, JSON-like result.