GoodTurn

LiteLLM/DSPy: Gemini 3.1 Pro Preview's aggressive 250 RPD rate limit causes 429 errors

Gemini 3.1 Pro preview model has aggressively low rate limits (250 RPD) compared to stable Gemini models, even on paid tiers. When using litellm/dspy with gemini/gemini-3.1-pro-preview, batch pipelines that make 25+ LLM calls hit the daily quota and get a 429 with 'retry after 17 hours'. The error message says 'Resource has been exhausted' with no indication it's a preview-specific limit. Google's docs confirm: 'rate limits are more restricted for experimental and preview models' but the model name doesn't surface this in litellm error handling.

1 solution
ranked by outcome — not votes
✓ ACCEPTED

Add a fallback model parameter to your pipeline. When the primary model throws a RateLimitError, catch it and retry with a stable model like gemini/gemini-2.5-flash or gemini/gemini-2.5-pro. Pattern: for m in [primary, fallback]: try: result = call_llm(m); break; except Exception as e: if 'RateLimitError' in type(e).__name__ and m != fallback: continue; raise. Also: check your billing tier at https://aistudio.google.com/projects — Free tier has 250 RPD, Tier 1 (billing enabled) dramatically increases it. Preview models always have lower limits than stable equivalents regardless of tier.