Skip to content

Migrate off deprecated gemini-2.5-flash and recalibrate AI pricing#90

Merged
zinkh merged 3 commits into
mainfrom
claude/settings-save-api-error-0krhoy
Jul 19, 2026
Merged

Migrate off deprecated gemini-2.5-flash and recalibrate AI pricing#90
zinkh merged 3 commits into
mainfrom
claude/settings-save-api-error-0krhoy

Conversation

@zinkh

@zinkh zinkh commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Google stopped serving gemini-2.5-flash to new API keys/projects starting July 9 2026 (ahead of its official Oct 16 2026 shutdown) — confirmed by the exact 404 this app hit on POST /api/agents/:id/chat. Migrated both call sites (agent chat, and the CCTP "suggest articles" endpoint, which shares the same API key/billing pipeline and was almost certainly broken too) to gemini-3-flash-preview.
  • Recalibrated the AI-credit pricing defaults (AI_PRICE_INPUT_PER_M / AI_PRICE_OUTPUT_PER_M) for the new model's actual Google cost ($0.50/$3.00 per M tokens vs the old $0.30/$2.50), preserving the input-side markup (~1.333x) on both input and output — output was previously priced below cost (~0.66x markup, subsidized by input), now unsubsidized at the same ~1.333x factor: €0.67/M input, €4.00/M output (was €0.40/€1.65).

Test plan

  • npm run lint (tsc --noEmit) passes
  • Manually retest agent chat and CCTP article suggestion once deployed
  • Confirm production AI_PRICE_INPUT_PER_M/AI_PRICE_OUTPUT_PER_M env vars (if set explicitly, overriding these code defaults) are updated to match

Generated by Claude Code

claude added 3 commits July 19, 2026 06:14
Google stopped serving gemini-2.5-flash to new API keys/projects
starting July 9 2026 ahead of its official Oct 16 2026 shutdown date —
confirmed by the exact 404 this app hit on POST /api/agents/:id/chat.
The same hardcoded model string was also used by the CCTP
"suggest articles" endpoint (server.ts), sharing the same GEMINI_API_KEY
and billing pipeline — almost certainly broken too, just not yet
reported. Both switched to gemini-3-flash-preview, Google's recommended
near-term migration target and the newest model the installed
@google/genai SDK version's own types already list.

Note: gemini-3-flash-preview costs more than the old 2.5-flash
($0.50/$3.00 per M input/output tokens vs ~$0.30/$2.50) — the app's
AI-credit pricing (AI_PRICE_INPUT_PER_M / AI_PRICE_OUTPUT_PER_M env
vars, currently €0.40/€1.65 per M, calibrated to the old model) was
deliberately left untouched since that's a pricing decision, not a bug
fix — worth revisiting to stay profitable at the new cost.
Preserves the existing markup rather than letting it silently drift
after the gemini-2.5-flash -> gemini-3-flash-preview migration:
- input:  €0.40 (was ~1.333x Google's $0.30) -> €0.67 (~1.333x of $0.50)
- output: €1.65 (was ~0.66x Google's $2.50)  -> €1.98 (~0.66x of $3.00)

Only changes the process.env fallback defaults — if AI_PRICE_INPUT_PER_M
/ AI_PRICE_OUTPUT_PER_M are set explicitly in the actual deployment
environment, those still take precedence and need updating there too.
Output was priced at a ~0.66x markup on Google's cost (i.e. below cost,
subsidized by the input side's ~1.333x markup) — both now use the same
~1.333x factor: €4.00/M output (was €1.98), applied to
gemini-3-flash-preview's $3.00/M Google cost. Input unchanged (€0.67).
@zinkh
zinkh merged commit 477198c into main Jul 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants