mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 11:04:35 +00:00
fix(ai,coding-agent): update antigravity gemini 3.1 models and headers
fixes #1761
This commit is contained in:
parent
be66fe65bc
commit
7bd4c45d81
6 changed files with 49 additions and 35 deletions
|
|
@ -1032,8 +1032,8 @@ async function generateModels() {
|
||||||
const ANTIGRAVITY_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
|
const ANTIGRAVITY_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
|
||||||
const antigravityModels: Model<"google-gemini-cli">[] = [
|
const antigravityModels: Model<"google-gemini-cli">[] = [
|
||||||
{
|
{
|
||||||
id: "gemini-3-pro-high",
|
id: "gemini-3.1-pro-high",
|
||||||
name: "Gemini 3 Pro High (Antigravity)",
|
name: "Gemini 3.1 Pro High (Antigravity)",
|
||||||
api: "google-gemini-cli",
|
api: "google-gemini-cli",
|
||||||
provider: "google-antigravity",
|
provider: "google-antigravity",
|
||||||
baseUrl: ANTIGRAVITY_ENDPOINT,
|
baseUrl: ANTIGRAVITY_ENDPOINT,
|
||||||
|
|
@ -1045,8 +1045,8 @@ async function generateModels() {
|
||||||
maxTokens: 65535,
|
maxTokens: 65535,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "gemini-3-pro-low",
|
id: "gemini-3.1-pro-low",
|
||||||
name: "Gemini 3 Pro Low (Antigravity)",
|
name: "Gemini 3.1 Pro Low (Antigravity)",
|
||||||
api: "google-gemini-cli",
|
api: "google-gemini-cli",
|
||||||
provider: "google-antigravity",
|
provider: "google-antigravity",
|
||||||
baseUrl: ANTIGRAVITY_ENDPOINT,
|
baseUrl: ANTIGRAVITY_ENDPOINT,
|
||||||
|
|
|
||||||
|
|
@ -3360,9 +3360,9 @@ export const MODELS = {
|
||||||
contextWindow: 1048576,
|
contextWindow: 1048576,
|
||||||
maxTokens: 65535,
|
maxTokens: 65535,
|
||||||
} satisfies Model<"google-gemini-cli">,
|
} satisfies Model<"google-gemini-cli">,
|
||||||
"gemini-3-pro-high": {
|
"gemini-3.1-pro-high": {
|
||||||
id: "gemini-3-pro-high",
|
id: "gemini-3.1-pro-high",
|
||||||
name: "Gemini 3 Pro High (Antigravity)",
|
name: "Gemini 3.1 Pro High (Antigravity)",
|
||||||
api: "google-gemini-cli",
|
api: "google-gemini-cli",
|
||||||
provider: "google-antigravity",
|
provider: "google-antigravity",
|
||||||
baseUrl: "https://daily-cloudcode-pa.sandbox.googleapis.com",
|
baseUrl: "https://daily-cloudcode-pa.sandbox.googleapis.com",
|
||||||
|
|
@ -3377,9 +3377,9 @@ export const MODELS = {
|
||||||
contextWindow: 1048576,
|
contextWindow: 1048576,
|
||||||
maxTokens: 65535,
|
maxTokens: 65535,
|
||||||
} satisfies Model<"google-gemini-cli">,
|
} satisfies Model<"google-gemini-cli">,
|
||||||
"gemini-3-pro-low": {
|
"gemini-3.1-pro-low": {
|
||||||
id: "gemini-3-pro-low",
|
id: "gemini-3.1-pro-low",
|
||||||
name: "Gemini 3 Pro Low (Antigravity)",
|
name: "Gemini 3.1 Pro Low (Antigravity)",
|
||||||
api: "google-gemini-cli",
|
api: "google-gemini-cli",
|
||||||
provider: "google-antigravity",
|
provider: "google-antigravity",
|
||||||
baseUrl: "https://daily-cloudcode-pa.sandbox.googleapis.com",
|
baseUrl: "https://daily-cloudcode-pa.sandbox.googleapis.com",
|
||||||
|
|
@ -9548,9 +9548,9 @@ export const MODELS = {
|
||||||
reasoning: true,
|
reasoning: true,
|
||||||
input: ["text", "image"],
|
input: ["text", "image"],
|
||||||
cost: {
|
cost: {
|
||||||
input: 0.39999999999999997,
|
input: 0.3,
|
||||||
output: 3.1999999999999997,
|
output: 2.4,
|
||||||
cacheRead: 0,
|
cacheRead: 0.3,
|
||||||
cacheWrite: 0,
|
cacheWrite: 0,
|
||||||
},
|
},
|
||||||
contextWindow: 262144,
|
contextWindow: 262144,
|
||||||
|
|
@ -9565,9 +9565,9 @@ export const MODELS = {
|
||||||
reasoning: true,
|
reasoning: true,
|
||||||
input: ["text", "image"],
|
input: ["text", "image"],
|
||||||
cost: {
|
cost: {
|
||||||
input: 0.3,
|
input: 0.27,
|
||||||
output: 2.4,
|
output: 2.16,
|
||||||
cacheRead: 0,
|
cacheRead: 0.27,
|
||||||
cacheWrite: 0,
|
cacheWrite: 0,
|
||||||
},
|
},
|
||||||
contextWindow: 262144,
|
contextWindow: 262144,
|
||||||
|
|
@ -9582,13 +9582,13 @@ export const MODELS = {
|
||||||
reasoning: true,
|
reasoning: true,
|
||||||
input: ["text", "image"],
|
input: ["text", "image"],
|
||||||
cost: {
|
cost: {
|
||||||
input: 0.25,
|
input: 0.22499999999999998,
|
||||||
output: 1,
|
output: 1.7999999999999998,
|
||||||
cacheRead: 0,
|
cacheRead: 0.22499999999999998,
|
||||||
cacheWrite: 0,
|
cacheWrite: 0,
|
||||||
},
|
},
|
||||||
contextWindow: 262144,
|
contextWindow: 262144,
|
||||||
maxTokens: 262144,
|
maxTokens: 65536,
|
||||||
} satisfies Model<"openai-completions">,
|
} satisfies Model<"openai-completions">,
|
||||||
"qwen/qwen3.5-397b-a17b": {
|
"qwen/qwen3.5-397b-a17b": {
|
||||||
id: "qwen/qwen3.5-397b-a17b",
|
id: "qwen/qwen3.5-397b-a17b",
|
||||||
|
|
@ -9794,18 +9794,18 @@ export const MODELS = {
|
||||||
contextWindow: 163840,
|
contextWindow: 163840,
|
||||||
maxTokens: 163840,
|
maxTokens: 163840,
|
||||||
} satisfies Model<"openai-completions">,
|
} satisfies Model<"openai-completions">,
|
||||||
"upstage/solar-pro-3:free": {
|
"upstage/solar-pro-3": {
|
||||||
id: "upstage/solar-pro-3:free",
|
id: "upstage/solar-pro-3",
|
||||||
name: "Upstage: Solar Pro 3 (free)",
|
name: "Upstage: Solar Pro 3",
|
||||||
api: "openai-completions",
|
api: "openai-completions",
|
||||||
provider: "openrouter",
|
provider: "openrouter",
|
||||||
baseUrl: "https://openrouter.ai/api/v1",
|
baseUrl: "https://openrouter.ai/api/v1",
|
||||||
reasoning: true,
|
reasoning: true,
|
||||||
input: ["text"],
|
input: ["text"],
|
||||||
cost: {
|
cost: {
|
||||||
input: 0,
|
input: 0.15,
|
||||||
output: 0,
|
output: 0.6,
|
||||||
cacheRead: 0,
|
cacheRead: 0.015,
|
||||||
cacheWrite: 0,
|
cacheWrite: 0,
|
||||||
},
|
},
|
||||||
contextWindow: 128000,
|
contextWindow: 128000,
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ const GEMINI_CLI_HEADERS = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Headers for Antigravity (sandbox endpoint) - requires specific User-Agent
|
// 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() {
|
function getAntigravityHeaders() {
|
||||||
const version = process.env.PI_AI_ANTIGRAVITY_VERSION || DEFAULT_ANTIGRAVITY_VERSION;
|
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");
|
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.)
|
* 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)!;
|
const effort = clampReasoning(options.reasoning)!;
|
||||||
if (model.id.includes("3-pro") || model.id.includes("3-flash")) {
|
if (isGemini3Model(model.id)) {
|
||||||
return streamGoogleGeminiCli(model, context, {
|
return streamGoogleGeminiCli(model, context, {
|
||||||
...base,
|
...base,
|
||||||
thinking: {
|
thinking: {
|
||||||
|
|
@ -917,7 +929,7 @@ export function buildRequest(
|
||||||
type ClampedThinkingLevel = Exclude<ThinkingLevel, "xhigh">;
|
type ClampedThinkingLevel = Exclude<ThinkingLevel, "xhigh">;
|
||||||
|
|
||||||
function getGeminiCliThinkingLevel(effort: ClampedThinkingLevel, modelId: string): GoogleThinkingLevel {
|
function getGeminiCliThinkingLevel(effort: ClampedThinkingLevel, modelId: string): GoogleThinkingLevel {
|
||||||
if (modelId.includes("3-pro")) {
|
if (isGemini3ProModel(modelId)) {
|
||||||
switch (effort) {
|
switch (effort) {
|
||||||
case "minimal":
|
case "minimal":
|
||||||
case "low":
|
case "low":
|
||||||
|
|
|
||||||
|
|
@ -1032,8 +1032,8 @@ describe("Generate E2E Tests", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Google Antigravity Provider (gemini-3-pro-high)", () => {
|
describe("Google Antigravity Provider (gemini-3.1-pro-high)", () => {
|
||||||
const llm = getModel("google-antigravity", "gemini-3-pro-high");
|
const llm = getModel("google-antigravity", "gemini-3.1-pro-high");
|
||||||
|
|
||||||
it.skipIf(!antigravityToken)("should complete basic text generation", { retry: 3 }, async () => {
|
it.skipIf(!antigravityToken)("should complete basic text generation", { retry: 3 }, async () => {
|
||||||
await basicTextGeneration(llm, { apiKey: antigravityToken });
|
await basicTextGeneration(llm, { apiKey: antigravityToken });
|
||||||
|
|
@ -1064,8 +1064,8 @@ describe("Generate E2E Tests", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Google Antigravity Provider (gemini-3-pro-high with thinkingLevel)", () => {
|
describe("Google Antigravity Provider (gemini-3.1-pro-high with thinkingLevel)", () => {
|
||||||
const llm = getModel("google-antigravity", "gemini-3-pro-high");
|
const llm = getModel("google-antigravity", "gemini-3.1-pro-high");
|
||||||
|
|
||||||
it.skipIf(!antigravityToken)("should handle thinking with thinkingLevel HIGH", { retry: 3 }, async () => {
|
it.skipIf(!antigravityToken)("should handle thinking with thinkingLevel HIGH", { retry: 3 }, async () => {
|
||||||
// gemini-3-pro only supports LOW/HIGH
|
// gemini-3-pro only supports LOW/HIGH
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,10 @@ type SaveMode = (typeof SAVE_MODES)[number];
|
||||||
|
|
||||||
const ANTIGRAVITY_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
|
const ANTIGRAVITY_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
|
||||||
|
|
||||||
|
const DEFAULT_ANTIGRAVITY_VERSION = "1.18.3";
|
||||||
|
|
||||||
const ANTIGRAVITY_HEADERS = {
|
const ANTIGRAVITY_HEADERS = {
|
||||||
"User-Agent": "antigravity/1.15.8 darwin/arm64",
|
"User-Agent": `antigravity/${process.env.PI_AI_ANTIGRAVITY_VERSION || DEFAULT_ANTIGRAVITY_VERSION} darwin/arm64`,
|
||||||
"X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
|
"X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
|
||||||
"Client-Metadata": JSON.stringify({
|
"Client-Metadata": JSON.stringify({
|
||||||
ideType: "IDE_UNSPECIFIED",
|
ideType: "IDE_UNSPECIFIED",
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export const defaultModelPerProvider: Record<KnownProvider, string> = {
|
||||||
"openai-codex": "gpt-5.3-codex",
|
"openai-codex": "gpt-5.3-codex",
|
||||||
google: "gemini-2.5-pro",
|
google: "gemini-2.5-pro",
|
||||||
"google-gemini-cli": "gemini-2.5-pro",
|
"google-gemini-cli": "gemini-2.5-pro",
|
||||||
"google-antigravity": "gemini-3-pro-high",
|
"google-antigravity": "gemini-3.1-pro-high",
|
||||||
"google-vertex": "gemini-3-pro-preview",
|
"google-vertex": "gemini-3-pro-preview",
|
||||||
"github-copilot": "gpt-4o",
|
"github-copilot": "gpt-4o",
|
||||||
openrouter: "openai/gpt-5.1-codex",
|
openrouter: "openai/gpt-5.1-codex",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue