tuxevil-rotator 3.3.2 → 3.5.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 +19 -0
- package/README.md +7 -2
- package/package.json +1 -1
- package/src/account-identity.ts +70 -0
- package/src/compat/model-specs.ts +28 -13
- package/src/compat.ts +60 -26
- package/src/providers/google-antigravity/catalog.ts +12 -9
- package/src/providers/google-antigravity/dynamic-catalog.ts +252 -0
- package/src/providers/google-antigravity/quota.ts +21 -0
- package/src/providers/google-antigravity/translators.ts +21 -7
- package/src/providers/ollama/prediction.ts +1 -1
- package/src/proxy.ts +17 -2
- package/src/rotator.ts +41 -73
- package/src/spend-logger.ts +3 -21
- package/src/static/dashboard-keys.js +4 -3
- package/src/static/dashboard-logs.js +5 -2
- package/src/static/dashboard.js +14 -13
- package/src/types.ts +100 -67
- package/tools/telemetry-receiver/receiver.js +5 -5
package/src/static/dashboard.js
CHANGED
|
@@ -1079,16 +1079,15 @@ var TOKEN_MODEL_COLORS = {
|
|
|
1079
1079
|
"gemini-3.1-pro-low": "#1d4ed8",
|
|
1080
1080
|
"gemini-3-pro-high": "#1d4ed8",
|
|
1081
1081
|
"gemini-3-pro-low": "#1d4ed8",
|
|
1082
|
-
"gemini-3.5-flash": "#2563eb", // Gemini 3.5 Flash (Azul rey medio)
|
|
1083
|
-
"gemini-3.5-flash-high": "#2563eb",
|
|
1084
|
-
"gemini-3.5-flash-medium": "#2563eb",
|
|
1085
|
-
"gemini-3.5-flash-low": "#2563eb",
|
|
1086
|
-
"gemini-3-flash-agent": "#2563eb",
|
|
1087
1082
|
"gemini-3.6-flash": "#38bdf8", // Gemini 3.6 Flash (Azul cielo brillante)
|
|
1088
1083
|
"gemini-3.6-flash-high": "#38bdf8",
|
|
1089
1084
|
"gemini-3.6-flash-medium": "#38bdf8",
|
|
1090
1085
|
"gemini-3.6-flash-low": "#38bdf8",
|
|
1091
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",
|
|
1092
1091
|
"gemini-3-flash": "#93c5fd", // Gemini 3 Flash (Azul pastel claro)
|
|
1093
1092
|
|
|
1094
1093
|
// Codex Pool (Amarillos) — de más caro a más barato
|
|
@@ -1132,7 +1131,7 @@ function getModelColor(model) {
|
|
|
1132
1131
|
|
|
1133
1132
|
// Gemini pool (Azules)
|
|
1134
1133
|
if (lower.indexOf("3.1-pro") !== -1 || lower.indexOf("3-pro") !== -1) return "#1d4ed8";
|
|
1135
|
-
if (lower.indexOf("3.
|
|
1134
|
+
if (lower.indexOf("3.8-flash") !== -1) return "#0284c7";
|
|
1136
1135
|
if (lower.indexOf("3.6-flash") !== -1) return "#38bdf8";
|
|
1137
1136
|
if (lower.indexOf("gemini") !== -1 || lower.indexOf("3-flash") !== -1) return "#93c5fd";
|
|
1138
1137
|
|
|
@@ -1171,10 +1170,6 @@ var MODEL_PRICING_CLIENT = {
|
|
|
1171
1170
|
"gemini-3.1-pro-low": { input: 2.0, output: 12.0 },
|
|
1172
1171
|
"gemini-3.1-pro-high": { input: 2.0, output: 12.0 },
|
|
1173
1172
|
"gemini-3-flash": { input: 0.5, output: 3.0 },
|
|
1174
|
-
"gemini-3.5-flash": { input: 1.5, output: 9.0 },
|
|
1175
|
-
"gemini-3.5-flash-low": { input: 1.5, output: 9.0 },
|
|
1176
|
-
"gemini-3.5-flash-medium": { input: 1.5, output: 9.0 },
|
|
1177
|
-
"gemini-3.5-flash-high": { input: 1.5, output: 9.0 },
|
|
1178
1173
|
"gemini-3.6-flash": { input: 1.5, output: 7.5 },
|
|
1179
1174
|
"gemini-3.6-flash-high": { input: 1.5, output: 7.5 },
|
|
1180
1175
|
"gemini-3.6-flash-medium": { input: 1.5, output: 7.5 },
|
|
@@ -1184,6 +1179,11 @@ var MODEL_PRICING_CLIENT = {
|
|
|
1184
1179
|
// Introductory rates through 2026-12-31; from 2027-01-01 these double to
|
|
1185
1180
|
// input 1.50 / output 7.50 per 1M tokens — update this entry then.
|
|
1186
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 },
|
|
1187
1187
|
"gpt-oss-120b-medium": { input: 2.0, output: 10.0 },
|
|
1188
1188
|
// OpenAI Codex GPT-5.6 models — mirrors MODEL_PRICING in types.ts.
|
|
1189
1189
|
"gpt-5.6-sol": { input: 5.0, output: 30.0 },
|
|
@@ -1223,11 +1223,12 @@ function getModelPricingClient(m) {
|
|
|
1223
1223
|
var lower = (m || "").toLowerCase();
|
|
1224
1224
|
if (lower.indexOf("opus") !== -1) return MODEL_PRICING_CLIENT["claude-opus-4-6-thinking"];
|
|
1225
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"];
|
|
1226
1227
|
if (lower.indexOf("3.7-flash") !== -1) return MODEL_PRICING_CLIENT["gemini-3.7-flash-tiered"];
|
|
1227
1228
|
if (lower.indexOf("3.6-flash") !== -1) return MODEL_PRICING_CLIENT["gemini-3.6-flash-high"];
|
|
1228
|
-
if (lower.indexOf("3.5-flash") !== -1) return MODEL_PRICING_CLIENT["gemini-3.5-flash-high"];
|
|
1229
1229
|
if (lower.indexOf("flash") !== -1) return MODEL_PRICING_CLIENT["gemini-3-flash"];
|
|
1230
1230
|
if (lower.indexOf("pro") !== -1) return MODEL_PRICING_CLIENT["gemini-3.1-pro"];
|
|
1231
|
+
if (lower.indexOf("gpt-oss") !== -1) return MODEL_PRICING_CLIENT["gpt-oss-120b-medium"];
|
|
1231
1232
|
return null;
|
|
1232
1233
|
}
|
|
1233
1234
|
|
|
@@ -1953,7 +1954,7 @@ function renderForecastPanel(data) {
|
|
|
1953
1954
|
function resolveQuotaPoolKey(displayKey) {
|
|
1954
1955
|
var lower = String(displayKey).toLowerCase();
|
|
1955
1956
|
if (lower.indexOf("gemini-3.6-flash") !== -1) return "gemini-3.6-flash";
|
|
1956
|
-
if (lower
|
|
1957
|
+
if (lower === "gemini-3-flash" || lower === "gemini-3-flash-agent") return "gemini-3-flash";
|
|
1957
1958
|
if (lower.indexOf("gemini-3.1-pro") !== -1 || lower.indexOf("gemini-pro") !== -1) return "gemini-3.1-pro";
|
|
1958
1959
|
if (lower.indexOf("claude") !== -1 || lower.indexOf("gpt-oss") !== -1) return "claude-opus-4-6-thinking";
|
|
1959
1960
|
return displayKey;
|
|
@@ -1996,7 +1997,7 @@ function renderForecastPanel(data) {
|
|
|
1996
1997
|
var displayName = m;
|
|
1997
1998
|
if (m === "claude-opus-4-6-thinking") displayName = "claude";
|
|
1998
1999
|
if (m === "gemini-3.1-pro") displayName = "gemini-3.1-pro";
|
|
1999
|
-
if (m === "gemini-3
|
|
2000
|
+
if (m === "gemini-3-flash") displayName = "gemini-3-flash";
|
|
2000
2001
|
|
|
2001
2002
|
var minResetRemaining = null;
|
|
2002
2003
|
q.entries.forEach(function (entry) {
|
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;
|
|
@@ -210,8 +207,18 @@ export interface GoogleQuotaResponse {
|
|
|
210
207
|
remainingFraction?: number;
|
|
211
208
|
resetTime?: string;
|
|
212
209
|
};
|
|
210
|
+
displayName?: string;
|
|
211
|
+
maxTokens?: number;
|
|
212
|
+
maxOutputTokens?: number;
|
|
213
|
+
thinkingBudget?: number;
|
|
214
|
+
minThinkingBudget?: number;
|
|
215
|
+
supportsThinking?: boolean;
|
|
216
|
+
supportsImages?: boolean;
|
|
217
|
+
supportsVideo?: boolean;
|
|
213
218
|
}
|
|
214
219
|
>;
|
|
220
|
+
defaultAgentModelId?: string;
|
|
221
|
+
tieredModelIds?: Record<string, string[]>;
|
|
215
222
|
}
|
|
216
223
|
|
|
217
224
|
// Per-model thinking/output spec used by the compat layer.
|
|
@@ -266,10 +273,6 @@ export const QUOTA_MODEL_KEYS: Record<
|
|
|
266
273
|
"gemini-3.1-pro-high",
|
|
267
274
|
"gemini-3-pro-high",
|
|
268
275
|
"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
276
|
"gemini-3-flash-agent",
|
|
274
277
|
"gemini-3-flash",
|
|
275
278
|
"gemini-3.6-flash",
|
|
@@ -278,11 +281,22 @@ export const QUOTA_MODEL_KEYS: Record<
|
|
|
278
281
|
"gemini-3.6-flash-low",
|
|
279
282
|
"gemini-3.6-flash-tiered",
|
|
280
283
|
"gemini-3.7-flash-tiered",
|
|
284
|
+
"gemini-3.8-flash-low",
|
|
285
|
+
"gemini-3.8-flash-medium",
|
|
286
|
+
"gemini-3.8-flash-high",
|
|
281
287
|
],
|
|
282
288
|
display: "Gemini",
|
|
283
289
|
},
|
|
284
290
|
};
|
|
285
291
|
|
|
292
|
+
const STATIC_ANTIGRAVITY_MODEL_IDS = new Set(
|
|
293
|
+
Object.values(QUOTA_MODEL_KEYS).flatMap(({ altKeys }) => altKeys),
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
export function isStaticAntigravityModel(model: string): boolean {
|
|
297
|
+
return STATIC_ANTIGRAVITY_MODEL_IDS.has(model.toLowerCase());
|
|
298
|
+
}
|
|
299
|
+
|
|
286
300
|
// Map request model names to quota model keys (family buckets).
|
|
287
301
|
export function resolveQuotaModelKey(requestModel: string): string | null {
|
|
288
302
|
const lower = requestModel.toLowerCase();
|
|
@@ -319,7 +333,7 @@ export function resolveQuotaModelKey(requestModel: string): string | null {
|
|
|
319
333
|
export function resolveDisplayModelKey(requestModel: string): string {
|
|
320
334
|
const lower = requestModel.toLowerCase();
|
|
321
335
|
// Explicit agent and gpt-oss overrides
|
|
322
|
-
if (lower.includes("gemini-3-flash-agent")) return "gemini-3
|
|
336
|
+
if (lower.includes("gemini-3-flash-agent")) return "gemini-3-flash";
|
|
323
337
|
if (lower.includes("gpt-oss-120b")) return "gpt-oss-120b-medium";
|
|
324
338
|
|
|
325
339
|
// Claude — distinguish sonnet vs opus
|
|
@@ -334,6 +348,16 @@ export function resolveDisplayModelKey(requestModel: string): string {
|
|
|
334
348
|
if (lower.includes("-high")) return "gemini-3.1-pro-high";
|
|
335
349
|
return "gemini-3.1-pro"; // unspecified variant
|
|
336
350
|
}
|
|
351
|
+
// Gemini 3.8 Flash — Antigravity exposes separate reasoning-level ids.
|
|
352
|
+
if (
|
|
353
|
+
lower.includes("gemini") &&
|
|
354
|
+
lower.includes("3.8") &&
|
|
355
|
+
lower.includes("flash")
|
|
356
|
+
) {
|
|
357
|
+
if (lower.includes("-low")) return "gemini-3.8-flash-low";
|
|
358
|
+
if (lower.includes("-medium")) return "gemini-3.8-flash-medium";
|
|
359
|
+
if (lower.includes("-high")) return "gemini-3.8-flash-high";
|
|
360
|
+
}
|
|
337
361
|
// Gemini 3.6 Flash — distinguish variants
|
|
338
362
|
if (
|
|
339
363
|
lower.includes("gemini") &&
|
|
@@ -357,17 +381,6 @@ export function resolveDisplayModelKey(requestModel: string): string {
|
|
|
357
381
|
) {
|
|
358
382
|
return "gemini-3.7-flash-tiered";
|
|
359
383
|
}
|
|
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
384
|
// Flash
|
|
372
385
|
if (lower.includes("gemini") && lower.includes("flash"))
|
|
373
386
|
return "gemini-3-flash";
|
|
@@ -696,46 +709,21 @@ export interface TokenUsageData {
|
|
|
696
709
|
};
|
|
697
710
|
}
|
|
698
711
|
|
|
712
|
+
export interface ModelPricing {
|
|
713
|
+
inputPer1M: number;
|
|
714
|
+
outputPer1M: number;
|
|
715
|
+
cachingPer1M?: number;
|
|
716
|
+
cachingStoragePer1MPerHour?: number;
|
|
717
|
+
}
|
|
718
|
+
|
|
699
719
|
// Pricing per 1M tokens (USD) — what these would cost on paid APIs
|
|
700
|
-
export const MODEL_PRICING: Record<
|
|
701
|
-
string,
|
|
702
|
-
{
|
|
703
|
-
inputPer1M: number;
|
|
704
|
-
outputPer1M: number;
|
|
705
|
-
cachingPer1M?: number;
|
|
706
|
-
cachingStoragePer1MPerHour?: number;
|
|
707
|
-
}
|
|
708
|
-
> = {
|
|
720
|
+
export const MODEL_PRICING: Record<string, ModelPricing> = {
|
|
709
721
|
"claude-opus-4-6-thinking": { inputPer1M: 5.0, outputPer1M: 25.0 },
|
|
710
722
|
"claude-sonnet-4-6": { inputPer1M: 3.0, outputPer1M: 15.0 },
|
|
711
723
|
"gemini-3.1-pro": { inputPer1M: 2.0, outputPer1M: 12.0 },
|
|
712
724
|
"gemini-3.1-pro-low": { inputPer1M: 2.0, outputPer1M: 12.0 },
|
|
713
725
|
"gemini-3.1-pro-high": { inputPer1M: 2.0, outputPer1M: 12.0 },
|
|
714
726
|
"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
727
|
"gemini-3.6-flash": {
|
|
740
728
|
inputPer1M: 1.5,
|
|
741
729
|
outputPer1M: 7.5,
|
|
@@ -778,6 +766,27 @@ export const MODEL_PRICING: Record<
|
|
|
778
766
|
cachingPer1M: 0.075,
|
|
779
767
|
cachingStoragePer1MPerHour: 0.5,
|
|
780
768
|
},
|
|
769
|
+
// Gemini 3.8 Flash — introductory public Gemini API pricing verified
|
|
770
|
+
// 2026-09-02. These rates double on 2027-01-01. Antigravity exposes
|
|
771
|
+
// separate low/medium/high model ids.
|
|
772
|
+
"gemini-3.8-flash-low": {
|
|
773
|
+
inputPer1M: 0.75,
|
|
774
|
+
outputPer1M: 3.75,
|
|
775
|
+
cachingPer1M: 0.075,
|
|
776
|
+
cachingStoragePer1MPerHour: 0.5,
|
|
777
|
+
},
|
|
778
|
+
"gemini-3.8-flash-medium": {
|
|
779
|
+
inputPer1M: 0.75,
|
|
780
|
+
outputPer1M: 3.75,
|
|
781
|
+
cachingPer1M: 0.075,
|
|
782
|
+
cachingStoragePer1MPerHour: 0.5,
|
|
783
|
+
},
|
|
784
|
+
"gemini-3.8-flash-high": {
|
|
785
|
+
inputPer1M: 0.75,
|
|
786
|
+
outputPer1M: 3.75,
|
|
787
|
+
cachingPer1M: 0.075,
|
|
788
|
+
cachingStoragePer1MPerHour: 0.5,
|
|
789
|
+
},
|
|
781
790
|
"gpt-oss-120b-medium": { inputPer1M: 2.0, outputPer1M: 10.0 },
|
|
782
791
|
|
|
783
792
|
// OpenAI Codex GPT-5.6 models — official OpenAI API pricing checked
|
|
@@ -799,16 +808,18 @@ export const MODEL_PRICING: Record<
|
|
|
799
808
|
cachingPer1M: 0.02,
|
|
800
809
|
},
|
|
801
810
|
|
|
802
|
-
// Ollama Cloud model pricing (USD per 1M tokens). Sourced from
|
|
803
|
-
//
|
|
811
|
+
// Ollama Cloud model pricing (USD per 1M tokens). Sourced from LiteLLM
|
|
812
|
+
// (https://models.litellm.ai/) and verified 2026-08-30 via /api/tags
|
|
813
|
+
// discovery + /api/chat probes. Run scripts/verify_ollama_models.ts to refresh.
|
|
804
814
|
"gpt-oss:20b": { inputPer1M: 0.075, outputPer1M: 0.30 },
|
|
805
815
|
"gpt-oss:120b": { inputPer1M: 0.15, outputPer1M: 0.60 },
|
|
806
|
-
"deepseek-v4-flash:preview": { inputPer1M: 0.14, outputPer1M: 0.28, cachingPer1M: 0.0028 },
|
|
807
816
|
"deepseek-v4-flash:0731": { inputPer1M: 0.14, outputPer1M: 0.28, cachingPer1M: 0.0028 },
|
|
808
|
-
"deepseek-v4-pro":
|
|
817
|
+
"deepseek-v4-pro:0813": { inputPer1M: 1.74, outputPer1M: 3.48 },
|
|
809
818
|
"qwen3.5:397b": { inputPer1M: 0.60, outputPer1M: 3.60 },
|
|
810
819
|
"glm-5.1": { inputPer1M: 0.80, outputPer1M: 2.56 },
|
|
811
820
|
"glm-5.2": { inputPer1M: 0.80, outputPer1M: 2.56 },
|
|
821
|
+
"glm-5.3": { inputPer1M: 1.40, outputPer1M: 4.40 },
|
|
822
|
+
"glm-5.3-flash": { inputPer1M: 0.15, outputPer1M: 0.50 },
|
|
812
823
|
"gemma4:31b": { inputPer1M: 0.38, outputPer1M: 1.15 },
|
|
813
824
|
"kimi-k2.6": { inputPer1M: 0.95, outputPer1M: 4.00 },
|
|
814
825
|
"kimi-k2.7-code": { inputPer1M: 0.95, outputPer1M: 4.00 },
|
|
@@ -829,29 +840,49 @@ export const MODEL_PRICING: Record<
|
|
|
829
840
|
|
|
830
841
|
};
|
|
831
842
|
|
|
843
|
+
/**
|
|
844
|
+
* Resolves pricing for a model, using exact lookup first and dynamic family fallbacks
|
|
845
|
+
* for newly released models without manual pricing entries.
|
|
846
|
+
*/
|
|
847
|
+
export function getModelPricing(model: string): ModelPricing | undefined {
|
|
848
|
+
if (!model) return undefined;
|
|
849
|
+
if (MODEL_PRICING[model]) return MODEL_PRICING[model];
|
|
850
|
+
const lower = model.toLowerCase();
|
|
851
|
+
if (MODEL_PRICING[lower]) return MODEL_PRICING[lower];
|
|
852
|
+
// Dynamic family fallbacks for unseen future models:
|
|
853
|
+
if (lower.includes("opus")) return MODEL_PRICING["claude-opus-4-6-thinking"];
|
|
854
|
+
if (lower.includes("sonnet")) return MODEL_PRICING["claude-sonnet-4-6"];
|
|
855
|
+
if (lower.includes("flash")) return MODEL_PRICING["gemini-3.8-flash-high"] ?? MODEL_PRICING["gemini-3.7-flash-tiered"];
|
|
856
|
+
if (lower.includes("pro")) return MODEL_PRICING["gemini-3.1-pro"];
|
|
857
|
+
if (lower.includes("gpt-oss")) return MODEL_PRICING["gpt-oss-120b-medium"];
|
|
858
|
+
return undefined;
|
|
859
|
+
}
|
|
860
|
+
|
|
832
861
|
// Which Ollama Cloud models respond on which subscription tiers, verified
|
|
833
|
-
// 2026-08-
|
|
834
|
-
//
|
|
835
|
-
// the
|
|
836
|
-
// is upgraded. Sourced from ~/ollama-rotator.
|
|
862
|
+
// 2026-08-30 via scripts/verify_ollama_models.ts (/api/tags discovery +
|
|
863
|
+
// /api/chat probes: HTTP 200 = free, HTTP 402 = subscription-only).
|
|
864
|
+
// "free" = served on the free tier; "subscription" = requires a paid plan.
|
|
837
865
|
export type ModelTierAccess = "free" | "subscription";
|
|
838
866
|
export const MODEL_TIER_ACCESS: Record<string, ModelTierAccess> = {
|
|
867
|
+
// ── Free tier (HTTP 200 on free accounts) ───────────────────────────────
|
|
839
868
|
"gpt-oss:20b": "free",
|
|
840
869
|
"gpt-oss:120b": "free",
|
|
841
870
|
"gemma4:31b": "free",
|
|
842
|
-
"minimax-m3": "free",
|
|
843
871
|
"nemotron-3-nano:30b": "free",
|
|
844
872
|
"nemotron-3-super": "free",
|
|
845
873
|
"nemotron-3-ultra": "free",
|
|
874
|
+
// ── Subscription tier (HTTP 402 on free accounts) ───────────────────────
|
|
846
875
|
"deepseek-v4-flash:0731": "subscription",
|
|
847
|
-
"deepseek-v4-
|
|
848
|
-
"deepseek-v4-pro": "subscription",
|
|
876
|
+
"deepseek-v4-pro:0813": "subscription",
|
|
849
877
|
"glm-5.1": "subscription",
|
|
850
878
|
"glm-5.2": "subscription",
|
|
879
|
+
"glm-5.3": "subscription",
|
|
880
|
+
"glm-5.3-flash": "subscription",
|
|
851
881
|
"kimi-k2.6": "subscription",
|
|
852
882
|
"kimi-k2.7-code": "subscription",
|
|
853
883
|
"kimi-k3": "subscription",
|
|
854
884
|
"minimax-m2.7": "subscription",
|
|
885
|
+
"minimax-m3": "subscription",
|
|
855
886
|
"mistral-large-3:675b": "subscription",
|
|
856
887
|
"qwen3.5:397b": "subscription",
|
|
857
888
|
};
|
|
@@ -909,10 +940,12 @@ export const TAGS_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
|
909
940
|
export const ANTIGRAVITY_VERSION =
|
|
910
941
|
rotatorEnv("ANTIGRAVITY_VERSION") ||
|
|
911
942
|
process.env.PI_AI_ANTIGRAVITY_VERSION ||
|
|
912
|
-
"
|
|
943
|
+
"2.11.0";
|
|
944
|
+
export const DEFAULT_ANTIGRAVITY_USER_AGENT =
|
|
945
|
+
`antigravity/ide/${ANTIGRAVITY_VERSION} (aidev_client; os_type=darwin; arch=arm64)`;
|
|
913
946
|
export const QUOTA_USER_AGENT =
|
|
914
947
|
rotatorEnv("QUOTA_USER_AGENT") ||
|
|
915
|
-
|
|
948
|
+
DEFAULT_ANTIGRAVITY_USER_AGENT;
|
|
916
949
|
export const REQUEST_USER_AGENT =
|
|
917
950
|
rotatorEnv("REQUEST_USER_AGENT") || QUOTA_USER_AGENT;
|
|
918
951
|
export const REQUEST_GOOG_API_CLIENT =
|
|
@@ -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;
|