Add Gemini 3 preview models to google-gemini-cli provider

- Add gemini-3-pro-preview and gemini-3-flash-preview to Cloud Code Assist
- Handle thinkingLevel config for Gemini 3 (vs thinkingBudget for Gemini 2.x)
- Gemini 3 Pro: LOW/HIGH levels only
- Gemini 3 Flash: all four levels (MINIMAL/LOW/MEDIUM/HIGH)
This commit is contained in:
Luke Foster 2025-12-20 22:10:47 -06:00
parent 299986f06b
commit ee9b498380
5 changed files with 107 additions and 4 deletions

View file

@ -4,7 +4,7 @@
* Uses the Cloud Code Assist API endpoint to access Gemini and Claude models.
*/
import type { Content, ThinkingConfig } from "@google/genai";
import type { Content, ThinkingConfig, ThinkingLevel } from "@google/genai";
import { calculateCost } from "../models.js";
import type {
Api,
@ -26,6 +26,7 @@ export interface GoogleGeminiCliOptions extends StreamOptions {
thinking?: {
enabled: boolean;
budgetTokens?: number;
level?: ThinkingLevel; // For Gemini 3 models
};
projectId?: string;
}
@ -424,7 +425,10 @@ function buildRequest(
generationConfig.thinkingConfig = {
includeThoughts: true,
};
if (options.thinking.budgetTokens !== undefined) {
// Gemini 3 models use thinkingLevel, older models use thinkingBudget
if (options.thinking.level !== undefined) {
generationConfig.thinkingConfig.thinkingLevel = options.thinking.level;
} else if (options.thinking.budgetTokens !== undefined) {
generationConfig.thinkingConfig.thinkingBudget = options.thinking.budgetTokens;
}
}