mapigate 0.5.136 → 0.5.146

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.
Files changed (102) hide show
  1. package/README.md +8 -8
  2. package/dist/cli/commands/logs.js +0 -1
  3. package/dist/core/adapters/anthropic/requestOpenAiToAnthropic.js +1 -1
  4. package/dist/core/adapters/helpers/toolCallRescue.js +1 -1
  5. package/dist/core/adapters/responsesAdapter.js +11 -0
  6. package/dist/core/capabilities/index.js +5 -4
  7. package/dist/core/capabilities/modelDictionary.js +1 -0
  8. package/dist/core/scanner/modelScanner.js +2 -1
  9. package/dist/core/scanner/payloadExtractor.js +1 -1
  10. package/dist/core/scanner/urlResolver.js +16 -0
  11. package/dist/core/tokenSaver/methods/rtk/autodetect.js +1 -1
  12. package/dist/core/tokenSaver/methods/rtk/filters/gitLog.js +1 -1
  13. package/dist/core/usage/pricing.js +98 -42
  14. package/dist/core/usage/tokenExtractor.js +59 -0
  15. package/dist/mitm/handlers/antigravity/config.js +22 -0
  16. package/dist/mitm/handlers/antigravity/modelInjector.js +2 -2
  17. package/dist/providers/catalog/coarena/index.js +3 -0
  18. package/dist/providers/catalog/coarena/metadata.js +104 -0
  19. package/dist/providers/catalog/coarena/provider.js +91 -0
  20. package/dist/providers/catalog/coarena/quota.js +119 -0
  21. package/dist/providers/catalog/iflow/provider.js +1 -1
  22. package/dist/providers/catalog/iteracompute/metadata.js +154 -13
  23. package/dist/providers/catalog/iteracompute/provider.js +111 -0
  24. package/dist/providers/catalog/opencode-go/responsesPayload.js +1 -1
  25. package/dist/providers/catalog/openrouter/metadata.js +1 -0
  26. package/dist/providers/core/base/baseProvider.js +5 -3
  27. package/dist/providers/generated/chunks/chunk1.js +2 -2
  28. package/dist/providers/generated/chunks/chunk2.js +2 -2
  29. package/dist/providers/generated/chunks/chunk3.js +2 -2
  30. package/dist/providers/generated/chunks/chunk4.js +2 -0
  31. package/dist/providers/generated/runtime/chunk1.js +2 -2
  32. package/dist/providers/generated/runtime/chunk2.js +2 -2
  33. package/dist/providers/generated/runtime/chunk3.js +2 -2
  34. package/dist/providers/generated/runtime/chunk4.js +2 -0
  35. package/dist/providers/runtime/antigravity/executor.js +2 -2
  36. package/dist/providers/runtime/antigravity/metadata.js +2 -2
  37. package/dist/providers/runtime/antigravity/models.js +9 -0
  38. package/dist/providers/runtime/antigravity/provider.js +2 -2
  39. package/dist/providers/runtime/antigravity/routes.js +2 -2
  40. package/dist/providers/runtime/antigravity/schema.js +1 -1
  41. package/dist/providers/runtime/antigravity/types.js +10 -2
  42. package/dist/providers/runtime/gemini/provider.js +77 -0
  43. package/dist/providers/runtime/gemini-cli/provider.js +2 -2
  44. package/dist/providers/runtime/github/routes.js +1 -1
  45. package/dist/providers/runtime/grok/provider.js +1 -1
  46. package/dist/providers/runtime/kiro/provider.js +1 -1
  47. package/dist/providers/runtime/minimax/routes.js +0 -1
  48. package/dist/providers/runtime/opencode/tools.js +1 -1
  49. package/dist/providers/runtime/trae/index.js +1 -0
  50. package/dist/providers/runtime/trae/metadata.js +1 -0
  51. package/dist/providers/runtime/trae/provider.js +7 -0
  52. package/dist/providers/runtime/trae/quota.js +99 -0
  53. package/dist/providers/runtime/windsurf/routes.js +0 -2
  54. package/dist/providers/runtime/xkiro/quota.js +4 -1
  55. package/dist/providers/runtime/zed/metadata.js +1 -1
  56. package/dist/providers/runtime/zed/models.js +68 -8
  57. package/dist/providers/runtime/zed/provider.js +60 -15
  58. package/dist/providers/runtime/zed/quota.js +69 -12
  59. package/dist/providers/runtime/zed/routes.js +7 -0
  60. package/dist/server/proxy/executorHelpers.js +1 -1
  61. package/dist/server/proxy/index.js +1 -1
  62. package/dist/server/proxy/pipeline.js +12 -6
  63. package/dist/server/proxy/responseHandlers.js +2 -18
  64. package/dist/server/proxy/singleModelExecutor.js +1 -1
  65. package/dist/server/proxy/streaming/sseStreamer.js +3 -10
  66. package/dist/server/routes/apiMitm.js +1 -1
  67. package/dist/server/routes/apiModels.js +17 -12
  68. package/dist/server/utils/consoleLogBuffer.js +3 -3
  69. package/dist/shared/constants/index.js +2 -2
  70. package/dist/shared/constants/quotaOrder.js +5 -0
  71. package/dist/shared/logger.js +2 -2
  72. package/dist/storage/repositories/logRepo.js +3 -23
  73. package/dist/storage/repositories/requestDetailsRepo.js +1 -1
  74. package/dist/storage/repositories/usageRepo.js +136 -74
  75. package/dist/web/assets/{CliToolsTab-CkzwuwaC.js → CliToolsTab-BYO-wJ7y.js} +1 -1
  76. package/dist/web/assets/CombosTab-CujUAbYQ.js +1 -0
  77. package/dist/web/assets/{ConfirmModal-DGvcf0gB.js → ConfirmModal-BS3mAUd5.js} +1 -1
  78. package/dist/web/assets/{ConsoleLogTab-84Ens8T5.js → ConsoleLogTab-CSgZxPGW.js} +1 -1
  79. package/dist/web/assets/{EditAccountModal-D-_omvev.js → EditAccountModal-BhPOk3Ya.js} +1 -1
  80. package/dist/web/assets/{EndpointTab-7nBfEdYE.js → EndpointTab-BRVjAng2.js} +1 -1
  81. package/dist/web/assets/{MitmTab-CqS6mXHZ.js → MitmTab-ZOoWyRnb.js} +5 -5
  82. package/dist/web/assets/{ModelAutocompleteInput-B9syrV1O.js → ModelAutocompleteInput-DJkxW2yD.js} +1 -1
  83. package/dist/web/assets/{ProviderDetailPage-DGZceQ2d.js → ProviderDetailPage-CnWjM-0J.js} +2 -2
  84. package/dist/web/assets/ProvidersTab-BFdg0gXr.js +1 -0
  85. package/dist/web/assets/QuotaTab-DXg3adeS.js +1 -0
  86. package/dist/web/assets/{SettingsTab-4c0ksNJa.js → SettingsTab-DoYGKtDn.js} +1 -1
  87. package/dist/web/assets/UsageTab-O6OK0i38.js +1 -0
  88. package/dist/web/assets/index-5TzViNxR.js +2 -0
  89. package/dist/web/assets/metadataRegistry-W75_wn57.js +1 -0
  90. package/dist/web/assets/providers/coarena/icon.png +0 -0
  91. package/dist/web/assets/providers/coarena/icon.svg +3 -0
  92. package/dist/web/assets/providers/openrouter/icon.png +0 -0
  93. package/dist/web/assets/{providersData-DkVCRBsJ.js → providersData-BI_7MaUL.js} +1 -1
  94. package/dist/web/index.html +1 -1
  95. package/package.json +9 -1
  96. package/dist/web/assets/CombosTab-C5RzRwwr.js +0 -1
  97. package/dist/web/assets/ProvidersTab-CiYbqRou.js +0 -1
  98. package/dist/web/assets/QuotaTab-DFr0DWAU.js +0 -1
  99. package/dist/web/assets/UsageTab-BQcPmvtQ.js +0 -1
  100. package/dist/web/assets/index-C4NTQZ40.js +0 -2
  101. package/dist/web/assets/metadataRegistry-B91sal4r.js +0 -1
  102. package/dist/web/assets/providers/openrouter/openrouter.png +0 -0
