claudish 5.6.1 → 5.7.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/dist/index.js +111 -17
- package/package.json +1 -1
- package/recommended-models.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29083,6 +29083,8 @@ var init_model_parser = __esm(() => {
|
|
|
29083
29083
|
zai: "zai",
|
|
29084
29084
|
oc: "ollamacloud",
|
|
29085
29085
|
zen: "opencode-zen",
|
|
29086
|
+
zengo: "opencode-zen-go",
|
|
29087
|
+
zgo: "opencode-zen-go",
|
|
29086
29088
|
v: "vertex",
|
|
29087
29089
|
vertex: "vertex",
|
|
29088
29090
|
go: "gemini-codeassist",
|
|
@@ -29163,6 +29165,8 @@ var init_model_parser = __esm(() => {
|
|
|
29163
29165
|
{ prefix: "zai/", provider: "zai", stripPrefix: true },
|
|
29164
29166
|
{ prefix: "oc/", provider: "ollamacloud", stripPrefix: true },
|
|
29165
29167
|
{ prefix: "zen/", provider: "opencode-zen", stripPrefix: true },
|
|
29168
|
+
{ prefix: "zengo/", provider: "opencode-zen-go", stripPrefix: true },
|
|
29169
|
+
{ prefix: "zgo/", provider: "opencode-zen-go", stripPrefix: true },
|
|
29166
29170
|
{ prefix: "v/", provider: "vertex", stripPrefix: true },
|
|
29167
29171
|
{ prefix: "vertex/", provider: "vertex", stripPrefix: true },
|
|
29168
29172
|
{ prefix: "go/", provider: "gemini-codeassist", stripPrefix: true },
|
|
@@ -29337,6 +29341,7 @@ function resolveRemoteProvider(modelId) {
|
|
|
29337
29341
|
zai: "zai",
|
|
29338
29342
|
ollamacloud: "ollamacloud",
|
|
29339
29343
|
"opencode-zen": "opencode-zen",
|
|
29344
|
+
"opencode-zen-go": "opencode-zen-go",
|
|
29340
29345
|
vertex: "vertex",
|
|
29341
29346
|
"gemini-codeassist": "gemini-codeassist",
|
|
29342
29347
|
litellm: "litellm"
|
|
@@ -29547,7 +29552,7 @@ var getRemoteProviders = () => [
|
|
|
29547
29552
|
name: "opencode-zen",
|
|
29548
29553
|
baseUrl: process.env.OPENCODE_BASE_URL || "https://opencode.ai/zen",
|
|
29549
29554
|
apiPath: "/v1/chat/completions",
|
|
29550
|
-
apiKeyEnvVar: "",
|
|
29555
|
+
apiKeyEnvVar: "OPENCODE_API_KEY",
|
|
29551
29556
|
prefixes: ["zen/"],
|
|
29552
29557
|
capabilities: {
|
|
29553
29558
|
supportsTools: true,
|
|
@@ -29557,6 +29562,20 @@ var getRemoteProviders = () => [
|
|
|
29557
29562
|
supportsReasoning: false
|
|
29558
29563
|
}
|
|
29559
29564
|
},
|
|
29565
|
+
{
|
|
29566
|
+
name: "opencode-zen-go",
|
|
29567
|
+
baseUrl: process.env.OPENCODE_BASE_URL ? process.env.OPENCODE_BASE_URL.replace("/zen", "/zen/go") : "https://opencode.ai/zen/go",
|
|
29568
|
+
apiPath: "/v1/chat/completions",
|
|
29569
|
+
apiKeyEnvVar: "OPENCODE_API_KEY",
|
|
29570
|
+
prefixes: ["zengo/", "zgo/"],
|
|
29571
|
+
capabilities: {
|
|
29572
|
+
supportsTools: true,
|
|
29573
|
+
supportsVision: false,
|
|
29574
|
+
supportsStreaming: true,
|
|
29575
|
+
supportsJsonMode: true,
|
|
29576
|
+
supportsReasoning: true
|
|
29577
|
+
}
|
|
29578
|
+
},
|
|
29560
29579
|
{
|
|
29561
29580
|
name: "vertex",
|
|
29562
29581
|
baseUrl: "",
|
|
@@ -31817,7 +31836,7 @@ async function fetchGLMCodingModels() {
|
|
|
31817
31836
|
return [];
|
|
31818
31837
|
}
|
|
31819
31838
|
}
|
|
31820
|
-
var __filename4, __dirname4, VERSION = "5.
|
|
31839
|
+
var __filename4, __dirname4, VERSION = "5.7.0", CACHE_MAX_AGE_DAYS2 = 2, MODELS_JSON_PATH, CLAUDISH_CACHE_DIR2, ALL_MODELS_JSON_PATH;
|
|
31821
31840
|
var init_cli = __esm(() => {
|
|
31822
31841
|
init_config();
|
|
31823
31842
|
init_model_loader();
|
|
@@ -34476,22 +34495,89 @@ function toModelInfo(model) {
|
|
|
34476
34495
|
source: "OpenRouter"
|
|
34477
34496
|
};
|
|
34478
34497
|
}
|
|
34498
|
+
async function fetchZenGoModels() {
|
|
34499
|
+
const apiKey = process.env.OPENCODE_API_KEY;
|
|
34500
|
+
if (!apiKey)
|
|
34501
|
+
return [];
|
|
34502
|
+
const ZEN_GO_BASE = process.env.OPENCODE_BASE_URL ? process.env.OPENCODE_BASE_URL.replace("/zen", "/zen/go") : "https://opencode.ai/zen/go";
|
|
34503
|
+
try {
|
|
34504
|
+
const mdevResp = await fetch("https://models.dev/api.json", { signal: AbortSignal.timeout(5000) });
|
|
34505
|
+
if (!mdevResp.ok)
|
|
34506
|
+
return [];
|
|
34507
|
+
const mdevData = await mdevResp.json();
|
|
34508
|
+
const ocModels = mdevData?.opencode?.models ?? {};
|
|
34509
|
+
const candidateIds = Object.keys(ocModels);
|
|
34510
|
+
const fallbackIds = ["glm-5"];
|
|
34511
|
+
const probeResults = await Promise.all(candidateIds.map(async (modelId) => {
|
|
34512
|
+
try {
|
|
34513
|
+
const r = await fetch(`${ZEN_GO_BASE}/v1/chat/completions`, {
|
|
34514
|
+
method: "POST",
|
|
34515
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
|
|
34516
|
+
body: JSON.stringify({ model: modelId, messages: [{ role: "user", content: "hi" }], max_tokens: 1 }),
|
|
34517
|
+
signal: AbortSignal.timeout(8000)
|
|
34518
|
+
});
|
|
34519
|
+
if (!r.ok)
|
|
34520
|
+
return null;
|
|
34521
|
+
const body = await r.json().catch(() => ({}));
|
|
34522
|
+
return Array.isArray(body?.choices) && body.choices.length > 0 ? modelId : null;
|
|
34523
|
+
} catch {
|
|
34524
|
+
return null;
|
|
34525
|
+
}
|
|
34526
|
+
}));
|
|
34527
|
+
const discoveredIds = probeResults.filter(Boolean);
|
|
34528
|
+
const goModelIds = discoveredIds.length > 0 ? discoveredIds : fallbackIds;
|
|
34529
|
+
return goModelIds.map((id) => {
|
|
34530
|
+
const m = ocModels[id];
|
|
34531
|
+
if (!m)
|
|
34532
|
+
return null;
|
|
34533
|
+
const inputModalities = m.modalities?.input ?? [];
|
|
34534
|
+
return {
|
|
34535
|
+
id: `zgo@${id}`,
|
|
34536
|
+
name: m.name || id,
|
|
34537
|
+
description: `OpenCode Zen Go plan model`,
|
|
34538
|
+
provider: "Zen Go",
|
|
34539
|
+
pricing: { input: "PLAN", output: "PLAN", average: "PLAN" },
|
|
34540
|
+
context: m.limit?.context ? `${Math.round(m.limit.context / 1000)}K` : "128K",
|
|
34541
|
+
contextLength: m.limit?.context || 128000,
|
|
34542
|
+
supportsTools: m.tool_call === true,
|
|
34543
|
+
supportsReasoning: m.reasoning || false,
|
|
34544
|
+
supportsVision: inputModalities.includes("image") || inputModalities.includes("video"),
|
|
34545
|
+
isFree: false,
|
|
34546
|
+
source: "Zen"
|
|
34547
|
+
};
|
|
34548
|
+
}).filter(Boolean);
|
|
34549
|
+
} catch {
|
|
34550
|
+
return [];
|
|
34551
|
+
}
|
|
34552
|
+
}
|
|
34479
34553
|
async function fetchZenFreeModels() {
|
|
34480
34554
|
try {
|
|
34481
|
-
const
|
|
34482
|
-
|
|
34483
|
-
|
|
34484
|
-
|
|
34555
|
+
const ZEN_BASE = process.env.OPENCODE_BASE_URL || "https://opencode.ai/zen";
|
|
34556
|
+
const ZEN_API_KEY = process.env.OPENCODE_API_KEY || "public";
|
|
34557
|
+
const [mdevResp, liveResp] = await Promise.all([
|
|
34558
|
+
fetch("https://models.dev/api.json", { signal: AbortSignal.timeout(5000) }),
|
|
34559
|
+
fetch(`${ZEN_BASE}/v1/models`, {
|
|
34560
|
+
headers: { Authorization: `Bearer ${ZEN_API_KEY}` },
|
|
34561
|
+
signal: AbortSignal.timeout(5000)
|
|
34562
|
+
})
|
|
34563
|
+
]);
|
|
34564
|
+
if (!mdevResp.ok)
|
|
34485
34565
|
return [];
|
|
34486
|
-
|
|
34487
|
-
const
|
|
34488
|
-
const opencode = data.opencode;
|
|
34566
|
+
const mdevData = await mdevResp.json();
|
|
34567
|
+
const opencode = mdevData.opencode;
|
|
34489
34568
|
if (!opencode?.models)
|
|
34490
34569
|
return [];
|
|
34491
|
-
|
|
34570
|
+
const liveIds = new Set;
|
|
34571
|
+
if (liveResp.ok) {
|
|
34572
|
+
const liveData = await liveResp.json();
|
|
34573
|
+
for (const m of liveData.data ?? [])
|
|
34574
|
+
liveIds.add(m.id);
|
|
34575
|
+
}
|
|
34576
|
+
return Object.entries(opencode.models).filter(([id, m]) => {
|
|
34492
34577
|
const isFree = m.cost?.input === 0 && m.cost?.output === 0;
|
|
34493
34578
|
const supportsTools = m.tool_call === true;
|
|
34494
|
-
|
|
34579
|
+
const isLive = liveIds.size === 0 || liveIds.has(id);
|
|
34580
|
+
return isFree && supportsTools && isLive;
|
|
34495
34581
|
}).map(([id, m]) => {
|
|
34496
34582
|
const inputModalities = m.modalities?.input || [];
|
|
34497
34583
|
const supportsVision = inputModalities.includes("image") || inputModalities.includes("video");
|
|
@@ -34895,7 +34981,8 @@ async function getAllModelsForSearch(forceUpdate = false) {
|
|
|
34895
34981
|
{ name: "GLM", promise: fetchGLMDirectModels() },
|
|
34896
34982
|
{ name: "GLM Coding", promise: fetchGLMCodingModels2() },
|
|
34897
34983
|
{ name: "OllamaCloud", promise: fetchOllamaCloudModels() },
|
|
34898
|
-
{ name: "Zen", promise: fetchZenFreeModels() }
|
|
34984
|
+
{ name: "Zen", promise: fetchZenFreeModels() },
|
|
34985
|
+
{ name: "Zen Go", promise: fetchZenGoModels() }
|
|
34899
34986
|
];
|
|
34900
34987
|
if (litellmBaseUrl && litellmApiKey) {
|
|
34901
34988
|
fetchEntries.push({ name: "LiteLLM", promise: fetchLiteLLMModels(litellmBaseUrl, litellmApiKey, forceUpdate) });
|
|
@@ -64461,6 +64548,9 @@ function getRecoveryHint(status, errorText, providerName) {
|
|
|
64461
64548
|
return "Rate limited. Wait, reduce concurrency, or check plan limits.";
|
|
64462
64549
|
}
|
|
64463
64550
|
if (status === 401 || status === 403) {
|
|
64551
|
+
if (lower.includes("not supported") || lower.includes("unsupported model") || lower.includes("model not found")) {
|
|
64552
|
+
return "Model not supported by this provider. Verify model name.";
|
|
64553
|
+
}
|
|
64464
64554
|
return "Check API key / OAuth credentials.";
|
|
64465
64555
|
}
|
|
64466
64556
|
if (status === 404) {
|
|
@@ -64715,6 +64805,8 @@ class OpenAIProvider {
|
|
|
64715
64805
|
static formatDisplayName(name) {
|
|
64716
64806
|
if (name === "opencode-zen")
|
|
64717
64807
|
return "Zen";
|
|
64808
|
+
if (name === "opencode-zen-go")
|
|
64809
|
+
return "Zen Go";
|
|
64718
64810
|
if (name === "glm")
|
|
64719
64811
|
return "GLM";
|
|
64720
64812
|
if (name === "glm-coding")
|
|
@@ -65280,24 +65372,26 @@ async function createProxyServer(port, openrouterApiKey, model, monitorMode = fa
|
|
|
65280
65372
|
isInteractive: options.isInteractive
|
|
65281
65373
|
});
|
|
65282
65374
|
log(`[Proxy] Created ${resolved.provider.name} handler (composed): ${resolved.modelName}`);
|
|
65283
|
-
} else if (resolved.provider.name === "opencode-zen") {
|
|
65375
|
+
} else if (resolved.provider.name === "opencode-zen" || resolved.provider.name === "opencode-zen-go") {
|
|
65376
|
+
const zenApiKey = apiKey || "public";
|
|
65377
|
+
const isGoProvider = resolved.provider.name === "opencode-zen-go";
|
|
65284
65378
|
if (resolved.modelName.toLowerCase().includes("minimax")) {
|
|
65285
|
-
const zenAcProvider = new AnthropicCompatProvider(resolved.provider,
|
|
65379
|
+
const zenAcProvider = new AnthropicCompatProvider(resolved.provider, zenApiKey);
|
|
65286
65380
|
const zenAcAdapter = new AnthropicPassthroughAdapter(resolved.modelName, resolved.provider.name);
|
|
65287
65381
|
handler = new ComposedHandler(zenAcProvider, targetModel, resolved.modelName, port, {
|
|
65288
65382
|
adapter: zenAcAdapter,
|
|
65289
65383
|
isInteractive: options.isInteractive
|
|
65290
65384
|
});
|
|
65291
|
-
log(`[Proxy] Created OpenCode Zen (Anthropic composed): ${resolved.modelName}`);
|
|
65385
|
+
log(`[Proxy] Created OpenCode Zen${isGoProvider ? " Go" : ""} (Anthropic composed): ${resolved.modelName}`);
|
|
65292
65386
|
} else {
|
|
65293
|
-
const zenProvider = new OpenAIProvider(resolved.provider, resolved.modelName,
|
|
65387
|
+
const zenProvider = new OpenAIProvider(resolved.provider, resolved.modelName, zenApiKey);
|
|
65294
65388
|
const zenAdapter = new OpenAIAdapter(resolved.modelName, resolved.provider.capabilities);
|
|
65295
65389
|
handler = new ComposedHandler(zenProvider, targetModel, resolved.modelName, port, {
|
|
65296
65390
|
adapter: zenAdapter,
|
|
65297
65391
|
tokenStrategy: "delta-aware",
|
|
65298
65392
|
isInteractive: options.isInteractive
|
|
65299
65393
|
});
|
|
65300
|
-
log(`[Proxy] Created OpenCode Zen (composed): ${resolved.modelName}`);
|
|
65394
|
+
log(`[Proxy] Created OpenCode Zen${isGoProvider ? " Go" : ""} (composed): ${resolved.modelName}`);
|
|
65301
65395
|
}
|
|
65302
65396
|
} else if (resolved.provider.name === "ollamacloud") {
|
|
65303
65397
|
const ocProvider = new OllamaCloudProvider(resolved.provider, apiKey);
|
package/package.json
CHANGED