scalemax 0.1.39 → 0.1.41
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.
|
@@ -712,7 +712,7 @@ export function selectHelperModel(models, requested) {
|
|
|
712
712
|
throw new Error(`Model "${requested}" is not available to this API key. Run \`scalemax models\` to see available models.`);
|
|
713
713
|
return exact.id;
|
|
714
714
|
}
|
|
715
|
-
const preferred = ['gpt-5.4', 'gpt-5.4-mini', 'claude-haiku-4-5-20251001', '
|
|
715
|
+
const preferred = ['gpt-5.4', 'gpt-5.4-mini', 'claude-haiku-4-5-20251001', 'fable-5', 'gpt-5.6-terra', 'gpt-5.6-sol'];
|
|
716
716
|
for (const id of preferred) {
|
|
717
717
|
const match = models.find(model => model.id.toLowerCase() === id);
|
|
718
718
|
if (match)
|
package/dist/configure/models.js
CHANGED
|
@@ -11,7 +11,7 @@ export function jsonConfig(client, apiKey, baseUrl, extra = {}) {
|
|
|
11
11
|
}, null, 2) + '\n';
|
|
12
12
|
}
|
|
13
13
|
export function continueConfig(apiKey, baseUrl) {
|
|
14
|
-
const models = ['gpt-5.6-sol', 'gpt-5.6-
|
|
14
|
+
const models = ['gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.5', 'gpt-5.4', 'gpt-5.4-mini', 'gpt-5.3-codex', 'codex-auto-review', 'deepseek-v4-flash'];
|
|
15
15
|
return JSON.stringify({
|
|
16
16
|
models: models.map(model => ({
|
|
17
17
|
title: model === 'deepseek-v4-flash' ? 'ScaleMax DeepSeek V4 Flash' : `ScaleMax ${model}`,
|
package/dist/utils/api.d.ts
CHANGED
package/dist/utils/api.js
CHANGED
|
@@ -22,7 +22,7 @@ function modelFamily(model) {
|
|
|
22
22
|
}
|
|
23
23
|
// Keep only aliases that are no longer offered. Direct GPT-5.6 Sol is an
|
|
24
24
|
// active Codex model and must remain available to all generated clients.
|
|
25
|
-
export const RETIRED_MODEL_IDS = new Set(['fable-5-ultra']);
|
|
25
|
+
export const RETIRED_MODEL_IDS = new Set(['fable-5-ultra', 'gpt-5.6-luna']);
|
|
26
26
|
export function isRetiredModelId(id) {
|
|
27
27
|
return RETIRED_MODEL_IDS.has(id.trim());
|
|
28
28
|
}
|
|
@@ -37,6 +37,34 @@ export function isAnthropicModel(model) {
|
|
|
37
37
|
return model.id.startsWith('claude-') && !model.id.startsWith('claude-fable-');
|
|
38
38
|
}
|
|
39
39
|
export function filterModelsForScope(models, scope) {
|
|
40
|
+
// The server intentionally returns official Claude/OpenAI facade IDs for
|
|
41
|
+
// Auto so native Claude gateway discovery accepts the catalog. The CLI's
|
|
42
|
+
// authenticated profile must still be a single public `auto` model: every
|
|
43
|
+
// request is coerced to that route, and selecting a facade alias locally
|
|
44
|
+
// would make Codex/Claude send an ID the catalog filter would reject. Accept
|
|
45
|
+
// either the direct model (used by older gateways/tests) or a trusted facade
|
|
46
|
+
// and normalize it to the same safe profile.
|
|
47
|
+
if (scope === AUTO_API_SCOPE) {
|
|
48
|
+
const direct = models.find(model => model.id.trim().toLowerCase() === AUTO_MODEL_ID && isModelRouteAvailable(model));
|
|
49
|
+
if (direct)
|
|
50
|
+
return [direct];
|
|
51
|
+
const facade = models.find(model => {
|
|
52
|
+
if (!isModelRouteAvailable(model))
|
|
53
|
+
return false;
|
|
54
|
+
const owner = String(model.provider || model.owned_by || '').trim().toLowerCase();
|
|
55
|
+
return owner === 'scalemax' && model.tagline === 'Routes through ScaleMax Auto';
|
|
56
|
+
});
|
|
57
|
+
if (!facade)
|
|
58
|
+
return [];
|
|
59
|
+
return [{
|
|
60
|
+
...facade,
|
|
61
|
+
id: AUTO_MODEL_ID,
|
|
62
|
+
display_name: 'Auto',
|
|
63
|
+
owned_by: 'scalemax',
|
|
64
|
+
provider: 'scalemax',
|
|
65
|
+
tagline: 'ScaleMax Auto',
|
|
66
|
+
}];
|
|
67
|
+
}
|
|
40
68
|
return models.filter(model => {
|
|
41
69
|
if (isRetiredModelId(model.id))
|
|
42
70
|
return false;
|
|
@@ -58,7 +86,7 @@ export function filterModelsForScope(models, scope) {
|
|
|
58
86
|
// unexpectedly broad catalog can never widen a customer's key locally.
|
|
59
87
|
if (exactScope)
|
|
60
88
|
return scope === exactScope;
|
|
61
|
-
if (scope === DEEPSEEK_V4_FLASH_SCOPE || scope === GLM_5_2_SCOPE
|
|
89
|
+
if (scope === DEEPSEEK_V4_FLASH_SCOPE || scope === GLM_5_2_SCOPE)
|
|
62
90
|
return false;
|
|
63
91
|
// A family scope reaches ONLY its own family. This must be an allowlist:
|
|
64
92
|
// the old final line fell through to `!isAnthropicModel(model)` for any
|
package/dist/utils/network.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent, ProxyAgent } from 'undici';
|
|
1
|
+
import { Agent, ProxyAgent, fetch as undiciFetch } from 'undici';
|
|
2
2
|
/*
|
|
3
3
|
* Node's built-in fetch does not consistently honor HTTP(S)_PROXY/NO_PROXY
|
|
4
4
|
* across the supported Node 18-22 range. It can also wait on an unusable
|
|
@@ -78,13 +78,22 @@ function dispatcherFor(url) {
|
|
|
78
78
|
}
|
|
79
79
|
return dispatcher;
|
|
80
80
|
}
|
|
81
|
+
function fetchWithMatchingDispatcher() {
|
|
82
|
+
// Node 26's built-in fetch rejects dispatcher instances from the npm
|
|
83
|
+
// `undici` package. Use Undici's own fetch in real CLI runs so the fetch and
|
|
84
|
+
// dispatcher come from the same implementation; keep global fetch in Vitest
|
|
85
|
+
// so the existing network tests can stub requests without real I/O.
|
|
86
|
+
if (process.env.VITEST)
|
|
87
|
+
return globalThis.fetch;
|
|
88
|
+
return undiciFetch;
|
|
89
|
+
}
|
|
81
90
|
export async function scaleMaxFetch(input, init = {}, allowProxyFallback = false) {
|
|
82
91
|
const url = input instanceof URL ? input : new URL(input);
|
|
83
92
|
const proxy = proxyFor(url);
|
|
84
93
|
const useProxy = Boolean(proxy)
|
|
85
94
|
&& (allowProxyFallback || proxyPreferredOrigins.has(url.origin));
|
|
86
95
|
const dispatcher = useProxy ? dispatcherFor(url) : directDispatcher;
|
|
87
|
-
const response = await
|
|
96
|
+
const response = await fetchWithMatchingDispatcher()(input, { ...init, dispatcher });
|
|
88
97
|
if (useProxy)
|
|
89
98
|
proxyPreferredOrigins.add(url.origin);
|
|
90
99
|
return response;
|