Skip to content

Commit b3f4ff1

Browse files
KrisBraunclaude
andauthored
Add current-generation Gemini models to AIModel and deprecate the 2.x members (#366)
Google has withdrawn most of the Gemini 2.x generation. A `hint` naming one of those models made `ai.prompt()` fail outright, and the speed/cost tiers that resolve without a hint pointed at several of them too, so `{ speed: "capable", cost: "high" }` and neighbouring tiers stopped working. Adds `GEMINI_31_PRO`, `GEMINI_35_FLASH`, and `GEMINI_35_FLASH_LITE`, and marks the `GEMINI_25_*` and `GEMINI_20_*` members deprecated. The deprecated members are kept so twists built against an earlier SDK version still compile, and a hint naming a withdrawn model is now served by its current equivalent instead of erroring. `GEMINI_25_FLASH` is deprecated but not remapped: it still works, and silently substituting a model an author deliberately asked for would be worse than letting it run until it is actually withdrawn. Claude-Session: https://claude.ai/code/session_01Y9GNwKEBkEAoLYzkTngfGk Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent f500e07 commit b3f4ff1

2 files changed

Lines changed: 34 additions & 3 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
"@plotday/twister": minor
3+
---
4+
5+
Added: `AIModel.GEMINI_31_PRO`, `AIModel.GEMINI_35_FLASH`, and
6+
`AIModel.GEMINI_35_FLASH_LITE` for the current generation of Gemini models.
7+
8+
Deprecated: the `GEMINI_25_*` and `GEMINI_20_*` members. Google has withdrawn
9+
most of that generation, so a `hint` naming one of them previously failed the
10+
whole `ai.prompt()` call. The members still exist and still compile, and a hint
11+
naming a withdrawn model is now served by its current equivalent instead of
12+
erroring — but new code should name a 3.x member.
13+
14+
The speed/cost tiers that `ai.prompt()` resolves without a hint have also moved
15+
onto current models, so `{ speed: "capable", cost: "high" }` and the other tiers
16+
that previously mapped to withdrawn Gemini models work again.

‎twister/src/tools/ai.ts‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ export type AICapabilities = {
188188
* prompt: "Summarize this in one sentence: ..."
189189
* });
190190
*
191-
* // Balanced performance - uses GPT-5 Mini or Gemini 2.5 Flash
191+
* // Balanced performance - uses GPT-5 Mini or Gemini 3.5 Flash
192192
* const response = await ai.prompt({
193193
* model: { speed: "balanced", cost: "medium" },
194194
* prompt: "Analyze this data..."
195195
* });
196196
*
197-
* // Most capable - uses models like GPT-5, Claude Sonnet 4.6, or Gemini 2.5 Pro
197+
* // Most capable - uses models like GPT-5, Claude Sonnet 4.6, or Gemini 3.1 Pro
198198
* const response = await ai.prompt({
199199
* model: { speed: "capable", cost: "high" },
200200
* prompt: "Solve this complex reasoning problem..."
@@ -256,11 +256,26 @@ export enum AIModel {
256256
CLAUDE_SONNET_46 = "anthropic/claude-sonnet-4-6",
257257
CLAUDE_HAIKU_45 = "anthropic/claude-haiku-4-5",
258258

259-
// Google models - Gemini 2.x series
259+
// Google models - Gemini 3.x series
260+
GEMINI_31_PRO = "google/gemini-3.1-pro-preview",
261+
GEMINI_35_FLASH = "google/gemini-3.5-flash",
262+
GEMINI_35_FLASH_LITE = "google/gemini-3.5-flash-lite",
263+
264+
// Google models - Gemini 2.x series (superseded)
265+
//
266+
// Google has withdrawn most of this generation. The members are kept so that
267+
// twists built against an earlier SDK version still compile, and a hint
268+
// naming a withdrawn model is transparently served by its 3.x equivalent
269+
// rather than failing — but new code should name a 3.x member directly.
270+
/** @deprecated Withdrawn by Google. Use {@link AIModel.GEMINI_31_PRO}. */
260271
GEMINI_25_PRO = "google/gemini-2.5-pro",
272+
/** @deprecated Superseded. Use {@link AIModel.GEMINI_35_FLASH}. */
261273
GEMINI_25_FLASH = "google/gemini-2.5-flash",
274+
/** @deprecated Withdrawn by Google. Use {@link AIModel.GEMINI_35_FLASH_LITE}. */
262275
GEMINI_25_FLASH_LITE = "google/gemini-2.5-flash-lite",
276+
/** @deprecated Withdrawn by Google. Use {@link AIModel.GEMINI_35_FLASH}. */
263277
GEMINI_20_FLASH = "google/gemini-2.0-flash",
278+
/** @deprecated Withdrawn by Google. Use {@link AIModel.GEMINI_35_FLASH_LITE}. */
264279
GEMINI_20_FLASH_LITE = "google/gemini-2.0-flash-lite",
265280

266281
// Cloudflare Workers AI models - Free/low-cost models running on Cloudflare's network

0 commit comments

Comments
 (0)