This repository contains a patched version of the Google Gemini CLI that prevents automatic downgrading from gemini-2.5-pro to gemini-2.5-flash, regardless of latency issues or rate limits.
The following modification was made to the codebase:
- Disabled Auto-Downgrade Logic: Modified
packages/core/src/utils/retry.tsto remove the code that switches from gemini-2.5-pro to gemini-2.5-flash when multiple 429 errors (Too Many Requests) are detected for OAuth users. This keeps the CLI consistently using gemini-2.5-pro even under high latency conditions.
- Consistently uses the more capable gemini-2.5-pro model
- Maintains all original functionality, authentication flows, and rate limit handling
- Only prevents the automatic model fallback, nothing else is affected
- May experience more 429 errors (Too Many Requests) if you hit rate limits
- Response times might be slower during high usage periods, as the pro model is more resource-intensive
The patched Gemini CLI has been installed globally on your system:
- The original
@google/gemini-clipackage was uninstalled - This patched version was built and linked globally
If you wish to revert to the original Gemini CLI:
# Uninstall the patched version
npm uninstall -g @google/gemini-cli
# Install the official version
npm install -g @google/gemini-cliThe patch specifically removes the model fallback logic in the retryWithBackoff function within packages/core/src/utils/retry.ts, which was triggered when:
- A user is authenticated with Google OAuth (personal account)
- Multiple 429 errors are encountered consecutively
- The
onPersistent429callback is available
The removed code would have downgraded from gemini-2.5-pro to gemini-2.5-flash and reset the retry counter. With the patch, the CLI will continue to respect rate limits but won't change models.