fix(ai,coding-agent): update antigravity gemini 3.1 models and headers

fixes #1761
This commit is contained in:
Mario Zechner
2026-03-03 14:54:25 +01:00
parent be66fe65bc
commit 7bd4c45d81
6 changed files with 49 additions and 35 deletions

View File

@@ -72,7 +72,7 @@ const GEMINI_CLI_HEADERS = {
};
// Headers for Antigravity (sandbox endpoint) - requires specific User-Agent
const DEFAULT_ANTIGRAVITY_VERSION = "1.15.8";
const DEFAULT_ANTIGRAVITY_VERSION = "1.18.3";
function getAntigravityHeaders() {
const version = process.env.PI_AI_ANTIGRAVITY_VERSION || DEFAULT_ANTIGRAVITY_VERSION;
@@ -209,6 +209,18 @@ function isClaudeThinkingModel(modelId: string): boolean {
return normalized.includes("claude") && normalized.includes("thinking");
}
function isGemini3ProModel(modelId: string): boolean {
return /gemini-3(?:\.1)?-pro/.test(modelId.toLowerCase());
}
function isGemini3FlashModel(modelId: string): boolean {
return /gemini-3(?:\.1)?-flash/.test(modelId.toLowerCase());
}
function isGemini3Model(modelId: string): boolean {
return isGemini3ProModel(modelId) || isGemini3FlashModel(modelId);
}
/**
* Check if an error is retryable (rate limit, server error, network error, etc.)
*/
@@ -794,7 +806,7 @@ export const streamSimpleGoogleGeminiCli: StreamFunction<"google-gemini-cli", Si
}
const effort = clampReasoning(options.reasoning)!;
if (model.id.includes("3-pro") || model.id.includes("3-flash")) {
if (isGemini3Model(model.id)) {
return streamGoogleGeminiCli(model, context, {
...base,
thinking: {
@@ -917,7 +929,7 @@ export function buildRequest(
type ClampedThinkingLevel = Exclude<ThinkingLevel, "xhigh">;
function getGeminiCliThinkingLevel(effort: ClampedThinkingLevel, modelId: string): GoogleThinkingLevel {
if (modelId.includes("3-pro")) {
if (isGemini3ProModel(modelId)) {
switch (effort) {
case "minimal":
case "low":