-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add Gemini free tier models with -free aliases #7361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Gemini free tier models with -free aliases #7361
Conversation
Add three new free tier Gemini models with 250K context windows: - gemini-2.5-pro-free (5 RPM, 250K TPM, 100 RPD) - gemini-2.5-flash-free (10 RPM, 250K TPM, 250 RPD) - gemini-2.5-flash-lite-free (15 RPM, 250K TPM, 1000 RPD) The provider maps -free aliases to base model IDs for API calls while preserving the 250K context limit and $0 pricing in the UI. Descriptions include rate limiting guidance for users to set appropriate delays in provider settings (12s, 6s, 4s respectively).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! I've reviewed the changes and have some suggestions for improvement. The implementation looks clean and follows existing patterns well. The approach of mapping -free aliases to base models is elegant and maintains backward compatibility.
| // The `-free` suffix indicates free tier models with rate limits. | ||
| // Map them to their corresponding paid models for API calls. | ||
| if (apiModelId.endsWith("-free")) { | ||
| apiModelId = apiModelId.replace("-free", "") as GeminiModelId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After replacing the "-free" suffix, the resulting string is cast to GeminiModelId without validation. Could this potentially cause runtime errors if the base model doesn't exist? Consider adding validation to ensure the mapped model ID exists in geminiModels:
| cacheWritesPrice: 0, | ||
| maxThinkingTokens: 32_768, | ||
| supportsReasoningBudget: true, | ||
| requiredReasoningBudget: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intentional that gemini-2.5-pro-free has requiredReasoningBudget: true while the other two free models don't? If free tier models have different reasoning budget requirements, could you clarify why? Otherwise, consider making this consistent across all three free tier models.
| supportsReasoningBudget: true, | ||
| requiredReasoningBudget: true, | ||
| description: | ||
| "Free tier version of Gemini 2.5 Pro with 250K context window and rate limits (5 RPM, 250K TPM, 100 RPD). Set minimum 12 seconds between requests in provider settings to avoid rate limits.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider extracting the rate limit values (5 RPM, 10 RPM, 15 RPM) and recommended delays (12s, 6s, 4s) as constants for better maintainability. This could be useful for potential future rate limiting logic:
| supportsReasoningBudget: true, | ||
| maxThinkingTokens: 24_576, | ||
| }, | ||
| "gemini-2.5-pro-free": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a comment block above the free tier models section explaining the mapping strategy and why the -free suffix approach was chosen. This would help future maintainers understand the design decision:
|
@roomote-agent Can you please fix the test |
|
Looking into the failing test now. I can see the Windows platform unit test is failing. Let me investigate and fix it. |
|
I have investigated the failing test and added comprehensive test coverage for the new Gemini free tier models. The fix includes test cases that verify:
The changes have been pushed to a new branch |
Please make the changes in this branch only don't create new branches |
|
Thank you for your contribution! I'm not sure about how the free tier works. What happens if you exceed the rate limit? Would the user get charged or would the user get an error? |
|
i'll check the unit test issue. |
Add three new free tier Gemini models with 250K context windows:
The provider maps -free aliases to base model IDs for API calls while preserving the 250K context limit and $0 pricing in the UI.
Descriptions include rate limiting guidance for users to set appropriate delays in provider settings (12s, 6s, 4s respectively).
Important
Add new free tier Gemini models with specific rate limits and update API handler to map these models to base model IDs for API calls.
gemini-2.5-pro-free,gemini-2.5-flash-free, andgemini-2.5-flash-lite-freetogeminiModelsingemini.tswith 250K context windows and specific rate limits.getModel()inGeminiHandleringemini.tsto map-freemodel aliases to their base model IDs for API calls.This description was created by
for 64e6086. You can customize this summary. It will automatically update as commits are pushed.