claudish 3.7.1 → 3.7.3

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 (2) hide show
  1. package/dist/index.js +94 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -32160,6 +32160,7 @@ class OpenRouterHandler {
32160
32160
  const total = input + output;
32161
32161
  const limit = this.contextWindowCache.get(this.targetModel) || 200000;
32162
32162
  const leftPct = limit > 0 ? Math.max(0, Math.min(100, Math.round((limit - total) / limit * 100))) : 100;
32163
+ const displayModelName = this.targetModel.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
32163
32164
  const data = {
32164
32165
  input_tokens: input,
32165
32166
  output_tokens: output,
@@ -32167,6 +32168,8 @@ class OpenRouterHandler {
32167
32168
  total_cost: this.sessionTotalCost,
32168
32169
  context_window: limit,
32169
32170
  context_left_percent: leftPct,
32171
+ provider_name: "OpenRouter",
32172
+ model_name: displayModelName,
32170
32173
  updated_at: Date.now()
32171
32174
  };
32172
32175
  const claudishDir = join4(homedir(), ".claudish");
@@ -53115,6 +53118,14 @@ class LocalProviderHandler {
53115
53118
  this.sessionOutputTokens += output;
53116
53119
  const sessionTotal = this.sessionInputTokens + this.sessionOutputTokens;
53117
53120
  const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - sessionTotal) / this.contextWindow * 100))) : 100;
