tuxevil-rotator 3.3.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +6 -2
- package/package.json +1 -1
- package/src/compat/model-specs.ts +3 -4
- package/src/compat.ts +22 -14
- package/src/dashboard.ts +4 -4
- package/src/providers/google-antigravity/catalog.ts +3 -5
- package/src/providers/google-antigravity/index.ts +4 -1
- package/src/providers/google-antigravity/quota.ts +6 -4
- package/src/providers/google-antigravity/translators.ts +1 -2
- package/src/providers/ollama/index.ts +5 -2
- package/src/providers/ollama/prediction.ts +1 -1
- package/src/proxy.ts +11 -2
- package/src/rate-limit-parser.ts +12 -3
- package/src/rotator.ts +249 -116
- package/src/spend-logger.ts +2 -2
- package/src/static/dashboard-keys.js +4 -3
- package/src/static/dashboard-logs.js +5 -2
- package/src/static/dashboard.js +68 -51
- package/src/types.ts +57 -63
- package/tools/telemetry-receiver/receiver.js +5 -5
package/src/static/dashboard.js
CHANGED
|
@@ -25,29 +25,23 @@ function timerDisplayLabel(timerType) {
|
|
|
25
25
|
return timerType === "fresh" ? "idle" : timerType;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
// A pool is "idle" (worth kickstarting) when
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// very close to a full 5h or 7d window (the timer exists but hasn't been
|
|
32
|
-
// touched yet — a kickstart request will start consuming from it).
|
|
33
|
-
function isIdleForKickstart(q, now) {
|
|
34
|
-
if (q.timerType === "fresh") return true;
|
|
35
|
-
if (!q.resetTime || q.percentRemaining !== 100) return false;
|
|
36
|
-
var remaining = new Date(q.resetTime).getTime() - now;
|
|
37
|
-
if (remaining <= 0) return false;
|
|
38
|
-
var isRolling5h = Math.abs(remaining - 5 * 3600000) < 600000;
|
|
39
|
-
var isRolling7d = Math.abs(remaining - 7 * 86400000) < 600000;
|
|
40
|
-
return isRolling5h || isRolling7d;
|
|
28
|
+
// A pool is "idle" (worth kickstarting) when it has no active timer running (fresh).
|
|
29
|
+
function isIdleForKickstart(q) {
|
|
30
|
+
return q.timerType === "fresh";
|
|
41
31
|
}
|
|
42
32
|
|
|
43
33
|
function isKickstartSupported(q) {
|
|
44
34
|
if (!q) return false;
|
|
45
|
-
if (q.providerId === "openai-codex") return false;
|
|
35
|
+
if (q.providerId === "openai-codex" || q.providerId === "opencode-zen") return false;
|
|
36
|
+
if (q.providerId === "ollama" && q.modelKey !== "session") return false;
|
|
46
37
|
var key = String(q.modelKey || "");
|
|
47
38
|
return (
|
|
48
39
|
key !== "openai-codex" &&
|
|
49
40
|
key !== "openai-codex-spark" &&
|
|
50
|
-
key.indexOf("openai-codex:") !== 0
|
|
41
|
+
key.indexOf("openai-codex:") !== 0 &&
|
|
42
|
+
key !== "opencode-zen" &&
|
|
43
|
+
key.indexOf("opencode-zen:") !== 0 &&
|
|
44
|
+
key !== "weekly"
|
|
51
45
|
);
|
|
52
46
|
}
|
|
53
47
|
|
|
@@ -76,32 +70,44 @@ function renderQuotaBars(account) {
|
|
|
76
70
|
var sortedQuota = quota.slice().sort(function (a, b) {
|
|
77
71
|
return getQuotaItemProviderRank(a) - getQuotaItemProviderRank(b);
|
|
78
72
|
});
|
|
79
|
-
var
|
|
73
|
+
var accountInactive = account.status === "disabled" || account.status === "flagged";
|
|
80
74
|
var rows = sortedQuota
|
|
81
75
|
.map(function (q) {
|
|
82
76
|
var inFlightForModel = (account.inFlightByModel || {})[q.modelKey] || 0;
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
77
|
+
var idle =
|
|
78
|
+
!accountInactive && isKickstartSupported(q) && isIdleForKickstart(q);
|
|
79
|
+
var actionButton = "";
|
|
80
|
+
if (inFlightForModel > 0) {
|
|
81
|
+
actionButton =
|
|
82
|
+
'<button class="btn-clear-flight" title="Clear in-flight counter for ' +
|
|
83
|
+
escapeHtml(q.displayName) +
|
|
84
|
+
'" onclick="clearInFlight(\'' +
|
|
85
|
+
jsString(account.email) +
|
|
86
|
+
"', '" +
|
|
87
|
+
jsString(q.modelKey) +
|
|
88
|
+
"')\">" +
|
|
89
|
+
"Clear</button>";
|
|
90
|
+
} else if (idle) {
|
|
91
|
+
actionButton =
|
|
92
|
+
'<button class="btn-clear-flight" title="Send minimal request to start idle timer for ' +
|
|
93
|
+
escapeHtml(q.displayName) +
|
|
94
|
+
'" onclick="kickstartTimer(\'' +
|
|
95
|
+
jsString(account.email) +
|
|
96
|
+
"', '" +
|
|
97
|
+
jsString(q.modelKey) +
|
|
98
|
+
"')\">▶ Start</button>";
|
|
99
|
+
} else {
|
|
100
|
+
actionButton =
|
|
101
|
+
'<button class="btn-clear-flight" title="No in-flight requests for ' +
|
|
102
|
+
escapeHtml(q.displayName) +
|
|
103
|
+
'" disabled>Clear</button>';
|
|
104
|
+
}
|
|
98
105
|
var color = quotaBarColor(q.percentRemaining);
|
|
99
106
|
var timerClass = "timer-" + q.timerType;
|
|
100
107
|
var resetLabel = "";
|
|
101
|
-
if (
|
|
102
|
-
// Rolling idle timer already has resetTime set; show "idle" label
|
|
108
|
+
if (q.timerType === "fresh") {
|
|
103
109
|
resetLabel = '<span style="color:var(--text-dim)">idle</span>';
|
|
104
|
-
} else if (q.resetTime
|
|
110
|
+
} else if (q.resetTime) {
|
|
105
111
|
var remaining = new Date(q.resetTime).getTime() - Date.now();
|
|
106
112
|
if (remaining > 0) {
|
|
107
113
|
resetLabel = formatDuration(remaining);
|
|
@@ -126,8 +132,7 @@ function renderQuotaBars(account) {
|
|
|
126
132
|
(resetLabel || "--") +
|
|
127
133
|
"</span>" +
|
|
128
134
|
'<span class="quota-action">' +
|
|
129
|
-
|
|
130
|
-
kickstartBtn +
|
|
135
|
+
actionButton +
|
|
131
136
|
"</span>" +
|
|
132
137
|
"</div>"
|
|
133
138
|
);
|
|
@@ -494,8 +499,10 @@ function renderAccounts(data) {
|
|
|
494
499
|
? "Use Global Fresh Policy"
|
|
495
500
|
: "Allow Fresh On This Account") +
|
|
496
501
|
"</button>" +
|
|
497
|
-
(
|
|
498
|
-
|
|
502
|
+
(a.status !== "disabled" &&
|
|
503
|
+
a.status !== "flagged" &&
|
|
504
|
+
(a.quota || []).some(function (q) {
|
|
505
|
+
return isKickstartSupported(q) && isIdleForKickstart(q);
|
|
499
506
|
})
|
|
500
507
|
? '<button class="btn-enable" onclick="kickstartAllTimers(\'' +
|
|
501
508
|
jsString(a.email) +
|
|
@@ -1072,16 +1079,15 @@ var TOKEN_MODEL_COLORS = {
|
|
|
1072
1079
|
"gemini-3.1-pro-low": "#1d4ed8",
|
|
1073
1080
|
"gemini-3-pro-high": "#1d4ed8",
|
|
1074
1081
|
"gemini-3-pro-low": "#1d4ed8",
|
|
1075
|
-
"gemini-3.5-flash": "#2563eb", // Gemini 3.5 Flash (Azul rey medio)
|
|
1076
|
-
"gemini-3.5-flash-high": "#2563eb",
|
|
1077
|
-
"gemini-3.5-flash-medium": "#2563eb",
|
|
1078
|
-
"gemini-3.5-flash-low": "#2563eb",
|
|
1079
|
-
"gemini-3-flash-agent": "#2563eb",
|
|
1080
1082
|
"gemini-3.6-flash": "#38bdf8", // Gemini 3.6 Flash (Azul cielo brillante)
|
|
1081
1083
|
"gemini-3.6-flash-high": "#38bdf8",
|
|
1082
1084
|
"gemini-3.6-flash-medium": "#38bdf8",
|
|
1083
1085
|
"gemini-3.6-flash-low": "#38bdf8",
|
|
1084
1086
|
"gemini-3.6-flash-tiered": "#38bdf8",
|
|
1087
|
+
"gemini-3.8-flash-high": "#0284c7", // Gemini 3.8 Flash (Azul cielo profundo)
|
|
1088
|
+
"gemini-3.8-flash-medium": "#0284c7",
|
|
1089
|
+
"gemini-3.8-flash-low": "#0284c7",
|
|
1090
|
+
"gemini-3-flash-agent": "#93c5fd",
|
|
1085
1091
|
"gemini-3-flash": "#93c5fd", // Gemini 3 Flash (Azul pastel claro)
|
|
1086
1092
|
|
|
1087
1093
|
// Codex Pool (Amarillos) — de más caro a más barato
|
|
@@ -1125,7 +1131,7 @@ function getModelColor(model) {
|
|
|
1125
1131
|
|
|
1126
1132
|
// Gemini pool (Azules)
|
|
1127
1133
|
if (lower.indexOf("3.1-pro") !== -1 || lower.indexOf("3-pro") !== -1) return "#1d4ed8";
|
|
1128
|
-
if (lower.indexOf("3.
|
|
1134
|
+
if (lower.indexOf("3.8-flash") !== -1) return "#0284c7";
|
|
1129
1135
|
if (lower.indexOf("3.6-flash") !== -1) return "#38bdf8";
|
|
1130
1136
|
if (lower.indexOf("gemini") !== -1 || lower.indexOf("3-flash") !== -1) return "#93c5fd";
|
|
1131
1137
|
|
|
@@ -1164,10 +1170,6 @@ var MODEL_PRICING_CLIENT = {
|
|
|
1164
1170
|
"gemini-3.1-pro-low": { input: 2.0, output: 12.0 },
|
|
1165
1171
|
"gemini-3.1-pro-high": { input: 2.0, output: 12.0 },
|
|
1166
1172
|
"gemini-3-flash": { input: 0.5, output: 3.0 },
|
|
1167
|
-
"gemini-3.5-flash": { input: 1.5, output: 9.0 },
|
|
1168
|
-
"gemini-3.5-flash-low": { input: 1.5, output: 9.0 },
|
|
1169
|
-
"gemini-3.5-flash-medium": { input: 1.5, output: 9.0 },
|
|
1170
|
-
"gemini-3.5-flash-high": { input: 1.5, output: 9.0 },
|
|
1171
1173
|
"gemini-3.6-flash": { input: 1.5, output: 7.5 },
|
|
1172
1174
|
"gemini-3.6-flash-high": { input: 1.5, output: 7.5 },
|
|
1173
1175
|
"gemini-3.6-flash-medium": { input: 1.5, output: 7.5 },
|
|
@@ -1177,6 +1179,11 @@ var MODEL_PRICING_CLIENT = {
|
|
|
1177
1179
|
// Introductory rates through 2026-12-31; from 2027-01-01 these double to
|
|
1178
1180
|
// input 1.50 / output 7.50 per 1M tokens — update this entry then.
|
|
1179
1181
|
"gemini-3.7-flash-tiered": { input: 0.75, output: 3.75 },
|
|
1182
|
+
// Gemini 3.8 Flash introductory rates through 2026-12-31; these also
|
|
1183
|
+
// double to input 1.50 / output 7.50 on 2027-01-01.
|
|
1184
|
+
"gemini-3.8-flash-low": { input: 0.75, output: 3.75 },
|
|
1185
|
+
"gemini-3.8-flash-medium": { input: 0.75, output: 3.75 },
|
|
1186
|
+
"gemini-3.8-flash-high": { input: 0.75, output: 3.75 },
|
|
1180
1187
|
"gpt-oss-120b-medium": { input: 2.0, output: 10.0 },
|
|
1181
1188
|
// OpenAI Codex GPT-5.6 models — mirrors MODEL_PRICING in types.ts.
|
|
1182
1189
|
"gpt-5.6-sol": { input: 5.0, output: 30.0 },
|
|
@@ -1216,9 +1223,9 @@ function getModelPricingClient(m) {
|
|
|
1216
1223
|
var lower = (m || "").toLowerCase();
|
|
1217
1224
|
if (lower.indexOf("opus") !== -1) return MODEL_PRICING_CLIENT["claude-opus-4-6-thinking"];
|
|
1218
1225
|
if (lower.indexOf("sonnet") !== -1) return MODEL_PRICING_CLIENT["claude-sonnet-4-6"];
|
|
1226
|
+
if (lower.indexOf("3.8-flash") !== -1) return MODEL_PRICING_CLIENT["gemini-3.8-flash-high"];
|
|
1219
1227
|
if (lower.indexOf("3.7-flash") !== -1) return MODEL_PRICING_CLIENT["gemini-3.7-flash-tiered"];
|
|
1220
1228
|
if (lower.indexOf("3.6-flash") !== -1) return MODEL_PRICING_CLIENT["gemini-3.6-flash-high"];
|
|
1221
|
-
if (lower.indexOf("3.5-flash") !== -1) return MODEL_PRICING_CLIENT["gemini-3.5-flash-high"];
|
|
1222
1229
|
if (lower.indexOf("flash") !== -1) return MODEL_PRICING_CLIENT["gemini-3-flash"];
|
|
1223
1230
|
if (lower.indexOf("pro") !== -1) return MODEL_PRICING_CLIENT["gemini-3.1-pro"];
|
|
1224
1231
|
return null;
|
|
@@ -1946,7 +1953,7 @@ function renderForecastPanel(data) {
|
|
|
1946
1953
|
function resolveQuotaPoolKey(displayKey) {
|
|
1947
1954
|
var lower = String(displayKey).toLowerCase();
|
|
1948
1955
|
if (lower.indexOf("gemini-3.6-flash") !== -1) return "gemini-3.6-flash";
|
|
1949
|
-
if (lower
|
|
1956
|
+
if (lower === "gemini-3-flash" || lower === "gemini-3-flash-agent") return "gemini-3-flash";
|
|
1950
1957
|
if (lower.indexOf("gemini-3.1-pro") !== -1 || lower.indexOf("gemini-pro") !== -1) return "gemini-3.1-pro";
|
|
1951
1958
|
if (lower.indexOf("claude") !== -1 || lower.indexOf("gpt-oss") !== -1) return "claude-opus-4-6-thinking";
|
|
1952
1959
|
return displayKey;
|
|
@@ -1989,7 +1996,7 @@ function renderForecastPanel(data) {
|
|
|
1989
1996
|
var displayName = m;
|
|
1990
1997
|
if (m === "claude-opus-4-6-thinking") displayName = "claude";
|
|
1991
1998
|
if (m === "gemini-3.1-pro") displayName = "gemini-3.1-pro";
|
|
1992
|
-
if (m === "gemini-3
|
|
1999
|
+
if (m === "gemini-3-flash") displayName = "gemini-3-flash";
|
|
1993
2000
|
|
|
1994
2001
|
var minResetRemaining = null;
|
|
1995
2002
|
q.entries.forEach(function (entry) {
|
|
@@ -2809,6 +2816,16 @@ async function kickstartAllTimers(email) {
|
|
|
2809
2816
|
alert("Kickstart failed: " + data.error);
|
|
2810
2817
|
} else if (data.results && data.results.length === 0) {
|
|
2811
2818
|
alert("No idle timers found for this account.");
|
|
2819
|
+
} else if (!data.ok) {
|
|
2820
|
+
var failed = (data.results || []).filter(function (r) {
|
|
2821
|
+
return !r.ok;
|
|
2822
|
+
});
|
|
2823
|
+
var details = failed
|
|
2824
|
+
.map(function (r) {
|
|
2825
|
+
return r.upstreamModel + " (status " + r.status + ")";
|
|
2826
|
+
})
|
|
2827
|
+
.join(", ");
|
|
2828
|
+
alert("Kickstart partially failed: " + (details || "unknown error"));
|
|
2812
2829
|
}
|
|
2813
2830
|
refresh();
|
|
2814
2831
|
}
|
package/src/types.ts
CHANGED
|
@@ -146,8 +146,8 @@ export interface Config {
|
|
|
146
146
|
// matched case-insensitively. When set, replaces the bundled defaults entirely.
|
|
147
147
|
modelSpecs?: Record<string, ModelSpecConfig>;
|
|
148
148
|
// Override model-id aliases used to translate the operator-facing name
|
|
149
|
-
// (e.g. "gemini-3.
|
|
150
|
-
// (e.g. "gemini-
|
|
149
|
+
// (e.g. "gemini-3.1-pro-high") to the upstream Antigravity name
|
|
150
|
+
// (e.g. "gemini-pro-agent"). When set, replaces the bundled defaults.
|
|
151
151
|
modelAliases?: Record<string, string>;
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -161,9 +161,6 @@ export const MAX_QUOTA_POLL_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
|
161
161
|
// updating. Operators can override via Config.modelAliases in accounts.json.
|
|
162
162
|
const DEFAULT_MODEL_ALIASES: Record<string, string> = {
|
|
163
163
|
"gemini-3.1-pro-high": "gemini-pro-agent",
|
|
164
|
-
"gemini-3.5-flash": "gemini-3-flash-agent",
|
|
165
|
-
"gemini-3.5-flash-high": "gemini-3-flash-agent",
|
|
166
|
-
"gemini-3.5-flash-medium": "gemini-3-flash-agent",
|
|
167
164
|
"gpt-oss-120b": "gpt-oss-120b-medium",
|
|
168
165
|
};
|
|
169
166
|
let modelAliasesOverride: Record<string, string> | null = null;
|
|
@@ -266,10 +263,6 @@ export const QUOTA_MODEL_KEYS: Record<
|
|
|
266
263
|
"gemini-3.1-pro-high",
|
|
267
264
|
"gemini-3-pro-high",
|
|
268
265
|
"gemini-3-pro-low",
|
|
269
|
-
"gemini-3.5-flash",
|
|
270
|
-
"gemini-3.5-flash-low",
|
|
271
|
-
"gemini-3.5-flash-medium",
|
|
272
|
-
"gemini-3.5-flash-high",
|
|
273
266
|
"gemini-3-flash-agent",
|
|
274
267
|
"gemini-3-flash",
|
|
275
268
|
"gemini-3.6-flash",
|
|
@@ -278,6 +271,9 @@ export const QUOTA_MODEL_KEYS: Record<
|
|
|
278
271
|
"gemini-3.6-flash-low",
|
|
279
272
|
"gemini-3.6-flash-tiered",
|
|
280
273
|
"gemini-3.7-flash-tiered",
|
|
274
|
+
"gemini-3.8-flash-low",
|
|
275
|
+
"gemini-3.8-flash-medium",
|
|
276
|
+
"gemini-3.8-flash-high",
|
|
281
277
|
],
|
|
282
278
|
display: "Gemini",
|
|
283
279
|
},
|
|
@@ -319,7 +315,7 @@ export function resolveQuotaModelKey(requestModel: string): string | null {
|
|
|
319
315
|
export function resolveDisplayModelKey(requestModel: string): string {
|
|
320
316
|
const lower = requestModel.toLowerCase();
|
|
321
317
|
// Explicit agent and gpt-oss overrides
|
|
322
|
-
if (lower.includes("gemini-3-flash-agent")) return "gemini-3
|
|
318
|
+
if (lower.includes("gemini-3-flash-agent")) return "gemini-3-flash";
|
|
323
319
|
if (lower.includes("gpt-oss-120b")) return "gpt-oss-120b-medium";
|
|
324
320
|
|
|
325
321
|
// Claude — distinguish sonnet vs opus
|
|
@@ -334,6 +330,16 @@ export function resolveDisplayModelKey(requestModel: string): string {
|
|
|
334
330
|
if (lower.includes("-high")) return "gemini-3.1-pro-high";
|
|
335
331
|
return "gemini-3.1-pro"; // unspecified variant
|
|
336
332
|
}
|
|
333
|
+
// Gemini 3.8 Flash — Antigravity exposes separate reasoning-level ids.
|
|
334
|
+
if (
|
|
335
|
+
lower.includes("gemini") &&
|
|
336
|
+
lower.includes("3.8") &&
|
|
337
|
+
lower.includes("flash")
|
|
338
|
+
) {
|
|
339
|
+
if (lower.includes("-low")) return "gemini-3.8-flash-low";
|
|
340
|
+
if (lower.includes("-medium")) return "gemini-3.8-flash-medium";
|
|
341
|
+
if (lower.includes("-high")) return "gemini-3.8-flash-high";
|
|
342
|
+
}
|
|
337
343
|
// Gemini 3.6 Flash — distinguish variants
|
|
338
344
|
if (
|
|
339
345
|
lower.includes("gemini") &&
|
|
@@ -357,17 +363,6 @@ export function resolveDisplayModelKey(requestModel: string): string {
|
|
|
357
363
|
) {
|
|
358
364
|
return "gemini-3.7-flash-tiered";
|
|
359
365
|
}
|
|
360
|
-
// Gemini 3.5 Flash — distinguish medium vs high
|
|
361
|
-
if (
|
|
362
|
-
lower.includes("gemini") &&
|
|
363
|
-
lower.includes("3.5") &&
|
|
364
|
-
lower.includes("flash")
|
|
365
|
-
) {
|
|
366
|
-
if (lower.includes("-low") || lower.includes("-medium"))
|
|
367
|
-
return "gemini-3.5-flash-medium";
|
|
368
|
-
if (lower.includes("-high")) return "gemini-3.5-flash-high";
|
|
369
|
-
return "gemini-3.5-flash"; // unspecified variant
|
|
370
|
-
}
|
|
371
366
|
// Flash
|
|
372
367
|
if (lower.includes("gemini") && lower.includes("flash"))
|
|
373
368
|
return "gemini-3-flash";
|
|
@@ -712,30 +707,6 @@ export const MODEL_PRICING: Record<
|
|
|
712
707
|
"gemini-3.1-pro-low": { inputPer1M: 2.0, outputPer1M: 12.0 },
|
|
713
708
|
"gemini-3.1-pro-high": { inputPer1M: 2.0, outputPer1M: 12.0 },
|
|
714
709
|
"gemini-3-flash": { inputPer1M: 0.5, outputPer1M: 3.0 },
|
|
715
|
-
"gemini-3.5-flash": {
|
|
716
|
-
inputPer1M: 1.5,
|
|
717
|
-
outputPer1M: 9.0,
|
|
718
|
-
cachingPer1M: 0.15,
|
|
719
|
-
cachingStoragePer1MPerHour: 1.0,
|
|
720
|
-
},
|
|
721
|
-
"gemini-3.5-flash-low": {
|
|
722
|
-
inputPer1M: 1.5,
|
|
723
|
-
outputPer1M: 9.0,
|
|
724
|
-
cachingPer1M: 0.15,
|
|
725
|
-
cachingStoragePer1MPerHour: 1.0,
|
|
726
|
-
},
|
|
727
|
-
"gemini-3.5-flash-medium": {
|
|
728
|
-
inputPer1M: 1.5,
|
|
729
|
-
outputPer1M: 9.0,
|
|
730
|
-
cachingPer1M: 0.15,
|
|
731
|
-
cachingStoragePer1MPerHour: 1.0,
|
|
732
|
-
},
|
|
733
|
-
"gemini-3.5-flash-high": {
|
|
734
|
-
inputPer1M: 1.5,
|
|
735
|
-
outputPer1M: 9.0,
|
|
736
|
-
cachingPer1M: 0.15,
|
|
737
|
-
cachingStoragePer1MPerHour: 1.0,
|
|
738
|
-
},
|
|
739
710
|
"gemini-3.6-flash": {
|
|
740
711
|
inputPer1M: 1.5,
|
|
741
712
|
outputPer1M: 7.5,
|
|
@@ -778,6 +749,27 @@ export const MODEL_PRICING: Record<
|
|
|
778
749
|
cachingPer1M: 0.075,
|
|
779
750
|
cachingStoragePer1MPerHour: 0.5,
|
|
780
751
|
},
|
|
752
|
+
// Gemini 3.8 Flash — introductory public Gemini API pricing verified
|
|
753
|
+
// 2026-09-02. These rates double on 2027-01-01. Antigravity exposes
|
|
754
|
+
// separate low/medium/high model ids.
|
|
755
|
+
"gemini-3.8-flash-low": {
|
|
756
|
+
inputPer1M: 0.75,
|
|
757
|
+
outputPer1M: 3.75,
|
|
758
|
+
cachingPer1M: 0.075,
|
|
759
|
+
cachingStoragePer1MPerHour: 0.5,
|
|
760
|
+
},
|
|
761
|
+
"gemini-3.8-flash-medium": {
|
|
762
|
+
inputPer1M: 0.75,
|
|
763
|
+
outputPer1M: 3.75,
|
|
764
|
+
cachingPer1M: 0.075,
|
|
765
|
+
cachingStoragePer1MPerHour: 0.5,
|
|
766
|
+
},
|
|
767
|
+
"gemini-3.8-flash-high": {
|
|
768
|
+
inputPer1M: 0.75,
|
|
769
|
+
outputPer1M: 3.75,
|
|
770
|
+
cachingPer1M: 0.075,
|
|
771
|
+
cachingStoragePer1MPerHour: 0.5,
|
|
772
|
+
},
|
|
781
773
|
"gpt-oss-120b-medium": { inputPer1M: 2.0, outputPer1M: 10.0 },
|
|
782
774
|
|
|
783
775
|
// OpenAI Codex GPT-5.6 models — official OpenAI API pricing checked
|
|
@@ -799,16 +791,18 @@ export const MODEL_PRICING: Record<
|
|
|
799
791
|
cachingPer1M: 0.02,
|
|
800
792
|
},
|
|
801
793
|
|
|
802
|
-
// Ollama Cloud model pricing (USD per 1M tokens). Sourced from
|
|
803
|
-
//
|
|
794
|
+
// Ollama Cloud model pricing (USD per 1M tokens). Sourced from LiteLLM
|
|
795
|
+
// (https://models.litellm.ai/) and verified 2026-08-30 via /api/tags
|
|
796
|
+
// discovery + /api/chat probes. Run scripts/verify_ollama_models.ts to refresh.
|
|
804
797
|
"gpt-oss:20b": { inputPer1M: 0.075, outputPer1M: 0.30 },
|
|
805
798
|
"gpt-oss:120b": { inputPer1M: 0.15, outputPer1M: 0.60 },
|
|
806
|
-
"deepseek-v4-flash:preview": { inputPer1M: 0.14, outputPer1M: 0.28, cachingPer1M: 0.0028 },
|
|
807
799
|
"deepseek-v4-flash:0731": { inputPer1M: 0.14, outputPer1M: 0.28, cachingPer1M: 0.0028 },
|
|
808
|
-
"deepseek-v4-pro":
|
|
800
|
+
"deepseek-v4-pro:0813": { inputPer1M: 1.74, outputPer1M: 3.48 },
|
|
809
801
|
"qwen3.5:397b": { inputPer1M: 0.60, outputPer1M: 3.60 },
|
|
810
802
|
"glm-5.1": { inputPer1M: 0.80, outputPer1M: 2.56 },
|
|
811
803
|
"glm-5.2": { inputPer1M: 0.80, outputPer1M: 2.56 },
|
|
804
|
+
"glm-5.3": { inputPer1M: 1.40, outputPer1M: 4.40 },
|
|
805
|
+
"glm-5.3-flash": { inputPer1M: 0.15, outputPer1M: 0.50 },
|
|
812
806
|
"gemma4:31b": { inputPer1M: 0.38, outputPer1M: 1.15 },
|
|
813
807
|
"kimi-k2.6": { inputPer1M: 0.95, outputPer1M: 4.00 },
|
|
814
808
|
"kimi-k2.7-code": { inputPer1M: 0.95, outputPer1M: 4.00 },
|
|
@@ -830,28 +824,30 @@ export const MODEL_PRICING: Record<
|
|
|
830
824
|
};
|
|
831
825
|
|
|
832
826
|
// Which Ollama Cloud models respond on which subscription tiers, verified
|
|
833
|
-
// 2026-08-
|
|
834
|
-
//
|
|
835
|
-
// the
|
|
836
|
-
// is upgraded. Sourced from ~/ollama-rotator.
|
|
827
|
+
// 2026-08-30 via scripts/verify_ollama_models.ts (/api/tags discovery +
|
|
828
|
+
// /api/chat probes: HTTP 200 = free, HTTP 402 = subscription-only).
|
|
829
|
+
// "free" = served on the free tier; "subscription" = requires a paid plan.
|
|
837
830
|
export type ModelTierAccess = "free" | "subscription";
|
|
838
831
|
export const MODEL_TIER_ACCESS: Record<string, ModelTierAccess> = {
|
|
832
|
+
// ── Free tier (HTTP 200 on free accounts) ───────────────────────────────
|
|
839
833
|
"gpt-oss:20b": "free",
|
|
840
834
|
"gpt-oss:120b": "free",
|
|
841
835
|
"gemma4:31b": "free",
|
|
842
|
-
"minimax-m3": "free",
|
|
843
836
|
"nemotron-3-nano:30b": "free",
|
|
844
837
|
"nemotron-3-super": "free",
|
|
845
838
|
"nemotron-3-ultra": "free",
|
|
839
|
+
// ── Subscription tier (HTTP 402 on free accounts) ───────────────────────
|
|
846
840
|
"deepseek-v4-flash:0731": "subscription",
|
|
847
|
-
"deepseek-v4-
|
|
848
|
-
"deepseek-v4-pro": "subscription",
|
|
841
|
+
"deepseek-v4-pro:0813": "subscription",
|
|
849
842
|
"glm-5.1": "subscription",
|
|
850
843
|
"glm-5.2": "subscription",
|
|
844
|
+
"glm-5.3": "subscription",
|
|
845
|
+
"glm-5.3-flash": "subscription",
|
|
851
846
|
"kimi-k2.6": "subscription",
|
|
852
847
|
"kimi-k2.7-code": "subscription",
|
|
853
848
|
"kimi-k3": "subscription",
|
|
854
849
|
"minimax-m2.7": "subscription",
|
|
850
|
+
"minimax-m3": "subscription",
|
|
855
851
|
"mistral-large-3:675b": "subscription",
|
|
856
852
|
"qwen3.5:397b": "subscription",
|
|
857
853
|
};
|
|
@@ -879,13 +875,11 @@ export const ANTIGRAVITY_ENDPOINTS = [
|
|
|
879
875
|
] as const;
|
|
880
876
|
|
|
881
877
|
// Maps each quota pool key (Google quota API) to the cheapest upstream model
|
|
882
|
-
// used for kickstart warmup requests.
|
|
883
|
-
//
|
|
878
|
+
// used for kickstart warmup requests. The pool key is the canonical family key
|
|
879
|
+
// from QUOTA_MODEL_KEYS (i.e. "claude" or "gemini"), not an altKey/request model name.
|
|
884
880
|
export const KICKSTART_MODEL_FOR_QUOTA_POOL: Record<string, string> = {
|
|
885
|
-
"claude
|
|
886
|
-
"gemini
|
|
887
|
-
"gemini-3.6-flash": "gemini-3-flash",
|
|
888
|
-
"gemini-3.1-pro": "gemini-3-flash",
|
|
881
|
+
"claude": "gpt-oss-120b-medium",
|
|
882
|
+
"gemini": "gemini-3-flash",
|
|
889
883
|
};
|
|
890
884
|
|
|
891
885
|
export const QUOTA_API_URL =
|
|
@@ -911,7 +905,7 @@ export const TAGS_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
|
911
905
|
export const ANTIGRAVITY_VERSION =
|
|
912
906
|
rotatorEnv("ANTIGRAVITY_VERSION") ||
|
|
913
907
|
process.env.PI_AI_ANTIGRAVITY_VERSION ||
|
|
914
|
-
"
|
|
908
|
+
"2.11.0";
|
|
915
909
|
export const QUOTA_USER_AGENT =
|
|
916
910
|
rotatorEnv("QUOTA_USER_AGENT") ||
|
|
917
911
|
`antigravity/${ANTIGRAVITY_VERSION} darwin/arm64`;
|
|
@@ -328,10 +328,6 @@ const MODEL_PRICING = {
|
|
|
328
328
|
"gemini-3.1-pro-low": { inputPer1M: 2.00, outputPer1M: 12.00 },
|
|
329
329
|
"gemini-3.1-pro-high": { inputPer1M: 2.00, outputPer1M: 12.00 },
|
|
330
330
|
"gemini-3-flash": { inputPer1M: 0.50, outputPer1M: 3.00 },
|
|
331
|
-
"gemini-3.5-flash": { inputPer1M: 1.50, outputPer1M: 9.00 },
|
|
332
|
-
"gemini-3.5-flash-low": { inputPer1M: 1.50, outputPer1M: 9.00 },
|
|
333
|
-
"gemini-3.5-flash-medium": { inputPer1M: 1.50, outputPer1M: 9.00 },
|
|
334
|
-
"gemini-3.5-flash-high": { inputPer1M: 1.50, outputPer1M: 9.00 },
|
|
335
331
|
"gemini-3.6-flash": { inputPer1M: 1.50, outputPer1M: 7.50 },
|
|
336
332
|
"gemini-3.6-flash-high": { inputPer1M: 1.50, outputPer1M: 7.50 },
|
|
337
333
|
"gemini-3.6-flash-medium": { inputPer1M: 1.50, outputPer1M: 7.50 },
|
|
@@ -341,6 +337,10 @@ const MODEL_PRICING = {
|
|
|
341
337
|
// 2026-08-13. Introductory rates through 2026-12-31; from 2027-01-01
|
|
342
338
|
// these double to input 1.50 / output 7.50 per 1M tokens.
|
|
343
339
|
"gemini-3.7-flash-tiered": { inputPer1M: 0.75, outputPer1M: 3.75 },
|
|
340
|
+
// Gemini 3.8 Flash uses the same introductory window and doubles on 2027-01-01.
|
|
341
|
+
"gemini-3.8-flash-low": { inputPer1M: 0.75, outputPer1M: 3.75 },
|
|
342
|
+
"gemini-3.8-flash-medium": { inputPer1M: 0.75, outputPer1M: 3.75 },
|
|
343
|
+
"gemini-3.8-flash-high": { inputPer1M: 0.75, outputPer1M: 3.75 },
|
|
344
344
|
"gpt-oss-120b-medium": { inputPer1M: 2.00, outputPer1M: 10.00 },
|
|
345
345
|
|
|
346
346
|
// Ollama Cloud models — mirrors MODEL_PRICING in src/types.ts
|
|
@@ -383,9 +383,9 @@ function getModelPricing(model) {
|
|
|
383
383
|
const lower = (model || "").toLowerCase();
|
|
384
384
|
if (lower.includes("opus")) return MODEL_PRICING["claude-opus-4-6-thinking"];
|
|
385
385
|
if (lower.includes("sonnet")) return MODEL_PRICING["claude-sonnet-4-6"];
|
|
386
|
+
if (lower.includes("3.8-flash")) return MODEL_PRICING["gemini-3.8-flash-high"];
|
|
386
387
|
if (lower.includes("3.7-flash")) return MODEL_PRICING["gemini-3.7-flash-tiered"];
|
|
387
388
|
if (lower.includes("3.6-flash")) return MODEL_PRICING["gemini-3.6-flash-high"];
|
|
388
|
-
if (lower.includes("3.5-flash")) return MODEL_PRICING["gemini-3.5-flash-high"];
|
|
389
389
|
if (lower.includes("flash")) return MODEL_PRICING["gemini-3-flash"];
|
|
390
390
|
if (lower.includes("pro")) return MODEL_PRICING["gemini-3.1-pro"];
|
|
391
391
|
return null;
|