claudish 4.6.2 → 4.6.4
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 +69 -47
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31026,7 +31026,7 @@ async function fetchLiteLLMModels(baseUrl, apiKey) {
|
|
|
31026
31026
|
} catch {}
|
|
31027
31027
|
}
|
|
31028
31028
|
try {
|
|
31029
|
-
const url2 = `${baseUrl.replace(/\/$/, "")}/
|
|
31029
|
+
const url2 = `${baseUrl.replace(/\/$/, "")}/model_group/info`;
|
|
31030
31030
|
const response = await fetch(url2, {
|
|
31031
31031
|
headers: {
|
|
31032
31032
|
Authorization: `Bearer ${apiKey}`
|
|
@@ -31045,7 +31045,8 @@ async function fetchLiteLLMModels(baseUrl, apiKey) {
|
|
|
31045
31045
|
}
|
|
31046
31046
|
return [];
|
|
31047
31047
|
}
|
|
31048
|
-
const
|
|
31048
|
+
const responseData = await response.json();
|
|
31049
|
+
const rawModels = responseData.data || responseData;
|
|
31049
31050
|
const transformedModels = rawModels.filter((m) => m.mode === "chat" && m.supports_function_calling).map((m) => {
|
|
31050
31051
|
const inputCostPerM = (m.input_cost_per_token || 0) * 1e6;
|
|
31051
31052
|
const outputCostPerM = (m.output_cost_per_token || 0) * 1e6;
|
|
@@ -31619,6 +31620,31 @@ function formatModelChoice(model, showSource = false) {
|
|
|
31619
31620
|
}
|
|
31620
31621
|
return `${model.id} (${model.provider}, ${priceStr}, ${ctxStr}${capsStr})`;
|
|
31621
31622
|
}
|
|
31623
|
+
function parseProviderFilter(term) {
|
|
31624
|
+
if (!term.startsWith("@")) {
|
|
31625
|
+
return { provider: null, searchTerm: term };
|
|
31626
|
+
}
|
|
31627
|
+
const withoutAt = term.slice(1);
|
|
31628
|
+
const spaceIdx = withoutAt.indexOf(" ");
|
|
31629
|
+
let prefix;
|
|
31630
|
+
let rest;
|
|
31631
|
+
if (spaceIdx === -1) {
|
|
31632
|
+
prefix = withoutAt;
|
|
31633
|
+
rest = "";
|
|
31634
|
+
} else {
|
|
31635
|
+
prefix = withoutAt.slice(0, spaceIdx);
|
|
31636
|
+
rest = withoutAt.slice(spaceIdx + 1).trim();
|
|
31637
|
+
}
|
|
31638
|
+
const source = PROVIDER_FILTER_ALIASES[prefix.toLowerCase()];
|
|
31639
|
+
if (source) {
|
|
31640
|
+
return { provider: source, searchTerm: rest };
|
|
31641
|
+
}
|
|
31642
|
+
const partialMatch = Object.entries(PROVIDER_FILTER_ALIASES).find(([alias]) => alias.startsWith(prefix.toLowerCase()));
|
|
31643
|
+
if (partialMatch) {
|
|
31644
|
+
return { provider: partialMatch[1], searchTerm: rest };
|
|
31645
|
+
}
|
|
31646
|
+
return { provider: null, searchTerm: term };
|
|
31647
|
+
}
|
|
31622
31648
|
function fuzzyMatch(text, query) {
|
|
31623
31649
|
const lowerText = text.toLowerCase();
|
|
31624
31650
|
const lowerQuery = query.toLowerCase();
|
|
@@ -31683,7 +31709,12 @@ async function selectModel(options = {}) {
|
|
|
31683
31709
|
}
|
|
31684
31710
|
}
|
|
31685
31711
|
}
|
|
31686
|
-
const
|
|
31712
|
+
const availableProviders = [...new Set(models.map((m) => m.source).filter(Boolean))];
|
|
31713
|
+
const providerHints = availableProviders.map((src) => {
|
|
31714
|
+
const aliases = Object.entries(PROVIDER_FILTER_ALIASES).filter(([, v]) => v === src).map(([k]) => k).sort((a, b) => a.length - b.length);
|
|
31715
|
+
return aliases[0] ? `@${aliases[0]}` : null;
|
|
31716
|
+
}).filter(Boolean).join(" ");
|
|
31717
|
+
const promptMessage = message || (freeOnly ? "Select a FREE model:" : `Select a model (type to search, ${providerHints} to filter):`);
|
|
31687
31718
|
const selected = await dist_default4({
|
|
31688
31719
|
message: promptMessage,
|
|
31689
31720
|
pageSize: 20,
|
|
@@ -31695,9 +31726,21 @@ async function selectModel(options = {}) {
|
|
|
31695
31726
|
description: m.description?.slice(0, 80)
|
|
31696
31727
|
}));
|
|
31697
31728
|
}
|
|
31698
|
-
const
|
|
31729
|
+
const { provider: filterProvider, searchTerm } = parseProviderFilter(term);
|
|
31730
|
+
let pool = models;
|
|
31731
|
+
if (filterProvider) {
|
|
31732
|
+
pool = models.filter((m) => m.source === filterProvider);
|
|
31733
|
+
}
|
|
31734
|
+
if (!searchTerm) {
|
|
31735
|
+
return pool.slice(0, 30).map((m) => ({
|
|
31736
|
+
name: formatModelChoice(m, true),
|
|
31737
|
+
value: m.id,
|
|
31738
|
+
description: m.description?.slice(0, 80)
|
|
31739
|
+
}));
|
|
31740
|
+
}
|
|
31741
|
+
const results = pool.map((m) => ({
|
|
31699
31742
|
model: m,
|
|
31700
|
-
score: Math.max(fuzzyMatch(m.id,
|
|
31743
|
+
score: Math.max(fuzzyMatch(m.id, searchTerm), fuzzyMatch(m.name, searchTerm), fuzzyMatch(m.provider, searchTerm) * 0.5)
|
|
31701
31744
|
})).filter((r) => r.score > 0.1).sort((a, b) => b.score - a.score).slice(0, 30);
|
|
31702
31745
|
return results.map((r) => ({
|
|
31703
31746
|
name: formatModelChoice(r.model, true),
|
|
@@ -31954,7 +31997,7 @@ async function selectProfile(profiles) {
|
|
|
31954
31997
|
async function confirmAction(message) {
|
|
31955
31998
|
return dist_default2({ message, default: false });
|
|
31956
31999
|
}
|
|
31957
|
-
var __filename4, __dirname4, CLAUDISH_CACHE_DIR2, ALL_MODELS_JSON_PATH, RECOMMENDED_MODELS_JSON_PATH, CACHE_MAX_AGE_DAYS2 = 2, FREE_MODELS_CACHE_MAX_AGE_HOURS = 3, PROVIDER_CHOICES, PROVIDER_MODEL_PREFIX, PROVIDER_SOURCE_FILTER;
|
|
32000
|
+
var __filename4, __dirname4, CLAUDISH_CACHE_DIR2, ALL_MODELS_JSON_PATH, RECOMMENDED_MODELS_JSON_PATH, CACHE_MAX_AGE_DAYS2 = 2, FREE_MODELS_CACHE_MAX_AGE_HOURS = 3, PROVIDER_FILTER_ALIASES, PROVIDER_CHOICES, PROVIDER_MODEL_PREFIX, PROVIDER_SOURCE_FILTER;
|
|
31958
32001
|
var init_model_selector = __esm(() => {
|
|
31959
32002
|
init_dist8();
|
|
31960
32003
|
init_model_loader();
|
|
@@ -31963,6 +32006,24 @@ var init_model_selector = __esm(() => {
|
|
|
31963
32006
|
CLAUDISH_CACHE_DIR2 = join7(homedir6(), ".claudish");
|
|
31964
32007
|
ALL_MODELS_JSON_PATH = join7(CLAUDISH_CACHE_DIR2, "all-models.json");
|
|
31965
32008
|
RECOMMENDED_MODELS_JSON_PATH = join7(__dirname4, "../recommended-models.json");
|
|
32009
|
+
PROVIDER_FILTER_ALIASES = {
|
|
32010
|
+
zen: "Zen",
|
|
32011
|
+
openrouter: "OpenRouter",
|
|
32012
|
+
or: "OpenRouter",
|
|
32013
|
+
xai: "xAI",
|
|
32014
|
+
gemini: "Gemini",
|
|
32015
|
+
gem: "Gemini",
|
|
32016
|
+
google: "Gemini",
|
|
32017
|
+
openai: "OpenAI",
|
|
32018
|
+
oai: "OpenAI",
|
|
32019
|
+
glm: "GLM",
|
|
32020
|
+
"glm-coding": "GLM Coding",
|
|
32021
|
+
gc: "GLM Coding",
|
|
32022
|
+
ollamacloud: "OllamaCloud",
|
|
32023
|
+
oc: "OllamaCloud",
|
|
32024
|
+
litellm: "LiteLLM",
|
|
32025
|
+
ll: "LiteLLM"
|
|
32026
|
+
};
|
|
31966
32027
|
PROVIDER_CHOICES = [
|
|
31967
32028
|
{ name: "Skip (keep Claude default)", value: "skip", description: "Use native Claude model for this tier" },
|
|
31968
32029
|
{ name: "OpenRouter", value: "openrouter", description: "580+ models via unified API" },
|
|
@@ -33294,45 +33355,6 @@ function resolveModelProvider(modelId) {
|
|
|
33294
33355
|
description: `${provider.name} API Key`,
|
|
33295
33356
|
url: ""
|
|
33296
33357
|
};
|
|
33297
|
-
if (isApiKeyAvailable(info)) {
|
|
33298
|
-
const providerDisplayName2 = PROVIDER_DISPLAY_NAMES[provider.name] || provider.name.charAt(0).toUpperCase() + provider.name.slice(1);
|
|
33299
|
-
return addCommonFields({
|
|
33300
|
-
category: "direct-api",
|
|
33301
|
-
providerName: providerDisplayName2,
|
|
33302
|
-
modelName: remoteResolved.modelName,
|
|
33303
|
-
fullModelId: modelId,
|
|
33304
|
-
requiredApiKeyEnvVar: info.envVar || null,
|
|
33305
|
-
apiKeyAvailable: isApiKeyAvailable(info),
|
|
33306
|
-
apiKeyDescription: info.envVar ? info.description : null,
|
|
33307
|
-
apiKeyUrl: info.envVar ? info.url : null
|
|
33308
|
-
});
|
|
33309
|
-
}
|
|
33310
|
-
if (isApiKeyAvailable(API_KEY_INFO.openrouter)) {
|
|
33311
|
-
const orInfo = API_KEY_INFO.openrouter;
|
|
33312
|
-
return addCommonFields({
|
|
33313
|
-
category: "openrouter",
|
|
33314
|
-
providerName: "OpenRouter (fallback)",
|
|
33315
|
-
modelName: modelId,
|
|
33316
|
-
fullModelId: modelId,
|
|
33317
|
-
requiredApiKeyEnvVar: orInfo.envVar,
|
|
33318
|
-
apiKeyAvailable: true,
|
|
33319
|
-
apiKeyDescription: orInfo.description,
|
|
33320
|
-
apiKeyUrl: orInfo.url
|
|
33321
|
-
});
|
|
33322
|
-
}
|
|
33323
|
-
if (isApiKeyAvailable(API_KEY_INFO.vertex)) {
|
|
33324
|
-
const vertexInfo = API_KEY_INFO.vertex;
|
|
33325
|
-
return addCommonFields({
|
|
33326
|
-
category: "direct-api",
|
|
33327
|
-
providerName: "Vertex AI (fallback)",
|
|
33328
|
-
modelName: modelId,
|
|
33329
|
-
fullModelId: modelId,
|
|
33330
|
-
requiredApiKeyEnvVar: vertexInfo.envVar,
|
|
33331
|
-
apiKeyAvailable: true,
|
|
33332
|
-
apiKeyDescription: vertexInfo.description,
|
|
33333
|
-
apiKeyUrl: vertexInfo.url
|
|
33334
|
-
});
|
|
33335
|
-
}
|
|
33336
33358
|
const providerDisplayName = PROVIDER_DISPLAY_NAMES[provider.name] || provider.name.charAt(0).toUpperCase() + provider.name.slice(1);
|
|
33337
33359
|
return addCommonFields({
|
|
33338
33360
|
category: "direct-api",
|
|
@@ -33340,7 +33362,7 @@ function resolveModelProvider(modelId) {
|
|
|
33340
33362
|
modelName: remoteResolved.modelName,
|
|
33341
33363
|
fullModelId: modelId,
|
|
33342
33364
|
requiredApiKeyEnvVar: info.envVar || null,
|
|
33343
|
-
apiKeyAvailable:
|
|
33365
|
+
apiKeyAvailable: isApiKeyAvailable(info),
|
|
33344
33366
|
apiKeyDescription: info.envVar ? info.description : null,
|
|
33345
33367
|
apiKeyUrl: info.envVar ? info.url : null
|
|
33346
33368
|
});
|
|
@@ -34834,7 +34856,7 @@ async function fetchGLMCodingModels2() {
|
|
|
34834
34856
|
return [];
|
|
34835
34857
|
}
|
|
34836
34858
|
}
|
|
34837
|
-
var __filename5, __dirname5, VERSION = "4.6.
|
|
34859
|
+
var __filename5, __dirname5, VERSION = "4.6.4", CACHE_MAX_AGE_DAYS3 = 2, MODELS_JSON_PATH, CLAUDISH_CACHE_DIR3, ALL_MODELS_JSON_PATH2;
|
|
34838
34860
|
var init_cli = __esm(() => {
|
|
34839
34861
|
init_config();
|
|
34840
34862
|
init_model_loader();
|