fix(gemini): repoint providers off models retired for new API keys#3283
Open
posthog[bot] wants to merge 1 commit into
Open
fix(gemini): repoint providers off models retired for new API keys#3283posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
New Gemini API keys can't use claude-mem: the providers pinned model IDs Google
no longer serves to newly created keys (gemini-2.5-flash-lite default, plus
gemini-2.5-flash / 2.5-pro / 2.0-flash / 2.0-flash-lite) and called them against
the non-beta v1 endpoint, so every generation 404s with NOT_FOUND
("no longer available to new users").
- Switch both Gemini paths from the v1 to the v1beta generateContent endpoint;
current 3.x models and the -latest aliases are only served under v1beta.
- Replace the retired model list with currently-available IDs
(gemini-flash-latest, gemini-flash-lite-latest, gemini-3.5-flash,
gemini-3.1-flash-lite, gemini-3-flash-preview) and default to
gemini-flash-latest, a Google-maintained alias that tracks the current GA
Flash model so it never goes stale on new keys.
- Drop the bogus gemini-3-flash ID (only gemini-3-flash-preview exists).
- Update all four sync points (worker provider type/allow-list, settings
defaults, settings validator, UI dropdown) plus the server-side
GeminiObservationProvider, tests, and docs. A retired configured model now
falls back to the working default, auto-healing users stuck on the old
default persisted in settings.json.
Generated-By: PostHog Code
Task-Id: 2abacff4-9901-4aa2-9f55-b9ec4375d9d8
Contributor
Greptile SummaryThis PR updates Gemini support to use current model IDs and the beta API path. The main changes are:
Confidence Score: 5/5Safe to merge with minimal risk. The changes are narrowly scoped to Gemini endpoint constants, model allow-lists, UI options, generated bundles, docs, and matching tests. No blocking correctness or security issues were found. No files require special attention.
What T-Rex did
Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant User
participant SettingsUI as Settings UI / settings.json
participant Validator as SettingsRoutes validator
participant Worker as GeminiProvider
participant Gemini as Google Gemini v1beta
User->>SettingsUI: Select Gemini model or keep default
SettingsUI->>Validator: POST /api/settings with CLAUDE_MEM_GEMINI_MODEL
Validator-->>SettingsUI: Accept refreshed model allow-list
Worker->>SettingsUI: Load settings/defaults
alt Saved model is valid
Worker->>Worker: Use configured model
else Saved retired/unknown model
Worker->>Worker: Warn and fall back to gemini-flash-latest
end
Worker->>Gemini: "POST /v1beta/models/{model}:generateContent"
Gemini-->>Worker: Generated observations or provider error
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant User
participant SettingsUI as Settings UI / settings.json
participant Validator as SettingsRoutes validator
participant Worker as GeminiProvider
participant Gemini as Google Gemini v1beta
User->>SettingsUI: Select Gemini model or keep default
SettingsUI->>Validator: POST /api/settings with CLAUDE_MEM_GEMINI_MODEL
Validator-->>SettingsUI: Accept refreshed model allow-list
Worker->>SettingsUI: Load settings/defaults
alt Saved model is valid
Worker->>Worker: Use configured model
else Saved retired/unknown model
Worker->>Worker: Warn and fall back to gemini-flash-latest
end
Worker->>Gemini: "POST /v1beta/models/{model}:generateContent"
Gemini-->>Worker: Generated observations or provider error
Reviews (1): Last reviewed commit: "fix(gemini): repoint providers off model..." | Re-trigger Greptile |
monikabielak12-lgtm
approved these changes
Jul 16, 2026
thedotmack
approved these changes
Jul 20, 2026
thedotmack
marked this pull request as ready for review
July 20, 2026 06:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the Gemini provider being completely broken for users with freshly created Google API keys.
Why
New keys default to
gemini-2.5-flash-lite, which Google now 404s withNOT_FOUND("no longer available to new users"), so memory generation silently fails for the affected cohort. The providers also hard-coded several other retired IDs (gemini-2.5-flash,gemini-2.5-pro,gemini-2.0-flash,gemini-2.0-flash-lite) and called them against the non-betav1endpoint.What changed
v1→v1betain bothGeminiProvider.tsandGeminiObservationProvider.ts— the current 3.x models and the-latestaliases are only served underv1beta.gemini-flash-latest,gemini-flash-lite-latest,gemini-3.5-flash,gemini-3.1-flash-lite,gemini-3-flash-preview. Default is nowgemini-flash-latest, a Google-maintained alias that tracks the current GA Flash model, so it won't go stale on new keys the next time Google rotates models.gemini-3-flashID (onlygemini-3-flash-previewexists) that the earlier code carried.SettingsDefaultsManager+ui/viewer/constants/settings.ts,SettingsRoutesvalidator,ContextSettingsModaldropdown), plus tests, docs, and the builtplugin/bundles.A retired model already saved in
settings.jsonnow falls back to the working default with a warning, auto-healing users stuck on the old broken default.Note vs. the issue's suggestion:
gemini-3.5-flash/gemini-3.1-flash-liteare real, GA model IDs (verified against Google's model docs), so they're included;gemini-3-flash(no-preview) is not a real ID and was removed.Closes #3278
Created with PostHog Code from an inbox report.