Skip to content

Commit 64e6086

Browse files
committed
feat: add Gemini free tier models with -free aliases
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).
1 parent fc70012 commit 64e6086

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

packages/types/src/providers/gemini.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,4 +295,47 @@ export const geminiModels = {
295295
supportsReasoningBudget: true,
296296
maxThinkingTokens: 24_576,
297297
},
298+
"gemini-2.5-pro-free": {
299+
maxTokens: 64_000,
300+
contextWindow: 250_000,
301+
supportsImages: true,
302+
supportsPromptCache: true,
303+
inputPrice: 0,
304+
outputPrice: 0,
305+
cacheReadsPrice: 0,
306+
cacheWritesPrice: 0,
307+
maxThinkingTokens: 32_768,
308+
supportsReasoningBudget: true,
309+
requiredReasoningBudget: true,
310+
description:
311+
"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.",
312+
},
313+
"gemini-2.5-flash-free": {
314+
maxTokens: 64_000,
315+
contextWindow: 250_000,
316+
supportsImages: true,
317+
supportsPromptCache: true,
318+
inputPrice: 0,
319+
outputPrice: 0,
320+
cacheReadsPrice: 0,
321+
cacheWritesPrice: 0,
322+
maxThinkingTokens: 24_576,
323+
supportsReasoningBudget: true,
324+
description:
325+
"Free tier version of Gemini 2.5 Flash with 250K context window and rate limits (10 RPM, 250K TPM, 250 RPD). Set minimum 6 seconds between requests in provider settings to avoid rate limits.",
326+
},
327+
"gemini-2.5-flash-lite-free": {
328+
maxTokens: 64_000,
329+
contextWindow: 250_000,
330+
supportsImages: true,
331+
supportsPromptCache: true,
332+
inputPrice: 0,
333+
outputPrice: 0,
334+
cacheReadsPrice: 0,
335+
cacheWritesPrice: 0,
336+
supportsReasoningBudget: true,
337+
maxThinkingTokens: 24_576,
338+
description:
339+
"Free tier version of Gemini 2.5 Flash Lite with 250K context window and rate limits (15 RPM, 250K TPM, 1000 RPD). Set minimum 4 seconds between requests in provider settings to avoid rate limits.",
340+
},
298341
} as const satisfies Record<string, ModelInfo>

src/api/providers/gemini.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,15 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl
172172
// reasoning model and that reasoning is required to be enabled.
173173
// The actual model ID honored by Gemini's API does not have this
174174
// suffix.
175-
return { id: id.endsWith(":thinking") ? id.replace(":thinking", "") : id, info, ...params }
175+
let apiModelId = id.endsWith(":thinking") ? id.replace(":thinking", "") : id
176+
177+
// The `-free` suffix indicates free tier models with rate limits.
178+
// Map them to their corresponding paid models for API calls.
179+
if (apiModelId.endsWith("-free")) {
180+
apiModelId = apiModelId.replace("-free", "") as GeminiModelId
181+
}
182+
183+
return { id: apiModelId, info, ...params }
176184
}
177185

178186
private extractCitationsOnly(groundingMetadata?: GroundingMetadata): string | null {

0 commit comments

Comments
 (0)