mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-03 18:23:51 +08:00
feat(antigravity): add Gemini 3.8 Flash models and fix endpoint/UA
Root cause: Google's fetchAvailableModels API returns different model catalogs depending on the endpoint. The daily endpoint returns 33 models including Gemini 3.8 Flash series, while the production endpoint only returns 28 models without 3.8. Additionally, the User-Agent header was using a stale Electron-style format (Antigravity/4.3.0) that does not match the real Antigravity client's UA (antigravity/hub/2.12.2), and unnecessary x-client-name / x-client-version headers were being sent. Changes: - Reorder ANTIGRAVITY_ENDPOINTS to try daily endpoint first (matching real Antigravity client behavior) - Update ANTIGRAVITY_USER_AGENT to match the real Antigravity hub UA - Remove unnecessary x-client-name/x-client-version headers - Add Gemini 3.8 Flash (high/medium/low/tiered) to static model list - Add gemini-3.8-flash passthrough in resolveAntigravityModel
This commit is contained in:
@@ -7,23 +7,50 @@ export const ANTIGRAVITY_DAILY_ENDPOINT = "https://daily-cloudcode-pa.googleapis
|
||||
export const ANTIGRAVITY_SANDBOX_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
|
||||
|
||||
export const ANTIGRAVITY_ENDPOINTS = [
|
||||
ANTIGRAVITY_PROD_ENDPOINT,
|
||||
ANTIGRAVITY_DAILY_ENDPOINT,
|
||||
ANTIGRAVITY_PROD_ENDPOINT,
|
||||
ANTIGRAVITY_SANDBOX_ENDPOINT,
|
||||
];
|
||||
|
||||
const FETCH_AVAILABLE_MODELS_PATH = "/v1internal:fetchAvailableModels";
|
||||
export const ANTIGRAVITY_USER_AGENT =
|
||||
"Antigravity/4.3.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/132.0.6834.160 Electron/39.2.3";
|
||||
"antigravity/hub/2.12.2 (aidev_client; os_type=darwin; arch=arm64; cl=975423596)";
|
||||
|
||||
export const ANTIGRAVITY_CLIENT_HEADERS: Record<string, string> = {
|
||||
"x-client-name": "antigravity",
|
||||
"x-client-version": "4.3.0",
|
||||
};
|
||||
export const ANTIGRAVITY_CLIENT_HEADERS: Record<string, string> = {};
|
||||
|
||||
const ANTIGRAVITY_DENYLIST = new Set(["chat_20706", "chat_23310"]);
|
||||
|
||||
export const STATIC_ANTIGRAVITY_MODELS: ModelDefinition[] = [
|
||||
// Gemini 3.8 Series
|
||||
{
|
||||
id: "gemini-3.8-flash-high",
|
||||
displayName: "Gemini 3.8 Flash (High)",
|
||||
capabilities: { images: true },
|
||||
maxOutputTokens: 65536,
|
||||
privateData: { reasoningEfforts: ["low", "medium", "high"] },
|
||||
},
|
||||
{
|
||||
id: "gemini-3.8-flash-medium",
|
||||
displayName: "Gemini 3.8 Flash (Medium)",
|
||||
capabilities: { images: true },
|
||||
maxOutputTokens: 65536,
|
||||
privateData: { reasoningEfforts: ["low", "medium", "high"] },
|
||||
},
|
||||
{
|
||||
id: "gemini-3.8-flash-low",
|
||||
displayName: "Gemini 3.8 Flash (Low)",
|
||||
capabilities: { images: true },
|
||||
maxOutputTokens: 65536,
|
||||
privateData: { reasoningEfforts: ["low", "medium", "high"] },
|
||||
},
|
||||
{
|
||||
id: "gemini-3.8-flash-tiered",
|
||||
displayName: "Gemini 3.8 Flash (Tiered)",
|
||||
capabilities: { images: true },
|
||||
maxOutputTokens: 65536,
|
||||
privateData: { reasoningEfforts: ["low", "medium", "high"] },
|
||||
},
|
||||
|
||||
// Gemini 3.7 Series
|
||||
{
|
||||
id: "gemini-3.7-flash",
|
||||
|
||||
@@ -69,9 +69,11 @@ function resolveAntigravityModel(modelId: string): string {
|
||||
|
||||
// 1. If explicit tier is already specified in the model ID, pass it directly!
|
||||
if (
|
||||
lower.startsWith("gemini-3.8-flash-") ||
|
||||
lower.startsWith("gemini-3.7-flash-") ||
|
||||
lower.startsWith("gemini-3.6-flash-") ||
|
||||
lower.startsWith("gemini-3.1-pro-") ||
|
||||
lower === "gemini-3.8-flash" ||
|
||||
lower === "gemini-3.7-flash" ||
|
||||
lower === "gemini-3.6-flash" ||
|
||||
lower === "gemini-2.5-flash" ||
|
||||
|
||||
Reference in New Issue
Block a user