mapigate 0.5.136 → 0.5.141
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/README.md +1 -1
- package/dist/cli/commands/logs.js +0 -1
- package/dist/core/adapters/anthropic/requestOpenAiToAnthropic.js +1 -1
- package/dist/core/adapters/helpers/toolCallRescue.js +1 -1
- package/dist/core/adapters/responsesAdapter.js +11 -0
- package/dist/core/capabilities/modelDictionary.js +1 -0
- package/dist/core/scanner/modelScanner.js +2 -1
- package/dist/core/scanner/payloadExtractor.js +1 -1
- package/dist/core/scanner/urlResolver.js +16 -0
- package/dist/core/tokenSaver/methods/rtk/autodetect.js +1 -1
- package/dist/core/tokenSaver/methods/rtk/filters/gitLog.js +1 -1
- package/dist/core/usage/pricing.js +98 -42
- package/dist/core/usage/tokenExtractor.js +59 -0
- package/dist/mitm/handlers/antigravity/config.js +22 -0
- package/dist/mitm/handlers/antigravity/modelInjector.js +2 -2
- package/dist/providers/catalog/iflow/provider.js +1 -1
- package/dist/providers/catalog/iteracompute/metadata.js +154 -13
- package/dist/providers/catalog/iteracompute/provider.js +111 -0
- package/dist/providers/catalog/opencode-go/responsesPayload.js +1 -1
- package/dist/providers/catalog/openrouter/metadata.js +1 -0
- package/dist/providers/core/base/baseProvider.js +5 -3
- package/dist/providers/runtime/antigravity/executor.js +2 -2
- package/dist/providers/runtime/antigravity/metadata.js +2 -2
- package/dist/providers/runtime/antigravity/models.js +9 -0
- package/dist/providers/runtime/antigravity/provider.js +2 -2
- package/dist/providers/runtime/antigravity/routes.js +2 -2
- package/dist/providers/runtime/antigravity/schema.js +1 -1
- package/dist/providers/runtime/antigravity/types.js +10 -2
- package/dist/providers/runtime/gemini/provider.js +77 -0
- package/dist/providers/runtime/gemini-cli/provider.js +2 -2
- package/dist/providers/runtime/github/routes.js +1 -1
- package/dist/providers/runtime/grok/provider.js +1 -1
- package/dist/providers/runtime/kiro/provider.js +1 -1
- package/dist/providers/runtime/minimax/routes.js +0 -1
- package/dist/providers/runtime/opencode/tools.js +1 -1
- package/dist/providers/runtime/windsurf/routes.js +0 -2
- package/dist/providers/runtime/xkiro/quota.js +4 -1
- package/dist/server/proxy/executorHelpers.js +1 -1
- package/dist/server/proxy/index.js +1 -1
- package/dist/server/proxy/pipeline.js +12 -6
- package/dist/server/proxy/responseHandlers.js +2 -18
- package/dist/server/proxy/singleModelExecutor.js +1 -1
- package/dist/server/proxy/streaming/sseStreamer.js +3 -10
- package/dist/server/routes/apiMitm.js +1 -1
- package/dist/server/routes/apiModels.js +17 -12
- package/dist/server/utils/consoleLogBuffer.js +3 -3
- package/dist/shared/constants/index.js +2 -2
- package/dist/shared/logger.js +2 -2
- package/dist/storage/repositories/logRepo.js +3 -23
- package/dist/storage/repositories/requestDetailsRepo.js +1 -1
- package/dist/storage/repositories/usageRepo.js +136 -74
- package/dist/web/assets/{CliToolsTab-CkzwuwaC.js → CliToolsTab-rKSWLJC3.js} +1 -1
- package/dist/web/assets/CombosTab-D1_cfssh.js +1 -0
- package/dist/web/assets/{ConfirmModal-DGvcf0gB.js → ConfirmModal-OWeauwYv.js} +1 -1
- package/dist/web/assets/{ConsoleLogTab-84Ens8T5.js → ConsoleLogTab-rZe8zCb_.js} +1 -1
- package/dist/web/assets/{EditAccountModal-D-_omvev.js → EditAccountModal-CAg-yIOn.js} +1 -1
- package/dist/web/assets/{EndpointTab-7nBfEdYE.js → EndpointTab-B-Jb4wAG.js} +1 -1
- package/dist/web/assets/{MitmTab-CqS6mXHZ.js → MitmTab-5dKeNi4T.js} +5 -5
- package/dist/web/assets/{ModelAutocompleteInput-B9syrV1O.js → ModelAutocompleteInput-CoinzdsW.js} +1 -1
- package/dist/web/assets/{ProviderDetailPage-DGZceQ2d.js → ProviderDetailPage-D-fodBhz.js} +2 -2
- package/dist/web/assets/ProvidersTab-yzmb4w0D.js +1 -0
- package/dist/web/assets/{QuotaTab-DFr0DWAU.js → QuotaTab-BXevQzen.js} +1 -1
- package/dist/web/assets/{SettingsTab-4c0ksNJa.js → SettingsTab-LkByv4Sg.js} +1 -1
- package/dist/web/assets/UsageTab-Hr8XPZD4.js +1 -0
- package/dist/web/assets/index-CKuvklEr.js +2 -0
- package/dist/web/assets/metadataRegistry-NuDSSkP9.js +1 -0
- package/dist/web/assets/providers/openrouter/icon.png +0 -0
- package/dist/web/assets/{providersData-DkVCRBsJ.js → providersData-DS1-ETBi.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +9 -1
- package/dist/web/assets/CombosTab-C5RzRwwr.js +0 -1
- package/dist/web/assets/ProvidersTab-CiYbqRou.js +0 -1
- package/dist/web/assets/UsageTab-BQcPmvtQ.js +0 -1
- package/dist/web/assets/index-C4NTQZ40.js +0 -2
- package/dist/web/assets/metadataRegistry-B91sal4r.js +0 -1
- package/dist/web/assets/providers/openrouter/openrouter.png +0 -0
|
@@ -7,16 +7,17 @@ export const metadata = {
|
|
|
7
7
|
color: "#6366F1",
|
|
8
8
|
iconBg: "#ffffff",
|
|
9
9
|
image: "/assets/providers/iteracompute/icon.svg",
|
|
10
|
-
website: "https://iteracompute.com",
|
|
10
|
+
website: "https://platform.iteracompute.com",
|
|
11
11
|
notice: {
|
|
12
|
-
apiKeyUrl: "https://iteracompute.com",
|
|
13
|
-
text: "OpenAI-compatible gateway with 30M free monthly tokens (160k TPM) for Qwen, DeepSeek
|
|
12
|
+
apiKeyUrl: "https://platform.iteracompute.com",
|
|
13
|
+
text: "OpenAI-compatible gateway with 30M free monthly tokens (160k TPM) for Auto, Qwen, DeepSeek, and GLM models. Documentation: https://platform.iteracompute.com/docs.html"
|
|
14
14
|
},
|
|
15
15
|
category: "freeTier",
|
|
16
16
|
authType: "apikey",
|
|
17
17
|
authModes: ["apikey"],
|
|
18
18
|
baseUrl: "https://api.iteracompute.com/v1",
|
|
19
19
|
baseUrls: ["https://api.iteracompute.com/v1"],
|
|
20
|
+
modelsUrl: "https://api.iteracompute.com/v1/models",
|
|
20
21
|
validateUrl: "https://api.iteracompute.com/v1/models",
|
|
21
22
|
format: "openai",
|
|
22
23
|
defaultHeaders: {
|
|
@@ -24,33 +25,173 @@ export const metadata = {
|
|
|
24
25
|
},
|
|
25
26
|
thinkingMode: "auto",
|
|
26
27
|
models: [
|
|
28
|
+
{
|
|
29
|
+
id: "Auto",
|
|
30
|
+
name: "Auto (Free 30M/mo)",
|
|
31
|
+
isDefault: true,
|
|
32
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
33
|
+
contextLength: 262144
|
|
34
|
+
},
|
|
27
35
|
{
|
|
28
36
|
id: "qwen/qwen3.8-27b",
|
|
29
37
|
name: "Qwen 3.8 27B",
|
|
30
|
-
isDefault:
|
|
31
|
-
capabilities: ["tools"],
|
|
32
|
-
contextLength:
|
|
38
|
+
isDefault: false,
|
|
39
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
40
|
+
contextLength: 262144
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "deepseek/deepseek-v4.1-flash",
|
|
44
|
+
name: "DeepSeek V4.1 Flash",
|
|
45
|
+
isDefault: false,
|
|
46
|
+
capabilities: ["tools", "reasoning"],
|
|
47
|
+
contextLength: 1048576
|
|
33
48
|
},
|
|
34
49
|
{
|
|
35
|
-
id: "deepseek/deepseek-v4-flash",
|
|
36
|
-
name: "DeepSeek V4 Flash",
|
|
50
|
+
id: "deepseek/deepseek-v4.1-flash-1017",
|
|
51
|
+
name: "DeepSeek V4.1 Flash 1017",
|
|
37
52
|
isDefault: false,
|
|
38
|
-
capabilities: ["tools"],
|
|
53
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
39
54
|
contextLength: 1048576
|
|
40
55
|
},
|
|
41
56
|
{
|
|
42
|
-
id: "deepseek/deepseek-v4-pro",
|
|
43
|
-
name: "DeepSeek V4 Pro",
|
|
57
|
+
id: "deepseek/deepseek-v4-pro-0813",
|
|
58
|
+
name: "DeepSeek V4 Pro 0813",
|
|
44
59
|
isDefault: false,
|
|
45
|
-
capabilities: ["tools"],
|
|
60
|
+
capabilities: ["tools", "reasoning"],
|
|
46
61
|
contextLength: 1048576
|
|
47
62
|
},
|
|
48
63
|
{
|
|
49
64
|
id: "z-ai/glm-5.3-flash",
|
|
50
65
|
name: "GLM 5.3 Flash",
|
|
51
66
|
isDefault: false,
|
|
52
|
-
capabilities: ["tools", "vision"],
|
|
67
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
68
|
+
contextLength: 1048576
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "z-ai/glm-5.3",
|
|
72
|
+
name: "GLM 5.3",
|
|
73
|
+
isDefault: false,
|
|
74
|
+
capabilities: ["tools", "reasoning"],
|
|
75
|
+
contextLength: 1048576
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "z-ai/glm-5.2",
|
|
79
|
+
name: "GLM 5.2",
|
|
80
|
+
isDefault: false,
|
|
81
|
+
capabilities: ["tools", "reasoning"],
|
|
82
|
+
contextLength: 1048576
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "moonshotai/kimi-k2.5",
|
|
86
|
+
name: "Kimi K2.5",
|
|
87
|
+
isDefault: false,
|
|
88
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
89
|
+
contextLength: 262144
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "moonshotai/kimi-k2.6",
|
|
93
|
+
name: "Kimi K2.6",
|
|
94
|
+
isDefault: false,
|
|
95
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
96
|
+
contextLength: 262144
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "moonshotai/kimi-k2.7-code",
|
|
100
|
+
name: "Kimi K2.7 Code",
|
|
101
|
+
isDefault: false,
|
|
102
|
+
capabilities: ["tools", "reasoning"],
|
|
103
|
+
contextLength: 262144
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "moonshotai/kimi-k3",
|
|
107
|
+
name: "Kimi K3",
|
|
108
|
+
isDefault: false,
|
|
109
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
53
110
|
contextLength: 1048576
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: "moonshotai/kimi-k3.1-pro",
|
|
114
|
+
name: "Kimi K3.1 Pro",
|
|
115
|
+
isDefault: false,
|
|
116
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
117
|
+
contextLength: 917504
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "minimax/minimax-m2.5",
|
|
121
|
+
name: "MiniMax M2.5",
|
|
122
|
+
isDefault: false,
|
|
123
|
+
capabilities: ["reasoning"],
|
|
124
|
+
contextLength: 204800
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: "minimax/minimax-m2.7",
|
|
128
|
+
name: "MiniMax M2.7",
|
|
129
|
+
isDefault: false,
|
|
130
|
+
capabilities: ["tools", "reasoning"],
|
|
131
|
+
contextLength: 204800
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: "minimax/minimax-m3",
|
|
135
|
+
name: "MiniMax M3",
|
|
136
|
+
isDefault: false,
|
|
137
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
138
|
+
contextLength: 1048576
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: "qwen/qwen3.8-flash",
|
|
142
|
+
name: "Qwen 3.8 Flash",
|
|
143
|
+
isDefault: false,
|
|
144
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
145
|
+
contextLength: 1048576
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "qwen/qwen3.8-max",
|
|
149
|
+
name: "Qwen 3.8 Max",
|
|
150
|
+
isDefault: false,
|
|
151
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
152
|
+
contextLength: 1048576
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: "gemini/gemini-3.8-flash",
|
|
156
|
+
name: "Gemini 3.8 Flash",
|
|
157
|
+
isDefault: false,
|
|
158
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
159
|
+
contextLength: 1048576
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
id: "gemini/gemini-4-argon",
|
|
163
|
+
name: "Gemini 4 Argon",
|
|
164
|
+
isDefault: false,
|
|
165
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
166
|
+
contextLength: 1048576
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "anthropic/claude-sonnet-5-5",
|
|
170
|
+
name: "Claude Sonnet 5.5",
|
|
171
|
+
isDefault: false,
|
|
172
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
173
|
+
contextLength: 1000000
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
id: "anthropic/claude-haiku-5-5",
|
|
177
|
+
name: "Claude Haiku 5.5",
|
|
178
|
+
isDefault: false,
|
|
179
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
180
|
+
contextLength: 1000000
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: "openai/gpt-6-luna",
|
|
184
|
+
name: "GPT-6 Luna",
|
|
185
|
+
isDefault: false,
|
|
186
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
187
|
+
contextLength: 1050000
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "openai/gpt-6.1-sol",
|
|
191
|
+
name: "GPT-6.1 Sol",
|
|
192
|
+
isDefault: false,
|
|
193
|
+
capabilities: ["tools", "reasoning", "vision"],
|
|
194
|
+
contextLength: 1050000
|
|
54
195
|
}
|
|
55
196
|
],
|
|
56
197
|
passthroughModels: true
|
|
@@ -11,5 +11,116 @@ export class IteracomputeProvider extends OpenAiCompatibleProvider {
|
|
|
11
11
|
async fetchQuota(context) {
|
|
12
12
|
return await getIteracomputeUsage(context);
|
|
13
13
|
}
|
|
14
|
+
async probeModels(context) {
|
|
15
|
+
const token = (context.apiKey || context.account?.rawApiKey || context.account?.apiKey || "").trim();
|
|
16
|
+
const timeoutMs = context.timeoutMs || 8000;
|
|
17
|
+
const probeUrl = "https://api.iteracompute.com/v1/models";
|
|
18
|
+
const reqHeaders = {
|
|
19
|
+
Accept: "application/json",
|
|
20
|
+
...(metadata.defaultHeaders || {}),
|
|
21
|
+
...(context.customHeaders || {}),
|
|
22
|
+
};
|
|
23
|
+
if (token) {
|
|
24
|
+
reqHeaders["Authorization"] = token.startsWith("Bearer ") ? token : `Bearer ${token}`;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const res = await fetch(probeUrl, {
|
|
28
|
+
method: "GET",
|
|
29
|
+
headers: reqHeaders,
|
|
30
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
31
|
+
});
|
|
32
|
+
if (res.status === 401 || res.status === 403) {
|
|
33
|
+
let errDetail = "";
|
|
34
|
+
try {
|
|
35
|
+
const errJson = await res.json();
|
|
36
|
+
errDetail = errJson?.error?.message || errJson?.message || errJson?.detail || "";
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
const errText = await res.text().catch(() => "");
|
|
40
|
+
if (errText && !errText.includes("<html") && errText.length < 200) {
|
|
41
|
+
errDetail = errText.trim();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
success: false,
|
|
46
|
+
error: errDetail
|
|
47
|
+
? `Authentication failed (HTTP ${res.status}): ${errDetail}`
|
|
48
|
+
: `Authentication failed (HTTP ${res.status}) for account "${context.account?.name || this.name}". Please verify your IteraCompute API key.`,
|
|
49
|
+
authError: errDetail || "Invalid API key",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (res.ok || res.status === 200) {
|
|
53
|
+
const payload = await res.json();
|
|
54
|
+
const rawList = Array.isArray(payload?.data) ? payload.data : [];
|
|
55
|
+
if (rawList.length > 0) {
|
|
56
|
+
const scanned = rawList.map((m) => {
|
|
57
|
+
const p = m.model_disclosure?.model_parameters;
|
|
58
|
+
return {
|
|
59
|
+
id: m.id,
|
|
60
|
+
name: m.name || m.id,
|
|
61
|
+
contextLength: m.context_window || p?.limits?.context_tokens || 128000,
|
|
62
|
+
capabilities: {
|
|
63
|
+
tools: Boolean(p?.features?.tools || m.tools || m.id?.includes("code") || m.id?.includes("flash") || m.id?.includes("27b") || m.id === "Auto"),
|
|
64
|
+
reasoning: Boolean(p?.features?.reasoning || m.reasoning?.supported || m.id?.includes("reason") || m.id?.includes("pro") || m.id === "Auto"),
|
|
65
|
+
vision: Boolean(p?.features?.vision || m.id?.includes("vision") || m.id?.includes("image") || m.id?.includes("glm") || m.id === "Auto"),
|
|
66
|
+
audio: false,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
success: true,
|
|
72
|
+
endpointUrl: probeUrl,
|
|
73
|
+
models: scanned,
|
|
74
|
+
count: scanned.length,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Upstream catalog unavailable (e.g. 503 "provider catalog unavailable"):
|
|
79
|
+
// Gracefully fall back to pre-configured models so valid accounts remain connected
|
|
80
|
+
const fallbackModels = metadata.models.map((m) => ({
|
|
81
|
+
id: m.id,
|
|
82
|
+
name: m.name,
|
|
83
|
+
contextLength: m.contextLength || 128000,
|
|
84
|
+
capabilities: {
|
|
85
|
+
tools: Boolean(m.capabilities?.includes("tools")),
|
|
86
|
+
reasoning: Boolean(m.capabilities?.includes("reasoning")),
|
|
87
|
+
vision: Boolean(m.capabilities?.includes("vision")),
|
|
88
|
+
audio: false,
|
|
89
|
+
},
|
|
90
|
+
}));
|
|
91
|
+
return {
|
|
92
|
+
success: true,
|
|
93
|
+
endpointUrl: probeUrl,
|
|
94
|
+
models: fallbackModels,
|
|
95
|
+
count: fallbackModels.length,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
100
|
+
if (token) {
|
|
101
|
+
const fallbackModels = metadata.models.map((m) => ({
|
|
102
|
+
id: m.id,
|
|
103
|
+
name: m.name,
|
|
104
|
+
contextLength: m.contextLength || 128000,
|
|
105
|
+
capabilities: {
|
|
106
|
+
tools: Boolean(m.capabilities?.includes("tools")),
|
|
107
|
+
reasoning: Boolean(m.capabilities?.includes("reasoning")),
|
|
108
|
+
vision: Boolean(m.capabilities?.includes("vision")),
|
|
109
|
+
audio: false,
|
|
110
|
+
},
|
|
111
|
+
}));
|
|
112
|
+
return {
|
|
113
|
+
success: true,
|
|
114
|
+
endpointUrl: probeUrl,
|
|
115
|
+
models: fallbackModels,
|
|
116
|
+
count: fallbackModels.length,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
success: false,
|
|
121
|
+
error: `Failed to connect to IteraCompute (${probeUrl}): ${msg}`,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
14
125
|
}
|
|
15
126
|
export default IteracomputeProvider;
|
|
@@ -59,7 +59,7 @@ function normalizeTools(tools) {
|
|
|
59
59
|
if (!name)
|
|
60
60
|
continue;
|
|
61
61
|
const description = typeof tool.description === "string" ? tool.description : fn?.description;
|
|
62
|
-
|
|
62
|
+
const parameters = tool.parameters && typeof tool.parameters === "object" && !Array.isArray(tool.parameters)
|
|
63
63
|
? { ...tool.parameters }
|
|
64
64
|
: fn?.parameters && typeof fn.parameters === "object" && !Array.isArray(fn.parameters)
|
|
65
65
|
? { ...fn.parameters }
|
|
@@ -277,12 +277,14 @@ export class BaseProvider {
|
|
|
277
277
|
let errDetail = res.statusText;
|
|
278
278
|
try {
|
|
279
279
|
const errJson = await res.json();
|
|
280
|
-
if (errJson?.message || errJson?.error?.message) {
|
|
281
|
-
errDetail = errJson?.message || errJson?.error?.message;
|
|
280
|
+
if (errJson?.message || errJson?.error?.message || errJson?.detail) {
|
|
281
|
+
errDetail = errJson?.message || errJson?.error?.message || errJson?.detail;
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
catch { }
|
|
285
|
-
lastError
|
|
285
|
+
if (!(res.status === 404 && lastError && (lastError.includes("HTTP 5") || lastError.includes("HTTP 401") || lastError.includes("HTTP 403")))) {
|
|
286
|
+
lastError = `Endpoint ${url} returned HTTP ${res.status}: ${errDetail}`;
|
|
287
|
+
}
|
|
286
288
|
}
|
|
287
289
|
}
|
|
288
290
|
catch (err) {
|
|
@@ -46,7 +46,7 @@ export async function executeAntigravity(context, providerInstance) {
|
|
|
46
46
|
const body = context.body || req?.body || {};
|
|
47
47
|
const isStreaming = body.stream !== false && !isPanel;
|
|
48
48
|
// 1. Resolve Account Credentials
|
|
49
|
-
|
|
49
|
+
const creds = resolveAccountCredentials(context);
|
|
50
50
|
if (!creds || !creds.accessToken) {
|
|
51
51
|
return {
|
|
52
52
|
ok: false,
|
|
@@ -337,7 +337,7 @@ export async function executeAntigravity(context, providerInstance) {
|
|
|
337
337
|
const headers = {
|
|
338
338
|
"Content-Type": "application/json",
|
|
339
339
|
Authorization: `Bearer ${creds.accessToken}`,
|
|
340
|
-
"User-Agent": "antigravity/hub/2.
|
|
340
|
+
"User-Agent": "antigravity/hub/2.31.2 darwin/arm64",
|
|
341
341
|
Accept: isStreaming ? "text/event-stream" : "application/json",
|
|
342
342
|
"x-request-source": "local",
|
|
343
343
|
};
|
|
@@ -27,7 +27,7 @@ export const metadata = {
|
|
|
27
27
|
"validateUrl": "",
|
|
28
28
|
"format": "antigravity",
|
|
29
29
|
"defaultHeaders": {
|
|
30
|
-
"User-Agent": "antigravity/hub/2.
|
|
30
|
+
"User-Agent": "antigravity/hub/2.31.2 darwin/arm64"
|
|
31
31
|
},
|
|
32
32
|
"thinkingMode": "auto",
|
|
33
33
|
"oauth": {
|
|
@@ -45,7 +45,7 @@ export const metadata = {
|
|
|
45
45
|
"apiVersion": "v1internal",
|
|
46
46
|
"loadCodeAssistEndpoint": "https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist",
|
|
47
47
|
"onboardUserEndpoint": "https://cloudcode-pa.googleapis.com/v1internal:onboardUser",
|
|
48
|
-
"loadCodeAssistUserAgent": "antigravity/hub/2.
|
|
48
|
+
"loadCodeAssistUserAgent": "antigravity/hub/2.31.2 darwin/arm64",
|
|
49
49
|
"refreshLeadMs": 300000
|
|
50
50
|
},
|
|
51
51
|
models
|
|
@@ -2,6 +2,15 @@ export const models = [
|
|
|
2
2
|
{ "id": "gemini-4-argon-high", "name": "Gemini 4 Argon (High)", "upstreamModelId": "gemini-4-argon-high(high)", "isDefault": false },
|
|
3
3
|
{ "id": "gemini-4-argon-medium", "name": "Gemini 4 Argon (Medium)", "upstreamModelId": "gemini-4-argon-medium(medium)", "isDefault": false },
|
|
4
4
|
{ "id": "gemini-4-argon-low", "name": "Gemini 4 Argon (Low)", "upstreamModelId": "gemini-4-argon-low(low)", "isDefault": false },
|
|
5
|
+
{ "id": "gemini-4-argon", "name": "Gemini 4 Argon", "upstreamModelId": "gemini-4-argon-medium(medium)", "isDefault": false },
|
|
6
|
+
{ "id": "gemini-4-carbon-high", "name": "Gemini 4 Carbon (High)", "upstreamModelId": "gemini-4-carbon-high(high)", "isDefault": false },
|
|
7
|
+
{ "id": "gemini-4-carbon-medium", "name": "Gemini 4 Carbon (Medium)", "upstreamModelId": "gemini-4-carbon-medium(medium)", "isDefault": false },
|
|
8
|
+
{ "id": "gemini-4-carbon-low", "name": "Gemini 4 Carbon (Low)", "upstreamModelId": "gemini-4-carbon-low(low)", "isDefault": false },
|
|
9
|
+
{ "id": "gemini-4-carbon", "name": "Gemini 4 Carbon", "upstreamModelId": "gemini-4-carbon-medium(medium)", "isDefault": false },
|
|
10
|
+
{ "id": "gemini-4-hydrogen-high", "name": "Gemini 4 Hydrogen (High)", "upstreamModelId": "gemini-4-hydrogen-high(high)", "isDefault": false },
|
|
11
|
+
{ "id": "gemini-4-hydrogen-medium", "name": "Gemini 4 Hydrogen (Medium)", "upstreamModelId": "gemini-4-hydrogen-medium(medium)", "isDefault": false },
|
|
12
|
+
{ "id": "gemini-4-hydrogen-low", "name": "Gemini 4 Hydrogen (Low)", "upstreamModelId": "gemini-4-hydrogen-low(low)", "isDefault": false },
|
|
13
|
+
{ "id": "gemini-4-hydrogen", "name": "Gemini 4 Hydrogen", "upstreamModelId": "gemini-4-hydrogen-medium(medium)", "isDefault": false },
|
|
5
14
|
{ "id": "gemini-3.8-flash-high", "name": "Gemini 3.8 Flash (High)", "upstreamModelId": "gemini-3.8-flash-high(high)", "isDefault": false },
|
|
6
15
|
{ "id": "gemini-3.8-flash-medium", "name": "Gemini 3.8 Flash (Medium)", "upstreamModelId": "gemini-3.8-flash-medium(medium)", "isDefault": false },
|
|
7
16
|
{ "id": "gemini-3.8-flash-low", "name": "Gemini 3.8 Flash (Low)", "upstreamModelId": "gemini-3.8-flash-low(low)", "isDefault": false },
|
|
@@ -91,9 +91,9 @@ export class AntigravityProvider extends BaseProvider {
|
|
|
91
91
|
];
|
|
92
92
|
const reqHeaders = {
|
|
93
93
|
"Content-Type": "application/json",
|
|
94
|
-
"User-Agent": "antigravity/hub/2.
|
|
94
|
+
"User-Agent": "antigravity/hub/2.31.2 darwin/arm64",
|
|
95
95
|
"X-Client-Name": "antigravity",
|
|
96
|
-
"X-Client-Version": "2.
|
|
96
|
+
"X-Client-Version": "2.31.2",
|
|
97
97
|
"x-request-source": "local",
|
|
98
98
|
Accept: "application/json",
|
|
99
99
|
...(context.customHeaders || {}),
|
|
@@ -55,7 +55,7 @@ export async function loadCodeAssist(accessToken) {
|
|
|
55
55
|
headers: {
|
|
56
56
|
Authorization: `Bearer ${accessToken}`,
|
|
57
57
|
"Content-Type": "application/json",
|
|
58
|
-
"User-Agent": "antigravity/hub/2.
|
|
58
|
+
"User-Agent": "antigravity/hub/2.31.2 darwin/arm64",
|
|
59
59
|
"x-request-source": "local",
|
|
60
60
|
},
|
|
61
61
|
body: JSON.stringify({ metadata: { ideType: 9, platform: getPlatformId(), pluginType: 2 } }),
|
|
@@ -80,7 +80,7 @@ export function onboardUser(accessToken, tierId) {
|
|
|
80
80
|
const headers = {
|
|
81
81
|
Authorization: `Bearer ${accessToken}`,
|
|
82
82
|
"Content-Type": "application/json",
|
|
83
|
-
"User-Agent": "antigravity/hub/2.
|
|
83
|
+
"User-Agent": "antigravity/hub/2.31.2 darwin/arm64",
|
|
84
84
|
"x-request-source": "local",
|
|
85
85
|
};
|
|
86
86
|
(async () => {
|
|
@@ -112,7 +112,7 @@ export const UNSUPPORTED_SCHEMA_CONSTRAINTS = [
|
|
|
112
112
|
export function sanitizeGeminiFunctionName(name) {
|
|
113
113
|
if (!name)
|
|
114
114
|
return "_unknown";
|
|
115
|
-
let sanitized = name.replace(/[^a-zA-Z0-9_
|
|
115
|
+
let sanitized = name.replace(/[^a-zA-Z0-9_.:-]/g, "_");
|
|
116
116
|
if (!/^[a-zA-Z_]/.test(sanitized)) {
|
|
117
117
|
sanitized = "_" + sanitized;
|
|
118
118
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const ANTIGRAVITY_IDE_VERSION = "2.
|
|
2
|
-
export const ANTIGRAVITY_USER_AGENT = "antigravity/hub/2.
|
|
1
|
+
export const ANTIGRAVITY_IDE_VERSION = "2.31.2";
|
|
2
|
+
export const ANTIGRAVITY_USER_AGENT = "antigravity/hub/2.31.2 darwin/arm64";
|
|
3
3
|
export const ANTIGRAVITY_LOAD_PROJECT_URL = "https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist";
|
|
4
4
|
export const ANTIGRAVITY_QUOTA_MODELS_URL = "https://daily-cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels";
|
|
5
5
|
export const ANTIGRAVITY_QUOTA_SUMMARY_URL = "https://daily-cloudcode-pa.googleapis.com/v1internal:retrieveUserQuotaSummary";
|
|
@@ -59,6 +59,14 @@ export const IMPORTANT_MODELS = [
|
|
|
59
59
|
"gemini-4-argon-medium",
|
|
60
60
|
"gemini-4-argon-low",
|
|
61
61
|
"gemini-4-argon",
|
|
62
|
+
"gemini-4-carbon-high",
|
|
63
|
+
"gemini-4-carbon-medium",
|
|
64
|
+
"gemini-4-carbon-low",
|
|
65
|
+
"gemini-4-carbon",
|
|
66
|
+
"gemini-4-hydrogen-high",
|
|
67
|
+
"gemini-4-hydrogen-medium",
|
|
68
|
+
"gemini-4-hydrogen-low",
|
|
69
|
+
"gemini-4-hydrogen",
|
|
62
70
|
"gemini-3.8-flash-high",
|
|
63
71
|
"gemini-3.8-flash-medium",
|
|
64
72
|
"gemini-3.8-flash-low",
|
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
import { OpenAiCompatibleProvider } from "../../core/base/openAiProvider.js";
|
|
2
2
|
import { extractModelsFromPayload } from "../../../core/scanner/payloadExtractor.js";
|
|
3
|
+
const GEMINI_OPENAI_ALLOWED_FIELDS = new Set([
|
|
4
|
+
"model",
|
|
5
|
+
"messages",
|
|
6
|
+
"temperature",
|
|
7
|
+
"top_p",
|
|
8
|
+
"n",
|
|
9
|
+
"stream",
|
|
10
|
+
"stream_options",
|
|
11
|
+
"stop",
|
|
12
|
+
"max_tokens",
|
|
13
|
+
"max_completion_tokens",
|
|
14
|
+
"response_format",
|
|
15
|
+
"seed",
|
|
16
|
+
"tools",
|
|
17
|
+
"tool_choice",
|
|
18
|
+
"reasoning_effort",
|
|
19
|
+
"extra_body",
|
|
20
|
+
"modalities",
|
|
21
|
+
"audio",
|
|
22
|
+
"cached_content",
|
|
23
|
+
]);
|
|
24
|
+
const GEMINI_MESSAGE_ALLOWED_FIELDS = new Set([
|
|
25
|
+
"role",
|
|
26
|
+
"content",
|
|
27
|
+
"name",
|
|
28
|
+
"tool_calls",
|
|
29
|
+
"tool_call_id",
|
|
30
|
+
"refusal",
|
|
31
|
+
"audio",
|
|
32
|
+
]);
|
|
33
|
+
function sanitizeGeminiOpenAiPayload(payload) {
|
|
34
|
+
if (!payload || typeof payload !== "object")
|
|
35
|
+
return payload;
|
|
36
|
+
const sanitized = {};
|
|
37
|
+
for (const key of Object.keys(payload)) {
|
|
38
|
+
if (GEMINI_OPENAI_ALLOWED_FIELDS.has(key) && payload[key] !== undefined) {
|
|
39
|
+
sanitized[key] = payload[key];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (Array.isArray(sanitized.messages)) {
|
|
43
|
+
sanitized.messages = sanitized.messages.map((msg) => {
|
|
44
|
+
if (!msg || typeof msg !== "object")
|
|
45
|
+
return msg;
|
|
46
|
+
const cleanMsg = {};
|
|
47
|
+
for (const key of Object.keys(msg)) {
|
|
48
|
+
if (GEMINI_MESSAGE_ALLOWED_FIELDS.has(key) && msg[key] !== undefined) {
|
|
49
|
+
cleanMsg[key] = msg[key];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return cleanMsg;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (Array.isArray(sanitized.tools)) {
|
|
56
|
+
sanitized.tools = sanitized.tools.map((tool) => {
|
|
57
|
+
if (!tool || typeof tool !== "object")
|
|
58
|
+
return tool;
|
|
59
|
+
if (tool.type === "function" && tool.function && typeof tool.function === "object") {
|
|
60
|
+
const cleanFn = {
|
|
61
|
+
name: tool.function.name,
|
|
62
|
+
};
|
|
63
|
+
if (tool.function.description !== undefined) {
|
|
64
|
+
cleanFn.description = tool.function.description;
|
|
65
|
+
}
|
|
66
|
+
if (tool.function.parameters !== undefined) {
|
|
67
|
+
cleanFn.parameters = tool.function.parameters;
|
|
68
|
+
}
|
|
69
|
+
return { type: "function", function: cleanFn };
|
|
70
|
+
}
|
|
71
|
+
return tool;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return sanitized;
|
|
75
|
+
}
|
|
3
76
|
export class GeminiProvider extends OpenAiCompatibleProvider {
|
|
4
77
|
id = "gemini";
|
|
5
78
|
name = "Google Gemini";
|
|
@@ -7,6 +80,10 @@ export class GeminiProvider extends OpenAiCompatibleProvider {
|
|
|
7
80
|
supportsQuota() {
|
|
8
81
|
return true;
|
|
9
82
|
}
|
|
83
|
+
transformRequestBody(context) {
|
|
84
|
+
const converted = super.transformRequestBody(context);
|
|
85
|
+
return sanitizeGeminiOpenAiPayload(converted);
|
|
86
|
+
}
|
|
10
87
|
buildUrl(context) {
|
|
11
88
|
const accountBase = (context.account?.providerSpecificData?.baseUrl || "").trim();
|
|
12
89
|
const rawBase = (accountBase || context.provider?.baseUrl || "").trim();
|
|
@@ -44,9 +44,9 @@ export class GeminiCliProvider extends OpenAiCompatibleProvider {
|
|
|
44
44
|
];
|
|
45
45
|
const reqHeaders = {
|
|
46
46
|
"Content-Type": "application/json",
|
|
47
|
-
"User-Agent": "antigravity/hub/2.
|
|
47
|
+
"User-Agent": "antigravity/hub/2.31.2 darwin/arm64",
|
|
48
48
|
"X-Client-Name": "antigravity",
|
|
49
|
-
"X-Client-Version": "2.
|
|
49
|
+
"X-Client-Version": "2.31.2",
|
|
50
50
|
"x-request-source": "local",
|
|
51
51
|
Accept: "application/json",
|
|
52
52
|
...(context.customHeaders || {}),
|
|
@@ -110,7 +110,7 @@ export async function importGithubToken(params) {
|
|
|
110
110
|
const cleanToken = params.token.trim();
|
|
111
111
|
let copilotToken = cleanToken;
|
|
112
112
|
let copilotTokenExpiresAt = 0;
|
|
113
|
-
|
|
113
|
+
const accountName = params.name || "GitHub Copilot Key";
|
|
114
114
|
try {
|
|
115
115
|
const cpRes = await fetch("https://api.github.com/copilot_internal/v2/token", {
|
|
116
116
|
headers: {
|
|
@@ -76,7 +76,7 @@ export class KiroProvider extends OpenAiCompatibleProvider {
|
|
|
76
76
|
async probeModels(context) {
|
|
77
77
|
const timeoutMs = context.timeoutMs || 8000;
|
|
78
78
|
const region = context.region || context.account?.providerSpecificData?.region || "us-east-1";
|
|
79
|
-
|
|
79
|
+
const token = (context.apiKey || context.account?.providerSpecificData?.accessToken || context.account?.rawApiKey || "").trim();
|
|
80
80
|
const profileArn = context.account?.providerSpecificData?.profileArn || resolveDefaultProfileArn(context.account?.providerSpecificData?.authMethod);
|
|
81
81
|
// Enforce Coral JSON RPC headers (customHeaders must not override Content-Type or Accept)
|
|
82
82
|
const reqHeaders = {
|
|
@@ -4,7 +4,6 @@ import { OAuthHandlerRegistry } from "../../core/oauthRegistry.js";
|
|
|
4
4
|
import { generatePKCE } from "../../../shared/utils/pkce.js";
|
|
5
5
|
const minimaxPendingVerifiers = new Map();
|
|
6
6
|
export async function requestMinimaxDeviceCode(params) {
|
|
7
|
-
const pId = (params?.provider || "minimax-code").toLowerCase();
|
|
8
7
|
const region = params?.region || params?.extraData?.region;
|
|
9
8
|
const isCn = region === "cn";
|
|
10
9
|
const url = isCn
|
|
@@ -252,7 +252,7 @@ export function applyEnvFingerprint(body, flat, { claude = false } = {}) {
|
|
|
252
252
|
return false;
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
export function retargetToolChoice(body, map,
|
|
255
|
+
export function retargetToolChoice(body, map, _format = "openai") {
|
|
256
256
|
if (!body || typeof body !== "object" || !map?.size)
|
|
257
257
|
return;
|
|
258
258
|
const choice = body.tool_choice;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import { OAuthHandlerRegistry } from "../../core/oauthRegistry.js";
|
|
3
3
|
import { ProviderRepository } from "../../../storage/repositories/providerRepo.js";
|
|
4
|
-
import { resolvePublicCred } from "../../../shared/utils/publicCreds.js";
|
|
5
|
-
const WINDSURF_CLIENT_ID = resolvePublicCred("windsurf_client_id");
|
|
6
4
|
const WINDSURF_REGISTER_URL = "https://register.windsurf.com/exa.seat_management_pb.SeatManagementService/RegisterUser";
|
|
7
5
|
const DEVIN_AUTH_CODE_URL = "https://app.devin.ai/auth/windsurf/show-auth-code";
|
|
8
6
|
function parseWindsurfCallback(raw) {
|