tuxevil-rotator 4.2.2 → 4.3.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 +27 -1
- package/README.md +9 -4
- package/package.json +1 -1
- package/plugins/opencode-discovery/capabilities.d.mts +7 -0
- package/plugins/opencode-discovery/capabilities.mjs +54 -0
- package/plugins/opencode-discovery/index.d.mts +2 -1
- package/plugins/opencode-discovery/index.mjs +6 -1
- package/plugins/opencode-discovery/package.json +3 -1
- package/src/audio-transcription.ts +32 -6
- package/src/cli.ts +3 -3
- package/src/compat/model-specs.ts +4 -0
- package/src/compat.ts +30 -1
- package/src/dashboard-app.ts +1 -0
- package/src/install-agent.ts +211 -129
- package/src/install-opencode.ts +80 -18
- package/src/providers/google-antigravity/catalog.ts +14 -6
- package/src/providers/google-antigravity/dynamic-catalog.ts +79 -3
- package/src/providers/google-antigravity/forward.ts +4 -2
- package/src/providers/google-antigravity/quota.ts +4 -0
- package/src/providers/ollama/forward.ts +10 -0
- package/src/providers/openai-codex/catalog.ts +157 -18
- package/src/proxy.ts +35 -2
- package/src/rotator.ts +16 -2
- package/src/types.ts +78 -29
- package/src/web/app.tsx +4 -0
- package/src/web/lib/audio-recorder.ts +159 -0
- package/src/web/lib/colors.ts +4 -0
- package/src/web/lib/playground-storage.ts +261 -0
- package/src/web/lib/playground.ts +448 -0
- package/src/web/nav.ts +1 -0
- package/src/web/pages/Playground.tsx +1111 -0
- package/src/web/pages/Transcription.tsx +428 -0
- package/src/web/state/api.ts +3 -0
- package/src/web/state/playground-client.ts +136 -0
- package/src/web/state/playground.ts +69 -0
- package/src/web/state/router.ts +2 -2
- package/src/web/state/transcription-client.ts +93 -0
- package/src/web/styles/app.css +45 -0
- package/tools/telemetry-receiver/receiver.js +59 -46
|
@@ -8,6 +8,8 @@ export interface CodexModel {
|
|
|
8
8
|
id: string;
|
|
9
9
|
contextWindow: number;
|
|
10
10
|
reasoning: boolean;
|
|
11
|
+
reasoningEfforts?: string[];
|
|
12
|
+
defaultReasoningEffort?: string;
|
|
11
13
|
multimodal: boolean;
|
|
12
14
|
tools: boolean;
|
|
13
15
|
source: "allowlist" | "discovered";
|
|
@@ -29,12 +31,66 @@ const CODEX_DISCOVERED_MAX_CONTEXT_WINDOW = 2_000_000;
|
|
|
29
31
|
const DEFAULT_CODEX_CLIENT_VERSION = "0.162.1";
|
|
30
32
|
const CODEX_DISCOVERED_ID_PATTERN = /^gpt-\d+(?:\.\d+)*(?:-[a-z0-9]+)+$/i;
|
|
31
33
|
export const CODEX_BASE_MODELS: readonly CodexModel[] = [
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
{
|
|
35
|
+
id: "gpt-6-astra",
|
|
36
|
+
contextWindow: CODEX_CONTEXT_WINDOW,
|
|
37
|
+
reasoning: true,
|
|
38
|
+
multimodal: true,
|
|
39
|
+
tools: true,
|
|
40
|
+
source: "allowlist",
|
|
41
|
+
reasoningEfforts: ["low", "medium", "high", "xhigh", "max"],
|
|
42
|
+
defaultReasoningEffort: "medium",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "gpt-6-sol",
|
|
46
|
+
contextWindow: CODEX_CONTEXT_WINDOW,
|
|
47
|
+
reasoning: true,
|
|
48
|
+
multimodal: true,
|
|
49
|
+
tools: true,
|
|
50
|
+
source: "allowlist",
|
|
51
|
+
reasoningEfforts: ["low", "medium", "high", "xhigh", "max"],
|
|
52
|
+
defaultReasoningEffort: "medium",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "gpt-6-luna",
|
|
56
|
+
contextWindow: CODEX_CONTEXT_WINDOW,
|
|
57
|
+
reasoning: true,
|
|
58
|
+
multimodal: true,
|
|
59
|
+
tools: true,
|
|
60
|
+
source: "allowlist",
|
|
61
|
+
reasoningEfforts: ["low", "medium", "high", "xhigh", "max"],
|
|
62
|
+
defaultReasoningEffort: "medium",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "gpt-5.6-sol",
|
|
66
|
+
contextWindow: CODEX_CONTEXT_WINDOW,
|
|
67
|
+
reasoning: true,
|
|
68
|
+
multimodal: true,
|
|
69
|
+
tools: true,
|
|
70
|
+
source: "allowlist",
|
|
71
|
+
reasoningEfforts: ["low", "medium", "high", "xhigh", "max"],
|
|
72
|
+
defaultReasoningEffort: "medium",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "gpt-5.6-terra",
|
|
76
|
+
contextWindow: CODEX_CONTEXT_WINDOW,
|
|
77
|
+
reasoning: true,
|
|
78
|
+
multimodal: true,
|
|
79
|
+
tools: true,
|
|
80
|
+
source: "allowlist",
|
|
81
|
+
reasoningEfforts: ["low", "medium", "high", "xhigh", "max"],
|
|
82
|
+
defaultReasoningEffort: "medium",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "gpt-5.6-luna",
|
|
86
|
+
contextWindow: CODEX_CONTEXT_WINDOW,
|
|
87
|
+
reasoning: true,
|
|
88
|
+
multimodal: true,
|
|
89
|
+
tools: true,
|
|
90
|
+
source: "allowlist",
|
|
91
|
+
reasoningEfforts: ["low", "medium", "high", "xhigh", "max"],
|
|
92
|
+
defaultReasoningEffort: "medium",
|
|
93
|
+
},
|
|
38
94
|
];
|
|
39
95
|
|
|
40
96
|
let discoveredModels: CodexModel[] = [];
|
|
@@ -56,14 +112,17 @@ export function getCodexModel(model: string): CodexModel | undefined {
|
|
|
56
112
|
|
|
57
113
|
export function getCodexModels(): CodexModel[] {
|
|
58
114
|
const merged = new Map<string, CodexModel>();
|
|
59
|
-
for (const entry of [...CODEX_BASE_MODELS, ...discoveredModels])
|
|
115
|
+
for (const entry of [...CODEX_BASE_MODELS, ...discoveredModels])
|
|
116
|
+
merged.set(entry.id, entry);
|
|
60
117
|
return [...merged.values()];
|
|
61
118
|
}
|
|
62
119
|
|
|
63
120
|
export function isCodexProviderModelId(value: unknown): value is string {
|
|
64
|
-
return
|
|
121
|
+
return (
|
|
122
|
+
typeof value === "string" &&
|
|
65
123
|
isSafeModelId(value) &&
|
|
66
|
-
CODEX_DISCOVERED_ID_PATTERN.test(value)
|
|
124
|
+
CODEX_DISCOVERED_ID_PATTERN.test(value)
|
|
125
|
+
);
|
|
67
126
|
}
|
|
68
127
|
|
|
69
128
|
export function setDiscoveredCodexModels(models: CodexModel[]): void {
|
|
@@ -71,28 +130,99 @@ export function setDiscoveredCodexModels(models: CodexModel[]): void {
|
|
|
71
130
|
}
|
|
72
131
|
|
|
73
132
|
function isSafeModelId(value: unknown): value is string {
|
|
74
|
-
return
|
|
133
|
+
return (
|
|
134
|
+
typeof value === "string" &&
|
|
135
|
+
/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/.test(value)
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const REASONING_EFFORTS = new Set([
|
|
140
|
+
"none",
|
|
141
|
+
"minimal",
|
|
142
|
+
"low",
|
|
143
|
+
"medium",
|
|
144
|
+
"high",
|
|
145
|
+
"xhigh",
|
|
146
|
+
"max",
|
|
147
|
+
]);
|
|
148
|
+
function reasoningMetadata(
|
|
149
|
+
record: Record<string, unknown>,
|
|
150
|
+
id: string,
|
|
151
|
+
): Pick<CodexModel, "reasoningEfforts" | "defaultReasoningEffort"> {
|
|
152
|
+
if (record.reasoning === false) return { reasoningEfforts: [] };
|
|
153
|
+
const known = CODEX_BASE_MODELS.find((model) => model.id === id);
|
|
154
|
+
const raw =
|
|
155
|
+
record.supported_reasoning_levels ??
|
|
156
|
+
record.supported_reasoning_efforts ??
|
|
157
|
+
record.reasoning_efforts;
|
|
158
|
+
const efforts = Array.isArray(raw)
|
|
159
|
+
? [
|
|
160
|
+
...new Set(
|
|
161
|
+
raw.flatMap((value) => {
|
|
162
|
+
const effort =
|
|
163
|
+
typeof value === "string"
|
|
164
|
+
? value
|
|
165
|
+
: value && typeof value === "object"
|
|
166
|
+
? (value as Record<string, unknown>).effort
|
|
167
|
+
: null;
|
|
168
|
+
return typeof effort === "string" && REASONING_EFFORTS.has(effort)
|
|
169
|
+
? [effort]
|
|
170
|
+
: [];
|
|
171
|
+
}),
|
|
172
|
+
),
|
|
173
|
+
]
|
|
174
|
+
: known?.reasoningEfforts;
|
|
175
|
+
const defaultEffort =
|
|
176
|
+
record.default_reasoning_level ??
|
|
177
|
+
record.default_reasoning_effort ??
|
|
178
|
+
known?.defaultReasoningEffort;
|
|
179
|
+
return {
|
|
180
|
+
...(efforts ? { reasoningEfforts: efforts } : {}),
|
|
181
|
+
...(typeof defaultEffort === "string" && efforts?.includes(defaultEffort)
|
|
182
|
+
? { defaultReasoningEffort: defaultEffort }
|
|
183
|
+
: {}),
|
|
184
|
+
};
|
|
75
185
|
}
|
|
76
186
|
|
|
77
187
|
function parseModel(value: unknown): CodexModel | null {
|
|
78
188
|
if (typeof value === "string") {
|
|
79
189
|
return isCodexProviderModelId(value)
|
|
80
|
-
? {
|
|
190
|
+
? {
|
|
191
|
+
id: value,
|
|
192
|
+
contextWindow: CODEX_CONTEXT_WINDOW,
|
|
193
|
+
reasoning: true,
|
|
194
|
+
multimodal: true,
|
|
195
|
+
tools: true,
|
|
196
|
+
source: "discovered",
|
|
197
|
+
...reasoningMetadata({}, value),
|
|
198
|
+
}
|
|
81
199
|
: null;
|
|
82
200
|
}
|
|
83
201
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
84
202
|
const record = value as Record<string, unknown>;
|
|
85
203
|
const id = record.id ?? record.slug ?? record.model ?? record.name;
|
|
86
204
|
if (!isCodexProviderModelId(id)) return null;
|
|
87
|
-
const contextWindow = [
|
|
88
|
-
.
|
|
205
|
+
const contextWindow = [
|
|
206
|
+
record.context_window,
|
|
207
|
+
record.contextWindow,
|
|
208
|
+
record.context_length,
|
|
209
|
+
].find(
|
|
210
|
+
(candidate) =>
|
|
211
|
+
typeof candidate === "number" &&
|
|
212
|
+
Number.isFinite(candidate) &&
|
|
213
|
+
candidate > 0,
|
|
214
|
+
);
|
|
89
215
|
return {
|
|
90
216
|
id,
|
|
91
|
-
contextWindow:
|
|
217
|
+
contextWindow:
|
|
218
|
+
typeof contextWindow === "number"
|
|
219
|
+
? Math.min(contextWindow, CODEX_DISCOVERED_MAX_CONTEXT_WINDOW)
|
|
220
|
+
: CODEX_CONTEXT_WINDOW,
|
|
92
221
|
reasoning: record.reasoning !== false,
|
|
93
222
|
multimodal: record.multimodal !== false && record.vision !== false,
|
|
94
223
|
tools: record.tools !== false && record.tool_calling !== false,
|
|
95
224
|
source: "discovered",
|
|
225
|
+
...reasoningMetadata(record, id),
|
|
96
226
|
};
|
|
97
227
|
}
|
|
98
228
|
|
|
@@ -106,7 +236,10 @@ export async function fetchCodexCatalog(
|
|
|
106
236
|
const endpoint = base.endsWith("/models") ? base : `${base}/models`;
|
|
107
237
|
try {
|
|
108
238
|
const url = new URL(endpoint);
|
|
109
|
-
url.searchParams.set(
|
|
239
|
+
url.searchParams.set(
|
|
240
|
+
"client_version",
|
|
241
|
+
process.env.CODEX_CLIENT_VERSION?.trim() || DEFAULT_CODEX_CLIENT_VERSION,
|
|
242
|
+
);
|
|
110
243
|
const headers: Record<string, string> = {
|
|
111
244
|
Authorization: `Bearer ${token}`,
|
|
112
245
|
Accept: "application/json",
|
|
@@ -119,9 +252,15 @@ export async function fetchCodexCatalog(
|
|
|
119
252
|
dispatcher: getAccountProxyDispatcher(account, CODEX_PROVIDER_ID),
|
|
120
253
|
} as RequestInit & { dispatcher?: unknown });
|
|
121
254
|
if (!response.ok) return getCodexModels();
|
|
122
|
-
const data = await response.json() as Record<string, unknown>;
|
|
123
|
-
const raw = Array.isArray(data.data)
|
|
124
|
-
|
|
255
|
+
const data = (await response.json()) as Record<string, unknown>;
|
|
256
|
+
const raw = Array.isArray(data.data)
|
|
257
|
+
? data.data
|
|
258
|
+
: Array.isArray(data.models)
|
|
259
|
+
? data.models
|
|
260
|
+
: [];
|
|
261
|
+
const parsed = raw
|
|
262
|
+
.map(parseModel)
|
|
263
|
+
.filter((model): model is CodexModel => model !== null);
|
|
125
264
|
if (parsed.length > 0) setDiscoveredCodexModels(parsed);
|
|
126
265
|
} catch {
|
|
127
266
|
// Discovery is optional; the safe allowlist remains available.
|
package/src/proxy.ts
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
GOOGLE_BENCHMARK_CONSTANTS,
|
|
43
43
|
} from "./providers/google-antigravity/forward.js";
|
|
44
44
|
import { isDynamicallyAvailableAntigravityModel } from "./providers/google-antigravity/catalog.js";
|
|
45
|
+
import { dynamicCatalog } from "./providers/google-antigravity/dynamic-catalog.js";
|
|
45
46
|
export { forwardRequest, SseEventAccumulator, extractUsageFromSseEvent };
|
|
46
47
|
import {
|
|
47
48
|
serveStatusApi,
|
|
@@ -94,7 +95,7 @@ import {
|
|
|
94
95
|
handleCliLoginApi,
|
|
95
96
|
} from "./onboarding.js";
|
|
96
97
|
import { requireAdmin } from "./admin-auth.js";
|
|
97
|
-
import { PayloadTooLargeError, readLimitedBody } from "./body-limit.js";
|
|
98
|
+
import { getMaxBodyBytes, PayloadTooLargeError, readLimitedBody } from "./body-limit.js";
|
|
98
99
|
import { validateConfig, validateProxyRequestBody } from "./validators.js";
|
|
99
100
|
import { calculateBackoffMs } from "./fetch-with-retry.js";
|
|
100
101
|
import { logger } from "./logger.js";
|
|
@@ -190,6 +191,7 @@ import {
|
|
|
190
191
|
handleAnthropicMessages,
|
|
191
192
|
handleGeminiGenerateContent,
|
|
192
193
|
handleOpenAIChatCompletions,
|
|
194
|
+
handlePlaygroundChatCompletions,
|
|
193
195
|
handleOpenAIResponsesCancel,
|
|
194
196
|
handleOpenAIResponsesCreate,
|
|
195
197
|
handleOpenAIResponsesDelete,
|
|
@@ -200,6 +202,7 @@ import {
|
|
|
200
202
|
} from "./compat.js";
|
|
201
203
|
import {
|
|
202
204
|
handleOpenAIAudioTranscriptions,
|
|
205
|
+
handlePlaygroundAudioTranscriptions,
|
|
203
206
|
handleAudioWebSocket,
|
|
204
207
|
closeAllAudioWebSockets,
|
|
205
208
|
WS_SHUTDOWN_CLOSE_GRACE_MS,
|
|
@@ -1273,7 +1276,8 @@ export async function withRotation<T>(
|
|
|
1273
1276
|
resolveQuotaModelKey(applyModelAlias(model));
|
|
1274
1277
|
if (
|
|
1275
1278
|
(providerId === DEFAULT_PROVIDER ||
|
|
1276
|
-
(!providerId && (modelQuotaFamily === "claude" || modelQuotaFamily === "gemini"
|
|
1279
|
+
(!providerId && (modelQuotaFamily === "claude" || modelQuotaFamily === "gemini" ||
|
|
1280
|
+
dynamicCatalog.wasDiscovered(model) || dynamicCatalog.wasDiscovered(applyModelAlias(model))))) &&
|
|
1277
1281
|
!isDynamicallyAvailableAntigravityModel(model)
|
|
1278
1282
|
) {
|
|
1279
1283
|
return {
|
|
@@ -2773,6 +2777,35 @@ export function startProxy(
|
|
|
2773
2777
|
return;
|
|
2774
2778
|
}
|
|
2775
2779
|
|
|
2780
|
+
if (method === "GET" && pathname === "/api/playground/config") {
|
|
2781
|
+
if (!requireAdmin(req, res)) return;
|
|
2782
|
+
res.writeHead(200, { "Content-Type": "application/json", "Cache-Control": "no-store" });
|
|
2783
|
+
res.end(JSON.stringify({ maxBodyBytes: getMaxBodyBytes() }));
|
|
2784
|
+
return;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
if (method === "POST" && pathname === "/api/playground/audio/transcriptions") {
|
|
2788
|
+
void handlePlaygroundAudioTranscriptions(req, res, rotator).catch((err) => {
|
|
2789
|
+
log(`Playground audio error: ${err}`, rotator, "error");
|
|
2790
|
+
if (!res.headersSent) {
|
|
2791
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
2792
|
+
res.end(JSON.stringify({ error: { message: "Internal transcription error", type: "server_error" } }));
|
|
2793
|
+
} else res.destroy();
|
|
2794
|
+
});
|
|
2795
|
+
return;
|
|
2796
|
+
}
|
|
2797
|
+
|
|
2798
|
+
if (method === "POST" && pathname === "/api/playground/chat/completions") {
|
|
2799
|
+
void handlePlaygroundChatCompletions(req, res, rotator).catch((err) => {
|
|
2800
|
+
log(`Playground compat error: ${err}`, rotator, "error");
|
|
2801
|
+
if (!res.headersSent) {
|
|
2802
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
2803
|
+
res.end(JSON.stringify({ error: { message: "Internal playground error", type: "server_error" } }));
|
|
2804
|
+
} else res.destroy();
|
|
2805
|
+
});
|
|
2806
|
+
return;
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2776
2809
|
// OpenAI-compatible adapter route (additive; does not affect native v1internal route)
|
|
2777
2810
|
if (method === "GET" && pathname === "/v1/models") {
|
|
2778
2811
|
serveOpenAIModels(res, rotator);
|
package/src/rotator.ts
CHANGED
|
@@ -649,6 +649,12 @@ export class AccountRotator {
|
|
|
649
649
|
getCredentialGenerationFingerprint(account, DEFAULT_PROVIDER),
|
|
650
650
|
})),
|
|
651
651
|
);
|
|
652
|
+
dynamicCatalog.restorePersistedSnapshots(state.dynamicModelSnapshots,
|
|
653
|
+
this.accounts.filter((account) => hasCredential(account.config, DEFAULT_PROVIDER)).map((account) => ({
|
|
654
|
+
id: getAccountIdentity(account),
|
|
655
|
+
credentialGenerationFingerprint: getCredentialGenerationFingerprint(account, DEFAULT_PROVIDER),
|
|
656
|
+
})),
|
|
657
|
+
);
|
|
652
658
|
// Load per-model account assignments
|
|
653
659
|
if (state.modelAccounts) {
|
|
654
660
|
for (const [model, idx] of Object.entries(state.modelAccounts)) {
|
|
@@ -837,6 +843,13 @@ export class AccountRotator {
|
|
|
837
843
|
|
|
838
844
|
const disabledProvidersByAccount: Record<string, string[]> = {};
|
|
839
845
|
const state: PersistedState = {
|
|
846
|
+
dynamicModelSnapshots: dynamicCatalog.getPersistedSnapshots(
|
|
847
|
+
this.accounts.filter((account) => !account.disabled && !account.flagged &&
|
|
848
|
+
!account.invalidProviders?.[DEFAULT_PROVIDER] && hasCredential(account.config, DEFAULT_PROVIDER)).map((account) => ({
|
|
849
|
+
id: getAccountIdentity(account),
|
|
850
|
+
credentialGenerationFingerprint: getCredentialGenerationFingerprint(account, DEFAULT_PROVIDER),
|
|
851
|
+
})),
|
|
852
|
+
),
|
|
840
853
|
dynamicModelQuotaPools: dynamicCatalog.getDiscoveredQuotaPools(),
|
|
841
854
|
dynamicModelOwnership: dynamicCatalog.getPersistedModelOwnership(
|
|
842
855
|
this.accounts
|
|
@@ -1018,6 +1031,7 @@ export class AccountRotator {
|
|
|
1018
1031
|
|
|
1019
1032
|
private async pollAccountQuotaOnce(account: AccountRuntime): Promise<boolean> {
|
|
1020
1033
|
let quotaPublished = false;
|
|
1034
|
+
const snapshotRevision = dynamicCatalog.snapshotRevision;
|
|
1021
1035
|
try {
|
|
1022
1036
|
const quotaCtx: QuotaFetchContext = {
|
|
1023
1037
|
log: (message) => this.log(message),
|
|
@@ -1075,10 +1089,10 @@ export class AccountRotator {
|
|
|
1075
1089
|
cooldownChanged = true;
|
|
1076
1090
|
}
|
|
1077
1091
|
}
|
|
1078
|
-
if (cooldownChanged) {
|
|
1092
|
+
if (cooldownChanged || snapshotRevision !== dynamicCatalog.snapshotRevision) {
|
|
1079
1093
|
this.scheduleStateSave();
|
|
1080
|
-
this.requestWaiterDrain();
|
|
1081
1094
|
}
|
|
1095
|
+
if (cooldownChanged) this.requestWaiterDrain();
|
|
1082
1096
|
|
|
1083
1097
|
// Consolidated RAW POLL across all providers on this account:
|
|
1084
1098
|
// google first (Antigravity OAuth pools), then ollama (usage pools).
|
package/src/types.ts
CHANGED
|
@@ -432,6 +432,17 @@ export function resolveDisplayModelKey(
|
|
|
432
432
|
if (lower.includes("-high")) return "gemini-3.1-pro-high";
|
|
433
433
|
return "gemini-3.1-pro"; // unspecified variant
|
|
434
434
|
}
|
|
435
|
+
// Gemini 4 Argon
|
|
436
|
+
if (
|
|
437
|
+
lower.includes("gemini") &&
|
|
438
|
+
lower.includes("4") &&
|
|
439
|
+
lower.includes("argon")
|
|
440
|
+
) {
|
|
441
|
+
if (lower.includes("-low")) return "gemini-4-argon-low";
|
|
442
|
+
if (lower.includes("-medium")) return "gemini-4-argon-medium";
|
|
443
|
+
if (lower.includes("-high")) return "gemini-4-argon-high";
|
|
444
|
+
return "gemini-4-argon";
|
|
445
|
+
}
|
|
435
446
|
// Gemini 3.8 Flash — Antigravity exposes separate reasoning-level ids.
|
|
436
447
|
if (
|
|
437
448
|
lower.includes("gemini") &&
|
|
@@ -555,7 +566,18 @@ export interface PersistedDynamicModelOwnership {
|
|
|
555
566
|
>;
|
|
556
567
|
}
|
|
557
568
|
|
|
569
|
+
export interface PersistedDynamicModelSnapshots {
|
|
570
|
+
version: 1;
|
|
571
|
+
accounts: Record<string, {
|
|
572
|
+
credentialGenerationFingerprint: string;
|
|
573
|
+
capturedAt: number;
|
|
574
|
+
models: import("./providers/google-antigravity/dynamic-catalog.js").DynamicModelEntry[];
|
|
575
|
+
defaultAgentModelId?: string;
|
|
576
|
+
}>;
|
|
577
|
+
}
|
|
578
|
+
|
|
558
579
|
export interface PersistedState {
|
|
580
|
+
dynamicModelSnapshots?: PersistedDynamicModelSnapshots;
|
|
559
581
|
// Historical dynamic model IDs mapped to their shared quota pools.
|
|
560
582
|
dynamicModelQuotaPools?: Record<string, string>;
|
|
561
583
|
// Exact account ownership for dynamically discovered model IDs.
|
|
@@ -837,7 +859,8 @@ export interface ModelPricing {
|
|
|
837
859
|
cachingStoragePer1MPerHour?: number;
|
|
838
860
|
}
|
|
839
861
|
|
|
840
|
-
// Pricing per 1M tokens (USD) — what these would cost on paid APIs
|
|
862
|
+
// Pricing per 1M tokens (USD) — what these would cost on paid APIs.
|
|
863
|
+
// Source audit and estimation limits: docs/model-pricing.md (2026-10-25).
|
|
841
864
|
export const MODEL_PRICING: Record<string, ModelPricing> = {
|
|
842
865
|
"claude-opus-4-6-thinking": { inputPer1M: 5.0, outputPer1M: 25.0 },
|
|
843
866
|
"claude-sonnet-4-6": { inputPer1M: 3.0, outputPer1M: 15.0 },
|
|
@@ -845,35 +868,37 @@ export const MODEL_PRICING: Record<string, ModelPricing> = {
|
|
|
845
868
|
"gemini-3.1-pro-low": { inputPer1M: 2.0, outputPer1M: 12.0 },
|
|
846
869
|
"gemini-3.1-pro-high": { inputPer1M: 2.0, outputPer1M: 12.0 },
|
|
847
870
|
"gemini-3-flash": { inputPer1M: 0.5, outputPer1M: 3.0 },
|
|
871
|
+
// Standard introductory rates verified 2026-10-25; double on 2027-01-01.
|
|
872
|
+
// https://ai.google.dev/gemini-api/docs/pricing
|
|
848
873
|
"gemini-3.6-flash": {
|
|
849
|
-
inputPer1M:
|
|
850
|
-
outputPer1M:
|
|
851
|
-
cachingPer1M: 0.
|
|
852
|
-
cachingStoragePer1MPerHour:
|
|
874
|
+
inputPer1M: 0.75,
|
|
875
|
+
outputPer1M: 3.75,
|
|
876
|
+
cachingPer1M: 0.075,
|
|
877
|
+
cachingStoragePer1MPerHour: 0.5,
|
|
853
878
|
},
|
|
854
879
|
"gemini-3.6-flash-high": {
|
|
855
|
-
inputPer1M:
|
|
856
|
-
outputPer1M:
|
|
857
|
-
cachingPer1M: 0.
|
|
858
|
-
cachingStoragePer1MPerHour:
|
|
880
|
+
inputPer1M: 0.75,
|
|
881
|
+
outputPer1M: 3.75,
|
|
882
|
+
cachingPer1M: 0.075,
|
|
883
|
+
cachingStoragePer1MPerHour: 0.5,
|
|
859
884
|
},
|
|
860
885
|
"gemini-3.6-flash-medium": {
|
|
861
|
-
inputPer1M:
|
|
862
|
-
outputPer1M:
|
|
863
|
-
cachingPer1M: 0.
|
|
864
|
-
cachingStoragePer1MPerHour:
|
|
886
|
+
inputPer1M: 0.75,
|
|
887
|
+
outputPer1M: 3.75,
|
|
888
|
+
cachingPer1M: 0.075,
|
|
889
|
+
cachingStoragePer1MPerHour: 0.5,
|
|
865
890
|
},
|
|
866
891
|
"gemini-3.6-flash-low": {
|
|
867
|
-
inputPer1M:
|
|
868
|
-
outputPer1M:
|
|
869
|
-
cachingPer1M: 0.
|
|
870
|
-
cachingStoragePer1MPerHour:
|
|
892
|
+
inputPer1M: 0.75,
|
|
893
|
+
outputPer1M: 3.75,
|
|
894
|
+
cachingPer1M: 0.075,
|
|
895
|
+
cachingStoragePer1MPerHour: 0.5,
|
|
871
896
|
},
|
|
872
897
|
"gemini-3.6-flash-tiered": {
|
|
873
|
-
inputPer1M:
|
|
874
|
-
outputPer1M:
|
|
875
|
-
cachingPer1M: 0.
|
|
876
|
-
cachingStoragePer1MPerHour:
|
|
898
|
+
inputPer1M: 0.75,
|
|
899
|
+
outputPer1M: 3.75,
|
|
900
|
+
cachingPer1M: 0.075,
|
|
901
|
+
cachingStoragePer1MPerHour: 0.5,
|
|
877
902
|
},
|
|
878
903
|
// Gemini 3.7 Flash tiered — public Gemini API equivalent-value pricing,
|
|
879
904
|
// verified on the official Gemini API / Google Cloud pricing pages
|
|
@@ -888,7 +913,7 @@ export const MODEL_PRICING: Record<string, ModelPricing> = {
|
|
|
888
913
|
cachingStoragePer1MPerHour: 0.5,
|
|
889
914
|
},
|
|
890
915
|
// Gemini 3.8 Flash — introductory public Gemini API pricing verified
|
|
891
|
-
// 2026-
|
|
916
|
+
// 2026-10-25. These rates double on 2027-01-01. Antigravity exposes
|
|
892
917
|
// separate low/medium/high model ids.
|
|
893
918
|
"gemini-3.8-flash-low": {
|
|
894
919
|
inputPer1M: 0.75,
|
|
@@ -908,10 +933,32 @@ export const MODEL_PRICING: Record<string, ModelPricing> = {
|
|
|
908
933
|
cachingPer1M: 0.075,
|
|
909
934
|
cachingStoragePer1MPerHour: 0.5,
|
|
910
935
|
},
|
|
936
|
+
// Standard rates through 2026-11-30; then 4/20/0.2. Implicit cache only.
|
|
937
|
+
// https://ai.google.dev/gemini-api/docs/pricing (verified 2026-10-25).
|
|
938
|
+
"gemini-4-argon": {
|
|
939
|
+
inputPer1M: 2.0,
|
|
940
|
+
outputPer1M: 10.0,
|
|
941
|
+
cachingPer1M: 0.1,
|
|
942
|
+
},
|
|
943
|
+
"gemini-4-argon-low": {
|
|
944
|
+
inputPer1M: 2.0,
|
|
945
|
+
outputPer1M: 10.0,
|
|
946
|
+
cachingPer1M: 0.1,
|
|
947
|
+
},
|
|
948
|
+
"gemini-4-argon-medium": {
|
|
949
|
+
inputPer1M: 2.0,
|
|
950
|
+
outputPer1M: 10.0,
|
|
951
|
+
cachingPer1M: 0.1,
|
|
952
|
+
},
|
|
953
|
+
"gemini-4-argon-high": {
|
|
954
|
+
inputPer1M: 2.0,
|
|
955
|
+
outputPer1M: 10.0,
|
|
956
|
+
cachingPer1M: 0.1,
|
|
957
|
+
},
|
|
911
958
|
"gpt-oss-120b-medium": { inputPer1M: 2.0, outputPer1M: 10.0 },
|
|
912
959
|
|
|
913
960
|
// OpenAI Codex API-equivalent standard rates, checked against
|
|
914
|
-
// https://developers.openai.com/api/docs/pricing on 2026-
|
|
961
|
+
// https://developers.openai.com/api/docs/pricing on 2026-10-25.
|
|
915
962
|
// Spend logs use aggregate input/output tokens;
|
|
916
963
|
// cache rates are metadata and are not applied separately.
|
|
917
964
|
"gpt-6-astra": {
|
|
@@ -929,10 +976,11 @@ export const MODEL_PRICING: Record<string, ModelPricing> = {
|
|
|
929
976
|
outputPer1M: 0.5,
|
|
930
977
|
cachingPer1M: 0.01,
|
|
931
978
|
},
|
|
979
|
+
// Promotional pricing available at least through 2026-11-21.
|
|
932
980
|
"gpt-5.6-sol": {
|
|
933
|
-
inputPer1M:
|
|
934
|
-
outputPer1M:
|
|
935
|
-
cachingPer1M: 0.
|
|
981
|
+
inputPer1M: 4.0,
|
|
982
|
+
outputPer1M: 20.0,
|
|
983
|
+
cachingPer1M: 0.40,
|
|
936
984
|
},
|
|
937
985
|
"gpt-5.6-terra": {
|
|
938
986
|
inputPer1M: 2.0,
|
|
@@ -945,7 +993,7 @@ export const MODEL_PRICING: Record<string, ModelPricing> = {
|
|
|
945
993
|
cachingPer1M: 0.02,
|
|
946
994
|
},
|
|
947
995
|
|
|
948
|
-
// Ollama Cloud standard USD/1M rates, verified 2026-10-
|
|
996
|
+
// Ollama Cloud standard USD/1M rates, verified 2026-10-25:
|
|
949
997
|
// https://ollama.com/pricing. Aggregates do not track cache hits or off-peak
|
|
950
998
|
// billing, so savings represent standard list-price value, not a net saving.
|
|
951
999
|
"gpt-oss:20b": { inputPer1M: 0.07, outputPer1M: 0.30, cachingPer1M: 0.035 },
|
|
@@ -1111,9 +1159,10 @@ export const TAGS_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
|
1111
1159
|
export const ANTIGRAVITY_VERSION =
|
|
1112
1160
|
rotatorEnv("ANTIGRAVITY_VERSION") ||
|
|
1113
1161
|
process.env.PI_AI_ANTIGRAVITY_VERSION ||
|
|
1114
|
-
"2.
|
|
1162
|
+
"2.26.0";
|
|
1115
1163
|
export const DEFAULT_ANTIGRAVITY_USER_AGENT =
|
|
1116
|
-
|
|
1164
|
+
rotatorEnv("ANTIGRAVITY_USER_AGENT") ||
|
|
1165
|
+
`antigravity/hub/${ANTIGRAVITY_VERSION} (aidev_client; os_type=darwin; arch=arm64)`;
|
|
1117
1166
|
export const QUOTA_USER_AGENT =
|
|
1118
1167
|
rotatorEnv("QUOTA_USER_AGENT") ||
|
|
1119
1168
|
DEFAULT_ANTIGRAVITY_USER_AGENT;
|
package/src/web/app.tsx
CHANGED
|
@@ -34,6 +34,7 @@ import { ModelsPage } from "./pages/Models.js";
|
|
|
34
34
|
import { RequestsPage } from "./pages/Requests.js";
|
|
35
35
|
import { UsagePage } from "./pages/Usage.js";
|
|
36
36
|
import { KeysPage } from "./pages/Keys.js";
|
|
37
|
+
import { PlaygroundPage } from "./pages/Playground.js";
|
|
37
38
|
import { SettingsPage } from "./pages/Settings.js";
|
|
38
39
|
import { openAddAccount } from "./pages/shared.js";
|
|
39
40
|
|
|
@@ -137,6 +138,9 @@ function Shell(): JSX.Element {
|
|
|
137
138
|
case "keys":
|
|
138
139
|
page = <KeysPage />;
|
|
139
140
|
break;
|
|
141
|
+
case "playground":
|
|
142
|
+
page = <PlaygroundPage />;
|
|
143
|
+
break;
|
|
140
144
|
case "settings":
|
|
141
145
|
page = <SettingsPage />;
|
|
142
146
|
break;
|