@@ -0,0 +1,104 @@
1
+ export const metadata = {
2
+ id: "coarena",
3
+ name: "Coarena",
4
+ alias: "coarena",
5
+ aliases: ["coarena", "coasty"],
6
+ uiAlias: "coarena",
7
+ color: "#18181B",
8
+ iconBg: "#ffffff",
9
+ image: "/assets/providers/coarena/icon.svg",
10
+ website: "https://coarena.ai",
11
+ notice: {
12
+ apiKeyUrl: "https://coarena.ai/account/api",
13
+ text: "Free daily $5 allowance on frontier & arena models for AI agents. Note: Requests may be used for evaluation benchmarks.",
14
+ },
15
+ category: "freeTier",
16
+ authType: "api-key",
17
+ authModes: ["apikey"],
18
+ baseUrl: "https://coarena.ai/api/v1",
19
+ baseUrls: ["https://coarena.ai/api/v1"],
20
+ validateUrl: "https://coarena.ai/api/v1/limits",
21
+ modelsUrl: "https://coarena.ai/api/v1/models",
22
+ format: "openai",
23
+ supportedFormats: [
24
+ { value: "openai", label: "OpenAI (/chat/completions)" },
25
+ { value: "responses", label: "OpenAI Responses (/responses)" },
26
+ { value: "claude", label: "Anthropic (/messages)" },
27
+ ],
28
+ defaultHeaders: {
29
+ "Content-Type": "application/json",
30
+ },
31
+ thinkingMode: "auto",
32
+ models: [
33
+ {
34
+ id: "deepseek-v4-1-flash-1017",
35
+ name: "DeepSeek V4.1 Flash 1017",
36
+ isDefault: true,
37
+ capabilities: ["tools", "vision", "reasoning"],
38
+ contextLength: 128000,
39
+ },
40
+ {
41
+ id: "gpt-6-1-sol",
42
+ name: "GPT-6.1 Sol",
43
+ capabilities: ["tools", "vision", "reasoning"],
44
+ contextLength: 128000,
45
+ },
46
+ {
47
+ id: "gpt-6-1-terra",
48
+ name: "GPT-6.1 Terra",
49
+ capabilities: ["tools", "vision", "reasoning"],
50
+ contextLength: 128000,
51
+ },
52
+ {
53
+ id: "gpt-6-astra",
54
+ name: "GPT-6 Astra",
55
+ capabilities: ["tools", "vision", "reasoning"],
56
+ contextLength: 128000,
57
+ },
58
+ {
59
+ id: "gpt-6-luna",
60
+ name: "GPT-6 Luna",
61
+ capabilities: ["tools", "vision", "reasoning"],
62
+ contextLength: 128000,
63
+ },
64
+ {
65
+ id: "gemini-4-argon",
66
+ name: "Gemini 4 Argon",
67
+ capabilities: ["tools", "vision", "reasoning"],
68
+ contextLength: 128000,
69
+ },
70
+ {
71
+ id: "gemini-4-carbon",
72
+ name: "Gemini 4 Carbon",
73
+ capabilities: ["tools", "vision", "reasoning"],
74
+ contextLength: 128000,
75
+ },
76
+ {
77
+ id: "gemini-3-8-flash",
78
+ name: "Gemini 3.8 Flash",
79
+ capabilities: ["tools", "vision", "reasoning"],
80
+ contextLength: 128000,
81
+ },
82
+ {
83
+ id: "grok-4-7",
84
+ name: "Grok 4.7",
85
+ capabilities: ["tools", "vision", "reasoning"],
86
+ contextLength: 128000,
87
+ },
88
+ {
89
+ id: "kimi-k3-1-pro",
90
+ name: "Kimi K3.1 Pro",
91
+ capabilities: ["tools", "vision", "reasoning"],
92
+ contextLength: 128000,
93
+ },
94
+ ],
95
+ quotaOrder: [
96
+ "Daily Allowance ($ USD)",
97
+ "Rate Limit (RPM)",
98
+ "Requests Today",
99
+ "Concurrency",
100
+ ],
101
+ passthroughModels: true,
102
+ };
103
+ export const provider = metadata;
104
+ export default metadata;
@@ -0,0 +1,91 @@
1
+ import { OpenAiCompatibleProvider } from "../../core/base/openAiProvider.js";
2
+ import { getCoarenaUsage, COARENA_LIMITS_URL } from "./quota.js";
3
+ import { metadata } from "./metadata.js";
4
+ export class CoarenaProvider extends OpenAiCompatibleProvider {
5
+ id = metadata.id;
6
+ name = metadata.name;
7
+ defaultFormat = metadata.format || "openai";
8
+ supportsQuota() {
9
+ return true;
10
+ }
11
+ async fetchQuota(context) {
12
+ return await getCoarenaUsage(context);
13
+ }
14
+ async probeModels(context) {
15
+ const token = (context.apiKey || context.account?.rawApiKey || "").trim();
16
+ if (!token) {
17
+ return {
18
+ success: false,
19
+ error: "Coarena API key is required.",
20
+ };
21
+ }
22
+ const timeoutMs = context.timeoutMs || 8000;
23
+ const reqHeaders = {
24
+ Authorization: token.startsWith("Bearer ") ? token : `Bearer ${token}`,
25
+ Accept: "application/json",
26
+ ...(context.customHeaders || {}),
27
+ };
28
+ // 1. Verify key validity against limits endpoint
29
+ try {
30
+ const limitsRes = await fetch(COARENA_LIMITS_URL, {
31
+ method: "GET",
32
+ headers: reqHeaders,
33
+ signal: AbortSignal.timeout(timeoutMs),
34
+ });
35
+ if (limitsRes.status === 401 || limitsRes.status === 403) {
36
+ return {
37
+ success: false,
38
+ error: `Authentication failed (HTTP ${limitsRes.status}): Invalid Coarena API key`,
39
+ authError: "Invalid API key",
40
+ };
41
+ }
42
+ }
43
+ catch {
44
+ // Proceed to models endpoint if limits verification encounters network timeout
45
+ }
46
+ // 2. Fetch active models from /api/v1/models
47
+ const modelsUrl = metadata.modelsUrl || "https://coarena.ai/api/v1/models";
48
+ try {
49
+ const res = await fetch(modelsUrl, {
50
+ method: "GET",
51
+ headers: reqHeaders,
52
+ signal: AbortSignal.timeout(timeoutMs),
53
+ });
54
+ if (res.ok) {
55
+ const payload = await res.json();
56
+ const rawList = Array.isArray(payload?.data) ? payload.data : [];
57
+ const models = rawList.map((m) => ({
58
+ id: m.id,
59
+ name: m.display_name || m.name || m.id,
60
+ contextLength: m.context_length || m.max_input_tokens || 128000,
61
+ capabilities: {
62
+ reasoning: Boolean(m.capabilities?.reasoning_text),
63
+ vision: Boolean(m.capabilities?.vision),
64
+ audio: false,
65
+ },
66
+ }));
67
+ return {
68
+ success: true,
69
+ endpointUrl: modelsUrl,
70
+ models: models.length > 0
71
+ ? models
72
+ : metadata.models.map((m) => ({ id: m.id, name: m.name, contextLength: m.contextLength })),
73
+ count: models.length > 0 ? models.length : metadata.models.length,
74
+ };
75
+ }
76
+ const errText = await res.text().catch(() => "");
77
+ return {
78
+ success: false,
79
+ error: `Endpoint ${modelsUrl} returned HTTP ${res.status}: ${errText.slice(0, 100)}`,
80
+ };
81
+ }
82
+ catch (err) {
83
+ const msg = err instanceof Error ? err.message : String(err);
84
+ return {
85
+ success: false,
86
+ error: `Failed to connect to Coarena: ${msg}`,
87
+ };
88
+ }
89
+ }
90
+ }
91
+ export default CoarenaProvider;
@@ -0,0 +1,119 @@
1
+ export const COARENA_LIMITS_URL = "https://coarena.ai/api/v1/limits";
2
+ export async function getCoarenaUsage(context, options) {
3
+ const fetchFn = options?.fetchFn || globalThis.fetch;
4
+ const apiKey = (context.account?.rawApiKey || "").trim();
5
+ if (!apiKey) {
6
+ return { plan: "Coarena", message: "Coarena API key is required." };
7
+ }
8
+ try {
9
+ const res = await fetchFn(COARENA_LIMITS_URL, {
10
+ method: "GET",
11
+ headers: {
12
+ Authorization: apiKey.startsWith("Bearer ") ? apiKey : `Bearer ${apiKey}`,
13
+ Accept: "application/json",
14
+ },
15
+ signal: AbortSignal.timeout(8000),
16
+ });
17
+ if (res.status === 401 || res.status === 403) {
18
+ return {
19
+ plan: "Coarena",
20
+ error: `Authentication failed (HTTP ${res.status}): Invalid Coarena API key`,
21
+ };
22
+ }
23
+ if (!res.ok) {
24
+ return {
25
+ plan: "Coarena",
26
+ error: `Failed to fetch Coarena limits (HTTP ${res.status})`,
27
+ };
28
+ }
29
+ const json = await res.json();
30
+ const data = json?.data || {};
31
+ const usdPerDay = typeof data.usd_per_day === "number" ? data.usd_per_day : 5;
32
+ const usedUsd = typeof data.today?.used_usd === "number" ? data.today.used_usd : 0;
33
+ const leftUsd = typeof data.today?.left_usd === "number"
34
+ ? data.today.left_usd
35
+ : Math.max(0, usdPerDay - usedUsd);
36
+ const remainingPercent = usdPerDay > 0
37
+ ? Math.max(0, Math.min(100, Math.round((leftUsd / usdPerDay) * 100)))
38
+ : 0;
39
+ const rpm = Number(data.requests_per_minute_key) || Number(data.default_requests_per_minute) || 60;
40
+ const resetsAt = data.today?.resets_at || null;
41
+ const quotas = {
42
+ daily_usd: {
43
+ displayName: "Daily Allowance ($ USD)",
44
+ total: usdPerDay,
45
+ used: usedUsd,
46
+ remaining: leftUsd,
47
+ remainingPercentage: remainingPercent,
48
+ resetAt: resetsAt,
49
+ recurring: true,
50
+ },
51
+ rpm: {
52
+ displayName: "Rate Limit (RPM)",
53
+ total: rpm,
54
+ used: 0,
55
+ remaining: rpm,
56
+ remainingPercentage: 100,
57
+ unlimited: false,
58
+ },
59
+ };
60
+ if (data.requests_per_day != null) {
61
+ const rpd = Number(data.requests_per_day);
62
+ const reqUsed = Number(data.today?.requests) || 0;
63
+ const reqLeft = typeof data.today?.requests_left === "number"
64
+ ? data.today.requests_left
65
+ : Math.max(0, rpd - reqUsed);
66
+ const reqPercent = rpd > 0 ? Math.max(0, Math.min(100, Math.round((reqLeft / rpd) * 100))) : 0;
67
+ quotas.requests_today = {
68
+ displayName: "Requests Today",
69
+ total: rpd,
70
+ used: reqUsed,
71
+ remaining: reqLeft,
72
+ remainingPercentage: reqPercent,
73
+ resetAt: resetsAt,
74
+ recurring: true,
75
+ };
76
+ }
77
+ else if (data.today?.requests != null) {
78
+ const reqUsed = Number(data.today.requests) || 0;
79
+ quotas.requests_today = {
80
+ displayName: "Requests Today",
81
+ total: reqUsed,
82
+ used: reqUsed,
83
+ remaining: 0,
84
+ remainingPercentage: 100,
85
+ unlimited: true,
86
+ resetAt: resetsAt,
87
+ recurring: true,
88
+ };
89
+ }
90
+ if (typeof data.concurrency === "number") {
91
+ quotas.concurrency = {
92
+ displayName: "Concurrency",
93
+ total: data.concurrency,
94
+ used: 0,
95
+ remaining: data.concurrency,
96
+ remainingPercentage: 100,
97
+ unlimited: false,
98
+ };
99
+ }
100
+ let planName = "Free Tier ($5/day)";
101
+ if (data.source === "granted" || (data.usd_per_day && data.usd_per_day > 5)) {
102
+ planName = `Granted ($${data.usd_per_day}/day)`;
103
+ }
104
+ else if (data.free === false) {
105
+ planName = "Paid Tier";
106
+ }
107
+ return {
108
+ plan: planName,
109
+ quotas,
110
+ };
111
+ }
112
+ catch (err) {
113
+ const msg = err instanceof Error ? err.message : String(err);
114
+ return {
115
+ plan: "Coarena",
116
+ error: `Failed to connect to Coarena quota API: ${msg}`,
117
+ };
118
+ }
119
+ }
@@ -42,7 +42,7 @@ export class IflowProvider extends OpenAiCompatibleProvider {
42
42
  };
43
43
  }
44
44
  }
45
- catch (err) {
45
+ catch {
46
46
  // Fall back to API key verification
47
47
  }
48
48
  }
@@ -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 V4, and GLM models."
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: true,
31
- capabilities: ["tools"],
32
- contextLength: 128000
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
- let parameters = tool.parameters && typeof tool.parameters === "object" && !Array.isArray(tool.parameters)
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 }
@@ -4,6 +4,7 @@ export const metadata = {
4
4
  "name": "OpenRouter",
5
5
  "alias": "openrouter",
6
6
  "color": "#F97316",
7
+ "iconBg": "#03080a",
7
8
  "image": "/assets/providers/openrouter/icon.png",
8
9
  "website": "https://openrouter.ai",
9
10
  "notice": {
@@ -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 = `Endpoint ${url} returned HTTP ${res.status}: ${errDetail}`;
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) {