Handling 429 / 503 errors from the Gemini API

Yep, can’t even work thanks to this persistent issue.

[GeminiAPI] Stream request failed: 429 {
“error”: {
“code”: 429,
“message”: “No capacity available for model gemini-2.5-pro on the server”,
“status”: “RESOURCE_EXHAUSTED”,
“details”: [
{
@type”: “type.googleapis.com/google.rpc.ErrorInfo”,
“reason”: “MODEL_CAPACITY_EXHAUSTED”,
“domain”: “cloudcode-pa.googleapis.com”,
“metadata”: {
“model”: “gemini-2.5-pro”
}
}
]
}
}