53121
+ const providerNameMap = {
53122
+ ollama: "Ollama",
53123
+ lmstudio: "LM Studio",
53124
+ vllm: "vLLM",
53125
+ mlx: "MLX",
53126
+ custom: "Custom"
53127
+ };
53128
+ const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
53118
53129
  const data = {
53119
53130
  input_tokens: this.sessionInputTokens,
53120
53131
  output_tokens: this.sessionOutputTokens,
@@ -53122,6 +53133,8 @@ class LocalProviderHandler {
53122
53133
  total_cost: 0,
53123
53134
  context_window: this.contextWindow,
53124
53135
  context_left_percent: leftPct,
53136
+ provider_name: providerNameMap[this.provider.name] || "Local",
53137
+ model_name: displayModelName,
53125
53138
  updated_at: Date.now()
53126
53139
  };
53127
53140
  const claudishDir = join5(homedir2(), ".claudish");
@@ -53853,6 +53866,8 @@ class BaseGeminiHandler {
53853
53866
  try {
53854
53867
  const total = input + output;
53855
53868
  const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
53869
+ const pricing = this.getPricing();
53870
+ const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
53856
53871
  const data = {
53857
53872
  input_tokens: input,
53858
53873
  output_tokens: output,
@@ -53860,6 +53875,10 @@ class BaseGeminiHandler {
53860
53875
  total_cost: this.sessionTotalCost,
53861
53876
  context_window: this.contextWindow,
53862
53877
  context_left_percent: leftPct,
53878
+ is_free: pricing.isFree || false,
53879
+ is_estimated: pricing.isEstimate || false,
53880
+ provider_name: this.getProviderName(),
53881
+ model_name: displayModelName,
53863
53882
  updated_at: Date.now()
53864
53883
  };
53865
53884
  const claudishDir = join6(homedir3(), ".claudish");
@@ -54366,6 +54385,9 @@ var init_gemini_handler = __esm(() => {
54366
54385
  "x-goog-api-key": this.apiKey
54367
54386
  };
54368
54387
  }
54388
+ getProviderName() {
54389
+ return "Gemini API";
54390
+ }
54369
54391
  };
54370
54392
  });
54371
54393
 
@@ -54840,12 +54862,18 @@ class GeminiCodeAssistHandler {
54840
54862
  log(`[GeminiCodeAssistHandler] Shutting down handler for ${this.modelName}`);
54841
54863
  }
54842
54864
  getPricing() {
54843
- return getModelPricing("gemini", this.modelName);
54865
+ return {
54866
+ inputCostPer1M: 0,
54867
+ outputCostPer1M: 0,
54868
+ isFree: true
54869
+ };
54844
54870
  }
54845
54871
  writeTokenFile(input, output) {
54846
54872
  try {
54847
54873
  const total = input + output;
54848
54874
  const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
54875
+ const pricing = this.getPricing();
54876
+ const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
54849
54877
  const data = {
54850
54878
  input_tokens: input,
54851
54879
  output_tokens: output,
@@ -54853,6 +54881,10 @@ class GeminiCodeAssistHandler {
54853
54881
  total_cost: this.sessionTotalCost,
54854
54882
  context_window: this.contextWindow,
54855
54883
  context_left_percent: leftPct,
54884
+ is_free: pricing.isFree || false,
54885
+ is_estimated: pricing.isEstimate || false,
54886
+ provider_name: "Gemini Free",
54887
+ model_name: displayModelName,
54856
54888
  updated_at: Date.now()
54857
54889
  };
54858
54890
  const claudishDir = join8(homedir5(), ".claudish");
@@ -55266,7 +55298,6 @@ var init_gemini_codeassist_handler = __esm(() => {
55266
55298
  init_transform();
55267
55299
  init_logger();
55268
55300
  init_openai_compat();
55269
- init_remote_provider_types();
55270
55301
  init_gemini_retry();
55271
55302
  init_gemini_oauth();
55272
55303
  });
@@ -55325,6 +55356,7 @@ class OpenAIHandler {
55325
55356
  try {
55326
55357
  const total = input + output;
55327
55358
  const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
55359
+ const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
55328
55360
  const data = {
55329
55361
  input_tokens: input,
55330
55362
  output_tokens: output,
@@ -55332,6 +55364,8 @@ class OpenAIHandler {
55332
55364
  total_cost: this.sessionTotalCost,
55333
55365
  context_window: this.contextWindow,
55334
55366
  context_left_percent: leftPct,
55367
+ provider_name: "OpenAI",
55368
+ model_name: displayModelName,
55335
55369
  updated_at: Date.now()
55336
55370
  };
55337
55371
  if (isEstimate) {
@@ -55900,6 +55934,17 @@ class AnthropicCompatHandler {
55900
55934
  try {
55901
55935
  const total = input + output;
55902
55936
  const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
55937
+ const providerNameMap = {
55938
+ minimax: "MiniMax",
55939
+ kimi: "Kimi",
55940
+ moonshot: "Kimi",
55941
+ glm: "GLM",
55942
+ zhipu: "GLM"
55943
+ };
55944
+ const providerKey = this.provider.name.toLowerCase();
55945
+ const providerDisplayName = providerNameMap[providerKey] || this.provider.name;
55946
+ const pricing = this.getPricing();
55947
+ const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
55903
55948
  const data = {
55904
55949
  input_tokens: input,
55905
55950
  output_tokens: output,
@@ -55907,6 +55952,10 @@ class AnthropicCompatHandler {
55907
55952
  total_cost: this.sessionTotalCost,
55908
55953
  context_window: this.contextWindow,
55909
55954
  context_left_percent: leftPct,
55955
+ is_free: pricing.isFree || false,
55956
+ is_estimated: pricing.isEstimate || false,
55957
+ provider_name: providerDisplayName,
55958
+ model_name: displayModelName,
55910
55959
  updated_at: Date.now()
55911
55960
  };
55912
55961
  const claudishDir = join10(homedir7(), ".claudish");
@@ -56239,6 +56288,8 @@ class VertexOAuthHandler {
56239
56288
  try {
56240
56289
  const total = input + output;
56241
56290
  const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
56291
+ const pricing = this.getPricing();
56292
+ const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
56242
56293
  const data = {
56243
56294
  input_tokens: input,
56244
56295
  output_tokens: output,
@@ -56246,6 +56297,10 @@ class VertexOAuthHandler {
56246
56297
  total_cost: this.sessionTotalCost,
56247
56298
  context_window: this.contextWindow,
56248
56299
  context_left_percent: leftPct,
56300
+ is_free: pricing.isFree || false,
56301
+ is_estimated: pricing.isEstimate || false,
56302
+ provider_name: "Vertex AI",
56303
+ model_name: displayModelName,
56249
56304
  updated_at: Date.now()
56250
56305
  };
56251
56306
  const claudishDir = join12(homedir9(), ".claudish");
@@ -57689,6 +57744,7 @@ class OllamaCloudHandler {
57689
57744
  this.sessionOutputTokens += output;
57690
57745
  const sessionTotal = this.sessionInputTokens + this.sessionOutputTokens;
57691
57746
  const cost = calculateCost(this.provider.name, this.modelName, this.sessionInputTokens, this.sessionOutputTokens);
57747
+ const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
57692
57748
  const data = {
57693
57749
  input_tokens: this.sessionInputTokens,
57694
57750
  output_tokens: this.sessionOutputTokens,
@@ -57696,6 +57752,8 @@ class OllamaCloudHandler {
57696
57752
  total_cost: cost,
57697
57753
  context_window: 0,
57698
57754
  context_left_percent: 100,
57755
+ provider_name: "OllamaCloud",
57756
+ model_name: displayModelName,
57699
57757
  updated_at: Date.now()
57700
57758
  };
57701
57759
  const claudishDir = join13(homedir10(), ".claudish");
@@ -62958,6 +63016,7 @@ const CYAN = "\\x1b[96m";
62958
63016
  const YELLOW = "\\x1b[93m";
62959
63017
  const GREEN = "\\x1b[92m";
62960
63018
  const MAGENTA = "\\x1b[95m";
63019
+ const BLUE = "\\x1b[94m";
62961
63020
  const DIM = "\\x1b[2m";
62962
63021
  const RESET = "\\x1b[0m";
62963
63022
  const BOLD = "\\x1b[1m";
@@ -62970,23 +63029,48 @@ process.stdin.on('end', () => {
62970
63029
  let dir = path.basename(process.cwd());
62971
63030
  if (dir.length > 15) dir = dir.substring(0, 12) + '...';
62972
63031
 
62973
- let ctx = 100, cost = 0;
62974
- const model = process.env.CLAUDISH_ACTIVE_MODEL_NAME || 'unknown';
63032
+ let ctx = 100, cost = 0, providerName = '', model = 'unknown';
62975
63033
  const isLocal = process.env.CLAUDISH_IS_LOCAL === 'true';
62976
63034
 
63035
+ let isFree = false, isEstimated = false;
62977
63036
  try {
62978
63037
  const tokens = JSON.parse(fs.readFileSync('${escapedTokenPath}', 'utf-8'));
62979
63038
  cost = tokens.total_cost || 0;
62980
63039
  ctx = tokens.context_left_percent || 100;
63040
+ isFree = tokens.is_free || false;
63041
+ isEstimated = tokens.is_estimated || false;
63042
+ providerName = tokens.provider_name || '';
63043
+ // Read model_name from token file, fallback to env var
63044
+ model = tokens.model_name || process.env.CLAUDISH_ACTIVE_MODEL_NAME || 'unknown';
63045
+ // Strip provider prefix if not already stripped in token file
63046
+ model = model.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\\/:]/, '');
62981
63047
  } catch (e) {
63048
+ // Fallback to env var if token file not available
63049
+ const rawModel = process.env.CLAUDISH_ACTIVE_MODEL_NAME || 'unknown';
63050
+ model = rawModel.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\\/:]/, '');
62982
63051
  try {
62983
63052
  const json = JSON.parse(input);
62984
63053
  cost = json.total_cost_usd || 0;
62985
63054
  } catch {}
62986
63055
  }
62987
63056
 
62988
- const costDisplay = isLocal ? 'LOCAL' : ('$' + cost.toFixed(3));
62989
- console.log(\`\${CYAN}\${BOLD}\${dir}\${RESET} \${DIM}•\${RESET} \${YELLOW}\${model}\${RESET} \${DIM}•\${RESET} \${GREEN}\${costDisplay}\${RESET} \${DIM}•\${RESET} \${MAGENTA}\${ctx}%\${RESET}\`);
63057
+ let costDisplay;
63058
+ if (isLocal) {
63059
+ costDisplay = 'LOCAL';
63060
+ } else if (isFree) {
63061
+ costDisplay = 'FREE';
63062
+ } else if (isEstimated) {
63063
+ costDisplay = '~$' + cost.toFixed(3);
63064
+ } else {
63065
+ costDisplay = '$' + cost.toFixed(3);
63066
+ }
63067
+
63068
+ // Build status line with provider name
63069
+ if (providerName) {
63070
+ console.log(\`\${CYAN}\${BOLD}\${dir}\${RESET} \${DIM}•\${RESET} \${BLUE}\${providerName}\${RESET} \${DIM}•\${RESET} \${YELLOW}\${model}\${RESET} \${DIM}•\${RESET} \${GREEN}\${costDisplay}\${RESET} \${DIM}•\${RESET} \${MAGENTA}\${ctx}%\${RESET}\`);
63071
+ } else {
63072
+ console.log(\`\${CYAN}\${BOLD}\${dir}\${RESET} \${DIM}•\${RESET} \${YELLOW}\${model}\${RESET} \${DIM}•\${RESET} \${GREEN}\${costDisplay}\${RESET} \${DIM}•\${RESET} \${MAGENTA}\${ctx}%\${RESET}\`);
63073
+ }
62990
63074
  } catch (e) {
62991
63075
  console.log('claudish');
62992
63076
  }
@@ -62995,7 +63079,7 @@ process.stdin.on('end', () => {
62995
63079
  writeFileSync15(scriptPath, script, "utf-8");
62996
63080
  return scriptPath;
62997
63081
  }
62998
- function createTempSettingsFile(modelDisplay, port) {
63082
+ function createTempSettingsFile(port) {
62999
63083
  const homeDir = process.env.HOME || process.env.USERPROFILE || tmpdir2();
63000
63084
  const claudishDir = join19(homeDir, ".claudish");
63001
63085
  try {
@@ -63013,10 +63097,11 @@ function createTempSettingsFile(modelDisplay, port) {
63013
63097
  const YELLOW3 = "\\033[93m";
63014
63098
  const GREEN3 = "\\033[92m";
63015
63099
  const MAGENTA = "\\033[95m";
63100
+ const BLUE = "\\033[94m";
63016
63101
  const DIM2 = "\\033[2m";
63017
63102
  const RESET3 = "\\033[0m";
63018
63103
  const BOLD3 = "\\033[1m";
63019
- statusCommand = `JSON=$(cat) && DIR=$(basename "$(pwd)") && [ \${#DIR} -gt 15 ] && DIR="\${DIR:0:12}..." || true && CTX=100 && COST="0" && if [ -f "${tokenFilePath}" ]; then TOKENS=$(cat "${tokenFilePath}" 2>/dev/null) && REAL_CTX=$(echo "$TOKENS" | grep -o '"context_left_percent":[0-9]*' | grep -o '[0-9]*') && if [ ! -z "$REAL_CTX" ]; then CTX="$REAL_CTX"; fi && REAL_COST=$(echo "$TOKENS" | grep -o '"total_cost":[0-9.]*' | cut -d: -f2) && if [ ! -z "$REAL_COST" ]; then COST="$REAL_COST"; fi; fi && if [ "$CLAUDISH_IS_LOCAL" = "true" ]; then COST_DISPLAY="LOCAL"; else COST_DISPLAY=$(printf "\\$%.3f" "$COST"); fi && printf "${CYAN3}${BOLD3}%s${RESET3} ${DIM2}•${RESET3} ${YELLOW3}%s${RESET3} ${DIM2}•${RESET3} ${GREEN3}%s${RESET3} ${DIM2}•${RESET3} ${MAGENTA}%s%%${RESET3}\\n" "$DIR" "$CLAUDISH_ACTIVE_MODEL_NAME" "$COST_DISPLAY" "$CTX"`;
63104
+ statusCommand = `JSON=$(cat) && DIR=$(basename "$(pwd)") && [ \${#DIR} -gt 15 ] && DIR="\${DIR:0:12}..." || true && CTX=100 && COST="0" && IS_FREE="false" && IS_EST="false" && PROVIDER="" && MODEL="unknown" && if [ -f "${tokenFilePath}" ]; then TOKENS=$(cat "${tokenFilePath}" 2>/dev/null | tr -d ' \\n') && REAL_CTX=$(echo "$TOKENS" | grep -o '"context_left_percent":[0-9]*' | grep -o '[0-9]*') && if [ ! -z "$REAL_CTX" ]; then CTX="$REAL_CTX"; fi && REAL_COST=$(echo "$TOKENS" | grep -o '"total_cost":[0-9.]*' | cut -d: -f2) && if [ ! -z "$REAL_COST" ]; then COST="$REAL_COST"; fi && IS_FREE=$(echo "$TOKENS" | grep -o '"is_free":[a-z]*' | cut -d: -f2) && IS_EST=$(echo "$TOKENS" | grep -o '"is_estimated":[a-z]*' | cut -d: -f2) && PROVIDER=$(echo "$TOKENS" | grep -o '"provider_name":"[^"]*"' | cut -d: -f2 | tr -d '"') && MODEL=$(echo "$TOKENS" | grep -o '"model_name":"[^"]*"' | cut -d: -f2 | tr -d '"'); fi && if [ -z "$MODEL" ] || [ "$MODEL" = "unknown" ]; then RAW_MODEL="$CLAUDISH_ACTIVE_MODEL_NAME" && MODEL=$(echo "$RAW_MODEL" | sed -E 's/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\\/:]//'); fi && MODEL=$(echo "$MODEL" | sed -E 's/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\\/:]//') && if [ "$CLAUDISH_IS_LOCAL" = "true" ]; then COST_DISPLAY="LOCAL"; elif [ "$IS_FREE" = "true" ]; then COST_DISPLAY="FREE"; elif [ "$IS_EST" = "true" ]; then COST_DISPLAY=$(printf "~\\$%.3f" "$COST"); else COST_DISPLAY=$(printf "\\$%.3f" "$COST"); fi && if [ ! -z "$PROVIDER" ]; then printf "${CYAN3}${BOLD3}%s${RESET3} ${DIM2}•${RESET3} ${BLUE}%s${RESET3} ${DIM2}•${RESET3} ${YELLOW3}%s${RESET3} ${DIM2}•${RESET3} ${GREEN3}%s${RESET3} ${DIM2}•${RESET3} ${MAGENTA}%s%%${RESET3}\\n" "$DIR" "$PROVIDER" "$MODEL" "$COST_DISPLAY" "$CTX"; else printf "${CYAN3}${BOLD3}%s${RESET3} ${DIM2}•${RESET3} ${YELLOW3}%s${RESET3} ${DIM2}•${RESET3} ${GREEN3}%s${RESET3} ${DIM2}•${RESET3} ${MAGENTA}%s%%${RESET3}\\n" "$DIR" "$MODEL" "$COST_DISPLAY" "$CTX"; fi`;
63020
63105
  }
63021
63106
  const settings = {
63022
63107
  statusLine: {
@@ -63032,7 +63117,7 @@ async function runClaudeWithProxy(config3, proxyUrl) {
63032
63117
  const modelId = config3.model || "unknown";
63033
63118
  const portMatch = proxyUrl.match(/:(\d+)/);
63034
63119
  const port = portMatch ? portMatch[1] : "unknown";
63035
- const tempSettingsPath = createTempSettingsFile(modelId, port);
63120
+ const tempSettingsPath = createTempSettingsFile(port);
63036
63121
  const claudeArgs = [];
63037
63122
  claudeArgs.push("--settings", tempSettingsPath);
63038
63123
  if (config3.interactive) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "3.7.1",
3
+ "version": "3.7.3",
4
4
  "description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",