fix: use Gemini v1 API endpoint instead of v1beta (#1082)
v1beta does not support newer models like gemini-3-flash, causing silent 404 errors that back up the observation queue indefinitely. Users with CLAUDE_MEM_GEMINI_MODEL=gemini-3-flash get zero observations stored, with no visible error — the queue just grows silently. Changes: - Switch API URL from v1beta/models to v1/models (generateContent works identically on both endpoints) - Add gemini-3-flash to GeminiModel type and RPM limits - Update test to match new endpoint Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,8 +28,9 @@ import {
|
||||
type FallbackAgent
|
||||
} from './agents/index.js';
|
||||
|
||||
// Gemini API endpoint
|
||||
const GEMINI_API_URL = 'https://generativelanguage.googleapis.com/v1beta/models';
|
||||
// Gemini API endpoint — use v1 (stable), not v1beta.
|
||||
// v1beta does not support newer models like gemini-3-flash.
|
||||
const GEMINI_API_URL = 'https://generativelanguage.googleapis.com/v1/models';
|
||||
|
||||
// Gemini model types (available via API)
|
||||
export type GeminiModel =
|
||||
@@ -38,6 +39,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)
|
||||
@@ -47,6 +49,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': 10,
|
||||
'gemini-3-flash-preview': 5,
|
||||
};
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ describe('GeminiAgent', () => {
|
||||
|
||||
expect(global.fetch).toHaveBeenCalledTimes(1);
|
||||
const url = (global.fetch as any).mock.calls[0][0];
|
||||
expect(url).toContain('https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent');
|
||||
expect(url).toContain('https://generativelanguage.googleapis.com/v1/models/gemini-2.5-flash-lite:generateContent');
|
||||
expect(url).toContain('key=test-api-key');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user