fix: correct Gemini model name from gemini-3-flash to gemini-3-flash-preview

The Gemini API requires the -preview suffix for the Gemini 3 Flash model.
gemini-3-flash does not exist - only gemini-3-flash-preview is available.
This was causing 404 errors when users selected this model option.

Closes #831

Co-Authored-By: Glucksberg <markuscontasul@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-02-06 02:55:30 -05:00
parent 8de8afbab8
commit 91e1d5baad
9 changed files with 24 additions and 24 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ Settings are managed in `~/.claude-mem/settings.json`. The file is auto-created
| Setting | Default | Description |
|-------------------------------|---------------------------------|---------------------------------------|
| `CLAUDE_MEM_GEMINI_API_KEY` | — | Gemini API key ([get free key](https://aistudio.google.com/app/apikey)) |
| `CLAUDE_MEM_GEMINI_MODEL` | `gemini-2.5-flash-lite` | Gemini model: `gemini-2.5-flash-lite`, `gemini-2.5-flash`, `gemini-3-flash` |
| `CLAUDE_MEM_GEMINI_MODEL` | `gemini-2.5-flash-lite` | Gemini model: `gemini-2.5-flash-lite`, `gemini-2.5-flash`, `gemini-3-flash-preview` |
See [Gemini Provider](usage/gemini-provider) for detailed configuration and free tier information.
+1 -1
View File
@@ -103,7 +103,7 @@ Open http://localhost:37777 to see the memory viewer.
|-------|---------------|-------|
| `gemini-2.5-flash-lite` | 10 (4,000 with billing) | **Default.** Fastest, highest free tier RPM |
| `gemini-2.5-flash` | 5 (1,000 with billing) | Higher capability |
| `gemini-3-flash` | 5 (1,000 with billing) | Latest model |
| `gemini-3-flash-preview` | 5 (1,000 with billing) | Latest model |
To change the model, update your settings:
+4 -4
View File
@@ -39,7 +39,7 @@ Claude-mem supports Google's Gemini API as an alternative to the Claude Agent SD
|---------|--------|---------|-------------|
| `CLAUDE_MEM_PROVIDER` | `claude`, `gemini` | `claude` | AI provider for observation extraction |
| `CLAUDE_MEM_GEMINI_API_KEY` | string | — | Your Gemini API key |
| `CLAUDE_MEM_GEMINI_MODEL` | `gemini-2.5-flash-lite`, `gemini-2.5-flash`, `gemini-3-flash` | `gemini-2.5-flash-lite` | Gemini model to use |
| `CLAUDE_MEM_GEMINI_MODEL` | `gemini-2.5-flash-lite`, `gemini-2.5-flash`, `gemini-3-flash-preview` | `gemini-2.5-flash-lite` | Gemini model to use |
| `CLAUDE_MEM_GEMINI_BILLING_ENABLED` | `true`, `false` | `false` | Skip rate limiting if billing is enabled on Google Cloud |
### Using the Settings UI
@@ -79,7 +79,7 @@ The settings file takes precedence over the environment variable.
|-------|--------------|-------|
| `gemini-2.5-flash-lite` | 10 | Default, recommended for free tier (highest RPM) |
| `gemini-2.5-flash` | 5 | Higher capability, lower rate limit |
| `gemini-3-flash` | 5 | Latest model, lower rate limit |
| `gemini-3-flash-preview` | 5 | Latest model, lower rate limit |
## Provider Switching
@@ -139,7 +139,7 @@ Google has two rate limit tiers for free usage:
|-------|-----|-----|
| gemini-2.5-flash-lite | 10 | 250K |
| gemini-2.5-flash | 5 | 250K |
| gemini-3-flash | 5 | 250K |
| gemini-3-flash-preview | 5 | 250K |
Claude-mem enforces these limits automatically with built-in delays between requests. Processing may be slower but stays within limits.
@@ -149,7 +149,7 @@ Claude-mem enforces these limits automatically with built-in delays between requ
|-------|-----|-----|
| gemini-2.5-flash-lite | 4,000 | 4M |
| gemini-2.5-flash | 1,000 | 1M |
| gemini-3-flash | 1,000 | 1M |
| gemini-3-flash-preview | 1,000 | 1M |
<Tip>
**Recommended**: Enable billing on your Google Cloud project to unlock much higher rate limits. You won't be charged unless you exceed the generous free quota. This allows claude-mem to process observations instantly instead of waiting between requests.
+3 -3
View File
@@ -38,7 +38,7 @@ export type GeminiModel =
| 'gemini-2.5-pro'
| 'gemini-2.0-flash'
| 'gemini-2.0-flash-lite'
| 'gemini-3-flash';
| 'gemini-3-flash-preview';
// Free tier RPM limits by model (requests per minute)
const GEMINI_RPM_LIMITS: Record<GeminiModel, number> = {
@@ -47,7 +47,7 @@ const GEMINI_RPM_LIMITS: Record<GeminiModel, number> = {
'gemini-2.5-pro': 5,
'gemini-2.0-flash': 15,
'gemini-2.0-flash-lite': 30,
'gemini-3-flash': 5,
'gemini-3-flash-preview': 5,
};
// Track last request time for rate limiting
@@ -406,7 +406,7 @@ export class GeminiAgent {
'gemini-2.5-pro',
'gemini-2.0-flash',
'gemini-2.0-flash-lite',
'gemini-3-flash',
'gemini-3-flash-preview',
];
let model: GeminiModel;
@@ -242,9 +242,9 @@ export class SettingsRoutes extends BaseRouteHandler {
// Validate CLAUDE_MEM_GEMINI_MODEL
if (settings.CLAUDE_MEM_GEMINI_MODEL) {
const validGeminiModels = ['gemini-2.5-flash-lite', 'gemini-2.5-flash', 'gemini-3-flash'];
const validGeminiModels = ['gemini-2.5-flash-lite', 'gemini-2.5-flash', 'gemini-3-flash-preview'];
if (!validGeminiModels.includes(settings.CLAUDE_MEM_GEMINI_MODEL)) {
return { valid: false, error: 'CLAUDE_MEM_GEMINI_MODEL must be one of: gemini-2.5-flash-lite, gemini-2.5-flash, gemini-3-flash' };
return { valid: false, error: 'CLAUDE_MEM_GEMINI_MODEL must be one of: gemini-2.5-flash-lite, gemini-2.5-flash, gemini-3-flash-preview' };
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ export interface SettingsDefaults {
CLAUDE_MEM_PROVIDER: string; // 'claude' | 'gemini' | 'openrouter'
CLAUDE_MEM_CLAUDE_AUTH_METHOD: string; // 'cli' | 'api' - how Claude provider authenticates
CLAUDE_MEM_GEMINI_API_KEY: string;
CLAUDE_MEM_GEMINI_MODEL: string; // 'gemini-2.5-flash-lite' | 'gemini-2.5-flash' | 'gemini-3-flash'
CLAUDE_MEM_GEMINI_MODEL: string; // 'gemini-2.5-flash-lite' | 'gemini-2.5-flash' | 'gemini-3-flash-preview'
CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED: string; // 'true' | 'false' - enable rate limiting for free tier
CLAUDE_MEM_OPENROUTER_API_KEY: string;
CLAUDE_MEM_OPENROUTER_MODEL: string;
@@ -465,7 +465,7 @@ export function ContextSettingsModal({
>
<option value="gemini-2.5-flash-lite">gemini-2.5-flash-lite (10 RPM free)</option>
<option value="gemini-2.5-flash">gemini-2.5-flash (5 RPM free)</option>
<option value="gemini-3-flash">gemini-3-flash (5 RPM free)</option>
<option value="gemini-3-flash-preview">gemini-3-flash-preview (5 RPM free)</option>
</select>
</FormField>
<div className="toggle-group" style={{ marginTop: '8px' }}>
+1 -1
View File
@@ -63,7 +63,7 @@ export interface Settings {
// AI Provider Configuration
CLAUDE_MEM_PROVIDER?: string; // 'claude' | 'gemini' | 'openrouter'
CLAUDE_MEM_GEMINI_API_KEY?: string;
CLAUDE_MEM_GEMINI_MODEL?: string; // 'gemini-2.5-flash-lite' | 'gemini-2.5-flash' | 'gemini-3-flash'
CLAUDE_MEM_GEMINI_MODEL?: string; // 'gemini-2.5-flash-lite' | 'gemini-2.5-flash' | 'gemini-3-flash-preview'
CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED?: string; // 'true' | 'false'
CLAUDE_MEM_OPENROUTER_API_KEY?: string;
CLAUDE_MEM_OPENROUTER_MODEL?: string;
+10 -10
View File
@@ -349,27 +349,27 @@ describe('GeminiAgent', () => {
}
});
describe('gemini-3-flash model support', () => {
it('should accept gemini-3-flash as a valid model', async () => {
// The GeminiModel type includes gemini-3-flash - compile-time check
describe('gemini-3-flash-preview model support', () => {
it('should accept gemini-3-flash-preview as a valid model', async () => {
// The GeminiModel type includes gemini-3-flash-preview - compile-time check
const validModels = [
'gemini-2.5-flash-lite',
'gemini-2.5-flash',
'gemini-2.5-pro',
'gemini-2.0-flash',
'gemini-2.0-flash-lite',
'gemini-3-flash'
'gemini-3-flash-preview'
];
// Verify all models are strings (type guard)
expect(validModels.every(m => typeof m === 'string')).toBe(true);
expect(validModels).toContain('gemini-3-flash');
expect(validModels).toContain('gemini-3-flash-preview');
});
it('should have rate limit defined for gemini-3-flash', async () => {
// GEMINI_RPM_LIMITS['gemini-3-flash'] = 5
it('should have rate limit defined for gemini-3-flash-preview', async () => {
// GEMINI_RPM_LIMITS['gemini-3-flash-preview'] = 5
// This is enforced at compile time, but we can test the rate limiting behavior
// by checking that the rate limit is applied when using gemini-3-flash
// by checking that the rate limit is applied when using gemini-3-flash-preview
const session = {
sessionDbId: 1,
contentSessionId: 'test-session',
@@ -393,8 +393,8 @@ describe('GeminiAgent', () => {
usageMetadata: { totalTokenCount: 10 }
}))));
// This validates that gemini-3-flash is a valid model at runtime
// The agent's validation array includes gemini-3-flash
// This validates that gemini-3-flash-preview is a valid model at runtime
// The agent's validation array includes gemini-3-flash-preview
await agent.startSession(session);
expect(global.fetch).toHaveBeenCalled();
});