jayeeed/gemini-rotate — reverse-engineered prompt

Reverse engineered prompt

Build me a small Python library that makes Google Gemini calls more reliable when I have multiple API keys. I want to drop a few keys into a local env file, then use one simple client for normal text generation and streaming responses. If a key hits quota limits, permission problems, or other request errors, it should automatically try the next key. If the model keeps failing with server side errors, it should fall back to a lighter model instead of just dying.

Please support both async and regular sync usage, and make the API feel simple, basically one client with methods for generate once and stream chunk by chunk. Keep logging minimal and readable, just enough to show what failed or what succeeded. Add sensible retry behavior with backoff before rotating keys or switching models. It would also be great if it can optionally hook into LangSmith tracing using standard environment settings. Include a clean example and a quick test script so I can run it right away.

Want more depth? Deep Reverse