claudish 5.6.0 → 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 +118 -18
- 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"
|
|
@@ -29435,6 +29440,7 @@ var getRemoteProviders = () => [
|
|
|
29435
29440
|
apiPath: "/anthropic/v1/messages",
|
|
29436
29441
|
apiKeyEnvVar: "MINIMAX_API_KEY",
|
|
29437
29442
|
prefixes: ["mmax/", "mm/"],
|
|
29443
|
+
authScheme: "bearer",
|
|
29438
29444
|
capabilities: {
|
|
29439
29445
|
supportsTools: true,
|
|
29440
29446
|
supportsVision: true,
|
|
@@ -29449,6 +29455,7 @@ var getRemoteProviders = () => [
|
|
|
29449
29455
|
apiPath: "/anthropic/v1/messages",
|
|
29450
29456
|
apiKeyEnvVar: "MINIMAX_CODING_API_KEY",
|
|
29451
29457
|
prefixes: ["mmc/"],
|
|
29458
|
+
authScheme: "bearer",
|
|
29452
29459
|
capabilities: {
|
|
29453
29460
|
supportsTools: true,
|
|
29454
29461
|
supportsVision: true,
|
|
@@ -29545,7 +29552,7 @@ var getRemoteProviders = () => [
|
|
|
29545
29552
|
name: "opencode-zen",
|
|
29546
29553
|
baseUrl: process.env.OPENCODE_BASE_URL || "https://opencode.ai/zen",
|
|
29547
29554
|
apiPath: "/v1/chat/completions",
|
|
29548
|
-
apiKeyEnvVar: "",
|
|
29555
|
+
apiKeyEnvVar: "OPENCODE_API_KEY",
|
|
29549
29556
|
prefixes: ["zen/"],
|
|
29550
29557
|
capabilities: {
|
|
29551
29558
|
supportsTools: true,
|
|
@@ -29555,6 +29562,20 @@ var getRemoteProviders = () => [
|
|
|
29555
29562
|
supportsReasoning: false
|
|
29556
29563
|
}
|
|
29557
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
|
+
},
|
|
29558
29579
|
{
|
|
29559
29580
|
name: "vertex",
|
|
29560
29581
|
baseUrl: "",
|
|
@@ -31815,7 +31836,7 @@ async function fetchGLMCodingModels() {
|
|
|
31815
31836
|
return [];
|
|
31816
31837
|
}
|
|
31817
31838
|
}
|
|
31818
|
-
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;
|
|
31819
31840
|
var init_cli = __esm(() => {
|
|
31820
31841
|
init_config();
|
|
31821
31842
|
init_model_loader();
|
|
@@ -34474,22 +34495,89 @@ function toModelInfo(model) {
|
|
|
34474
34495
|
source: "OpenRouter"
|
|
34475
34496
|
};
|
|
34476
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
|
+
}
|
|
34477
34553
|
async function fetchZenFreeModels() {
|
|
34478
34554
|
try {
|
|
34479
|
-
const
|
|
34480
|
-
|
|
34481
|
-
|
|
34482
|
-
|
|
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)
|
|
34483
34565
|
return [];
|
|
34484
|
-
|
|
34485
|
-
const
|
|
34486
|
-
const opencode = data.opencode;
|
|
34566
|
+
const mdevData = await mdevResp.json();
|
|
34567
|
+
const opencode = mdevData.opencode;
|
|
34487
34568
|
if (!opencode?.models)
|
|
34488
34569
|
return [];
|
|
34489
|
-
|
|
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]) => {
|
|
34490
34577
|
const isFree = m.cost?.input === 0 && m.cost?.output === 0;
|
|
34491
34578
|
const supportsTools = m.tool_call === true;
|
|
34492
|
-
|
|
34579
|
+
const isLive = liveIds.size === 0 || liveIds.has(id);
|
|
34580
|
+
return isFree && supportsTools && isLive;
|
|
34493
34581
|
}).map(([id, m]) => {
|
|
34494
34582
|
const inputModalities = m.modalities?.input || [];
|
|
34495
34583
|
const supportsVision = inputModalities.includes("image") || inputModalities.includes("video");
|
|
@@ -34893,7 +34981,8 @@ async function getAllModelsForSearch(forceUpdate = false) {
|
|
|
34893
34981
|
{ name: "GLM", promise: fetchGLMDirectModels() },
|
|
34894
34982
|
{ name: "GLM Coding", promise: fetchGLMCodingModels2() },
|
|
34895
34983
|
{ name: "OllamaCloud", promise: fetchOllamaCloudModels() },
|
|
34896
|
-
{ name: "Zen", promise: fetchZenFreeModels() }
|
|
34984
|
+
{ name: "Zen", promise: fetchZenFreeModels() },
|
|
34985
|
+
{ name: "Zen Go", promise: fetchZenGoModels() }
|
|
34897
34986
|
];
|
|
34898
34987
|
if (litellmBaseUrl && litellmApiKey) {
|
|
34899
34988
|
fetchEntries.push({ name: "LiteLLM", promise: fetchLiteLLMModels(litellmBaseUrl, litellmApiKey, forceUpdate) });
|
|
@@ -64459,6 +64548,9 @@ function getRecoveryHint(status, errorText, providerName) {
|
|
|
64459
64548
|
return "Rate limited. Wait, reduce concurrency, or check plan limits.";
|
|
64460
64549
|
}
|
|
64461
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
|
+
}
|
|
64462
64554
|
return "Check API key / OAuth credentials.";
|
|
64463
64555
|
}
|
|
64464
64556
|
if (status === 404) {
|
|
@@ -64713,6 +64805,8 @@ class OpenAIProvider {
|
|
|
64713
64805
|
static formatDisplayName(name) {
|
|
64714
64806
|
if (name === "opencode-zen")
|
|
64715
64807
|
return "Zen";
|
|
64808
|
+
if (name === "opencode-zen-go")
|
|
64809
|
+
return "Zen Go";
|
|
64716
64810
|
if (name === "glm")
|
|
64717
64811
|
return "GLM";
|
|
64718
64812
|
if (name === "glm-coding")
|
|
@@ -64757,9 +64851,13 @@ class AnthropicCompatProvider {
|
|
|
64757
64851
|
}
|
|
64758
64852
|
async getHeaders() {
|
|
64759
64853
|
const headers = {
|
|
64760
|
-
"x-api-key": this.apiKey,
|
|
64761
64854
|
"anthropic-version": "2023-06-01"
|
|
64762
64855
|
};
|
|
64856
|
+
if (this.provider.authScheme === "bearer") {
|
|
64857
|
+
headers["Authorization"] = `Bearer ${this.apiKey}`;
|
|
64858
|
+
} else {
|
|
64859
|
+
headers["x-api-key"] = this.apiKey;
|
|
64860
|
+
}
|
|
64763
64861
|
if (this.provider.headers) {
|
|
64764
64862
|
Object.assign(headers, this.provider.headers);
|
|
64765
64863
|
}
|
|
@@ -65274,24 +65372,26 @@ async function createProxyServer(port, openrouterApiKey, model, monitorMode = fa
|
|
|
65274
65372
|
isInteractive: options.isInteractive
|
|
65275
65373
|
});
|
|
65276
65374
|
log(`[Proxy] Created ${resolved.provider.name} handler (composed): ${resolved.modelName}`);
|
|
65277
|
-
} 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";
|
|
65278
65378
|
if (resolved.modelName.toLowerCase().includes("minimax")) {
|
|
65279
|
-
const zenAcProvider = new AnthropicCompatProvider(resolved.provider,
|
|
65379
|
+
const zenAcProvider = new AnthropicCompatProvider(resolved.provider, zenApiKey);
|
|
65280
65380
|
const zenAcAdapter = new AnthropicPassthroughAdapter(resolved.modelName, resolved.provider.name);
|
|
65281
65381
|
handler = new ComposedHandler(zenAcProvider, targetModel, resolved.modelName, port, {
|
|
65282
65382
|
adapter: zenAcAdapter,
|
|
65283
65383
|
isInteractive: options.isInteractive
|
|
65284
65384
|
});
|
|
65285
|
-
log(`[Proxy] Created OpenCode Zen (Anthropic composed): ${resolved.modelName}`);
|
|
65385
|
+
log(`[Proxy] Created OpenCode Zen${isGoProvider ? " Go" : ""} (Anthropic composed): ${resolved.modelName}`);
|
|
65286
65386
|
} else {
|
|
65287
|
-
const zenProvider = new OpenAIProvider(resolved.provider, resolved.modelName,
|
|
65387
|
+
const zenProvider = new OpenAIProvider(resolved.provider, resolved.modelName, zenApiKey);
|
|
65288
65388
|
const zenAdapter = new OpenAIAdapter(resolved.modelName, resolved.provider.capabilities);
|
|
65289
65389
|
handler = new ComposedHandler(zenProvider, targetModel, resolved.modelName, port, {
|
|
65290
65390
|
adapter: zenAdapter,
|
|
65291
65391
|
tokenStrategy: "delta-aware",
|
|
65292
65392
|
isInteractive: options.isInteractive
|
|
65293
65393
|
});
|
|
65294
|
-
log(`[Proxy] Created OpenCode Zen (composed): ${resolved.modelName}`);
|
|
65394
|
+
log(`[Proxy] Created OpenCode Zen${isGoProvider ? " Go" : ""} (composed): ${resolved.modelName}`);
|
|
65295
65395
|
}
|
|
65296
65396
|
} else if (resolved.provider.name === "ollamacloud") {
|
|
65297
65397
|
const ocProvider = new OllamaCloudProvider(resolved.provider, apiKey);
|
package/package.json
CHANGED