claudish 6.0.0 → 6.1.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 CHANGED
@@ -33364,11 +33364,80 @@ var init_base_api_format = __esm(() => {
33364
33364
  };
33365
33365
  });
33366
33366
 
33367
+ // src/adapters/model-catalog.ts
33368
+ function lookupModel(modelId) {
33369
+ const lower = modelId.toLowerCase();
33370
+ const unprefixed = lower.includes("/") ? lower.substring(lower.lastIndexOf("/") + 1) : lower;
33371
+ for (const entry of MODEL_CATALOG) {
33372
+ if (unprefixed.includes(entry.pattern) || lower.includes(entry.pattern)) {
33373
+ return entry;
33374
+ }
33375
+ }
33376
+ return;
33377
+ }
33378
+ var MODEL_CATALOG;
33379
+ var init_model_catalog = __esm(() => {
33380
+ MODEL_CATALOG = [
33381
+ { pattern: "grok-4.20", contextWindow: 2000000 },
33382
+ { pattern: "grok-4-20", contextWindow: 2000000 },
33383
+ { pattern: "grok-4.1-fast", contextWindow: 2000000 },
33384
+ { pattern: "grok-4-1-fast", contextWindow: 2000000 },
33385
+ { pattern: "grok-4-fast", contextWindow: 2000000 },
33386
+ { pattern: "grok-code-fast", contextWindow: 256000 },
33387
+ { pattern: "grok-4", contextWindow: 256000 },
33388
+ { pattern: "grok-3", contextWindow: 131072 },
33389
+ { pattern: "grok-2", contextWindow: 131072 },
33390
+ { pattern: "grok", contextWindow: 131072 },
33391
+ { pattern: "glm-5-turbo", contextWindow: 202752 },
33392
+ { pattern: "glm-5", contextWindow: 80000, supportsVision: true },
33393
+ { pattern: "glm-4.7-flash", contextWindow: 202752 },
33394
+ { pattern: "glm-4.7", contextWindow: 202752 },
33395
+ { pattern: "glm-4.6v", contextWindow: 131072, supportsVision: true },
33396
+ { pattern: "glm-4.6", contextWindow: 204800 },
33397
+ { pattern: "glm-4.5v", contextWindow: 65536, supportsVision: true },
33398
+ { pattern: "glm-4.5-flash", contextWindow: 131072 },
33399
+ { pattern: "glm-4.5-air", contextWindow: 131072 },
33400
+ { pattern: "glm-4.5", contextWindow: 131072 },
33401
+ { pattern: "glm-4v-plus", contextWindow: 128000, supportsVision: true },
33402
+ { pattern: "glm-4v", contextWindow: 128000, supportsVision: true },
33403
+ { pattern: "glm-4-long", contextWindow: 1e6 },
33404
+ { pattern: "glm-4-plus", contextWindow: 128000 },
33405
+ { pattern: "glm-4-flash", contextWindow: 128000 },
33406
+ { pattern: "glm-4-32b", contextWindow: 128000 },
33407
+ { pattern: "glm-4", contextWindow: 128000 },
33408
+ { pattern: "glm-3-turbo", contextWindow: 128000 },
33409
+ { pattern: "glm-", contextWindow: 131072, supportsVision: false },
33410
+ { pattern: "minimax-01", contextWindow: 1e6, supportsVision: false },
33411
+ { pattern: "minimax-m1", contextWindow: 1e6, supportsVision: false },
33412
+ {
33413
+ pattern: "minimax",
33414
+ contextWindow: 204800,
33415
+ supportsVision: false,
33416
+ temperatureRange: { min: 0.01, max: 1 }
33417
+ },
33418
+ { pattern: "gpt-5.4", contextWindow: 1050000 },
33419
+ { pattern: "gpt-5", contextWindow: 400000 },
33420
+ { pattern: "o1", contextWindow: 200000 },
33421
+ { pattern: "o3", contextWindow: 200000 },
33422
+ { pattern: "o4", contextWindow: 200000 },
33423
+ { pattern: "gpt-4o", contextWindow: 128000 },
33424
+ { pattern: "gpt-4-turbo", contextWindow: 128000 },
33425
+ { pattern: "gpt-3.5", contextWindow: 16385 },
33426
+ { pattern: "kimi-k2.5", contextWindow: 262144 },
33427
+ { pattern: "kimi-k2-5", contextWindow: 262144 },
33428
+ { pattern: "kimi-k2", contextWindow: 131000 },
33429
+ { pattern: "kimi", contextWindow: 131072 },
33430
+ { pattern: "xiaomi", contextWindow: 200000, toolNameLimit: 64 },
33431
+ { pattern: "mimo", contextWindow: 200000, toolNameLimit: 64 }
33432
+ ];
33433
+ });
33434
+
33367
33435
  // src/adapters/grok-model-dialect.ts
33368
33436
  var GrokModelDialect;
33369
33437
  var init_grok_model_dialect = __esm(() => {
33370
33438
  init_base_api_format();
33371
33439
  init_logger();
33440
+ init_model_catalog();
33372
33441
  GrokModelDialect = class GrokModelDialect extends BaseAPIFormat {
33373
33442
  xmlBuffer = "";
33374
33443
  processTextContent(textContent, accumulatedText) {
@@ -33450,22 +33519,7 @@ var init_grok_model_dialect = __esm(() => {
33450
33519
  return "GrokModelDialect";
33451
33520
  }
33452
33521
  getContextWindow() {
33453
- const model = this.modelId.toLowerCase();
33454
- if (model.includes("grok-4.20") || model.includes("grok-4-20"))
33455
- return 2000000;
33456
- if (model.includes("grok-4.1-fast") || model.includes("grok-4-1-fast"))
33457
- return 2000000;
33458
- if (model.includes("grok-4-fast"))
33459
- return 2000000;
33460
- if (model.includes("grok-code-fast"))
33461
- return 256000;
33462
- if (model.includes("grok-4"))
33463
- return 256000;
33464
- if (model.includes("grok-3"))
33465
- return 131072;
33466
- if (model.includes("grok-2"))
33467
- return 131072;
33468
- return 131072;
33522
+ return lookupModel(this.modelId)?.contextWindow ?? 131072;
33469
33523
  }
33470
33524
  reset() {
33471
33525
  this.xmlBuffer = "";
@@ -34876,6 +34930,7 @@ var OpenAIAPIFormat;
34876
34930
  var init_openai_api_format = __esm(() => {
34877
34931
  init_base_api_format();
34878
34932
  init_logger();
34933
+ init_model_catalog();
34879
34934
  OpenAIAPIFormat = class OpenAIAPIFormat extends BaseAPIFormat {
34880
34935
  constructor(modelId) {
34881
34936
  super(modelId);
@@ -34917,18 +34972,7 @@ var init_openai_api_format = __esm(() => {
34917
34972
  return "OpenAIAPIFormat";
34918
34973
  }
34919
34974
  getContextWindow() {
34920
- const model = this.modelId.toLowerCase();
34921
- if (model.includes("gpt-5.4"))
34922
- return 1050000;
34923
- if (model.includes("gpt-5"))
34924
- return 400000;
34925
- if (model.includes("o1") || model.includes("o3") || model.includes("o4"))
34926
- return 200000;
34927
- if (model.includes("gpt-4o") || model.includes("gpt-4-turbo"))
34928
- return 128000;
34929
- if (model.includes("gpt-3.5"))
34930
- return 16385;
34931
- return 128000;
34975
+ return lookupModel(this.modelId)?.contextWindow ?? 128000;
34932
34976
  }
34933
34977
  buildPayload(claudeRequest, messages, tools) {
34934
34978
  return this.buildChatCompletionsPayload(claudeRequest, messages, tools);
@@ -35041,6 +35085,7 @@ var MiniMaxModelDialect;
35041
35085
  var init_minimax_model_dialect = __esm(() => {
35042
35086
  init_base_api_format();
35043
35087
  init_logger();
35088
+ init_model_catalog();
35044
35089
  MiniMaxModelDialect = class MiniMaxModelDialect extends BaseAPIFormat {
35045
35090
  processTextContent(textContent, accumulatedText) {
35046
35091
  return {
@@ -35050,13 +35095,25 @@ var init_minimax_model_dialect = __esm(() => {
35050
35095
  };
35051
35096
  }
35052
35097
  prepareRequest(request, originalRequest) {
35053
- if (originalRequest.thinking) {
35054
- request.reasoning_split = true;
35055
- log(`[MiniMaxModelDialect] Enabled reasoning_split: true`);
35056
- delete request.thinking;
35098
+ const entry = lookupModel(this.modelId);
35099
+ const tempRange = entry?.temperatureRange;
35100
+ if (request.temperature !== undefined && tempRange) {
35101
+ if (request.temperature < tempRange.min) {
35102
+ log(`[MiniMaxModelDialect] Clamping temperature ${request.temperature} \u2192 ${tempRange.min} (MiniMax requires >= ${tempRange.min})`);
35103
+ request.temperature = tempRange.min;
35104
+ } else if (request.temperature > tempRange.max) {
35105
+ log(`[MiniMaxModelDialect] Clamping temperature ${request.temperature} \u2192 ${tempRange.max} (MiniMax requires <= ${tempRange.max})`);
35106
+ request.temperature = tempRange.max;
35107
+ }
35057
35108
  }
35058
35109
  return request;
35059
35110
  }
35111
+ getContextWindow() {
35112
+ return lookupModel(this.modelId)?.contextWindow ?? 204800;
35113
+ }
35114
+ supportsVision() {
35115
+ return lookupModel(this.modelId)?.supportsVision ?? false;
35116
+ }
35060
35117
  shouldHandle(modelId) {
35061
35118
  return matchesModelFamily(modelId, "minimax");
35062
35119
  }
@@ -35096,30 +35153,11 @@ var init_deepseek_model_dialect = __esm(() => {
35096
35153
  });
35097
35154
 
35098
35155
  // src/adapters/glm-model-dialect.ts
35099
- var GLM_CONTEXT_WINDOWS, GLM_VISION_MODELS, GLMModelDialect;
35156
+ var GLMModelDialect;
35100
35157
  var init_glm_model_dialect = __esm(() => {
35101
35158
  init_base_api_format();
35102
35159
  init_logger();
35103
- GLM_CONTEXT_WINDOWS = [
35104
- ["glm-5-turbo", 202752],
35105
- ["glm-5", 80000],
35106
- ["glm-4.7-flash", 202752],
35107
- ["glm-4.7", 202752],
35108
- ["glm-4.6v", 131072],
35109
- ["glm-4.6", 204800],
35110
- ["glm-4.5v", 65536],
35111
- ["glm-4.5-flash", 131072],
35112
- ["glm-4.5-air", 131072],
35113
- ["glm-4.5", 131072],
35114
- ["glm-4-long", 1e6],
35115
- ["glm-4-plus", 128000],
35116
- ["glm-4-flash", 128000],
35117
- ["glm-4-32b", 128000],
35118
- ["glm-4", 128000],
35119
- ["glm-3-turbo", 128000],
35120
- ["glm-", 131072]
35121
- ];
35122
- GLM_VISION_MODELS = ["glm-4v", "glm-4v-plus", "glm-4.5v", "glm-4.6v", "glm-5"];
35160
+ init_model_catalog();
35123
35161
  GLMModelDialect = class GLMModelDialect extends BaseAPIFormat {
35124
35162
  processTextContent(textContent, accumulatedText) {
35125
35163
  return {
@@ -35142,16 +35180,10 @@ var init_glm_model_dialect = __esm(() => {
35142
35180
  return "GLMModelDialect";
35143
35181
  }
35144
35182
  getContextWindow() {
35145
- const lower = this.modelId.toLowerCase();
35146
- for (const [pattern, size] of GLM_CONTEXT_WINDOWS) {
35147
- if (lower.includes(pattern))
35148
- return size;
35149
- }
35150
- return 128000;
35183
+ return lookupModel(this.modelId)?.contextWindow ?? 128000;
35151
35184
  }
35152
35185
  supportsVision() {
35153
- const lower = this.modelId.toLowerCase();
35154
- return GLM_VISION_MODELS.some((m) => lower.includes(m));
35186
+ return lookupModel(this.modelId)?.supportsVision ?? false;
35155
35187
  }
35156
35188
  };
35157
35189
  });
@@ -35161,6 +35193,7 @@ var XiaomiModelDialect;
35161
35193
  var init_xiaomi_model_dialect = __esm(() => {
35162
35194
  init_base_api_format();
35163
35195
  init_logger();
35196
+ init_model_catalog();
35164
35197
  XiaomiModelDialect = class XiaomiModelDialect extends BaseAPIFormat {
35165
35198
  processTextContent(textContent, accumulatedText) {
35166
35199
  return {
@@ -35170,7 +35203,7 @@ var init_xiaomi_model_dialect = __esm(() => {
35170
35203
  };
35171
35204
  }
35172
35205
  getToolNameLimit() {
35173
- return 64;
35206
+ return lookupModel(this.modelId)?.toolNameLimit ?? null;
35174
35207
  }
35175
35208
  prepareRequest(request, originalRequest) {
35176
35209
  if (originalRequest.thinking) {
@@ -35404,7 +35437,7 @@ async function parseArgs(args) {
35404
35437
  config3.stdin = true;
35405
35438
  } else if (arg === "--free") {
35406
35439
  config3.freeOnly = true;
35407
- } else if (arg === "--profile" || arg === "-p") {
35440
+ } else if (arg === "--profile") {
35408
35441
  const profileArg = args[++i];
35409
35442
  if (!profileArg) {
35410
35443
  console.error("--profile requires a profile name");
@@ -36891,7 +36924,7 @@ async function fetchGLMCodingModels() {
36891
36924
  return [];
36892
36925
  }
36893
36926
  }
36894
- var __filename4, __dirname4, VERSION = "6.0.0", CACHE_MAX_AGE_DAYS2 = 2, CLAUDISH_CACHE_DIR2, BUNDLED_MODELS_PATH, CACHED_MODELS_PATH, ALL_MODELS_JSON_PATH;
36927
+ var __filename4, __dirname4, VERSION = "6.1.0", CACHE_MAX_AGE_DAYS2 = 2, CLAUDISH_CACHE_DIR2, BUNDLED_MODELS_PATH, CACHED_MODELS_PATH, ALL_MODELS_JSON_PATH;
36895
36928
  var init_cli = __esm(() => {
36896
36929
  init_config();
36897
36930
  init_model_loader();
@@ -104458,6 +104491,7 @@ function createAnthropicPassthroughStream(c, response, opts) {
104458
104491
  outputTokens = data.message.usage.output_tokens || outputTokens;
104459
104492
  }
104460
104493
  if (data.usage) {
104494
+ inputTokens = data.usage.input_tokens || inputTokens;
104461
104495
  outputTokens = data.usage.output_tokens || outputTokens;
104462
104496
  }
104463
104497
  if (data.type === "content_block_delta" && data.delta?.type === "text_delta") {
@@ -105094,7 +105128,7 @@ class ComposedHandler {
105094
105128
  if (Array.isArray(msg.content)) {
105095
105129
  for (let partIdx = 0;partIdx < msg.content.length; partIdx++) {
105096
105130
  const part = msg.content[partIdx];
105097
- if (part.type === "image_url") {
105131
+ if (part.type === "image_url" || part.type === "image" || part.type === "document") {
105098
105132
  imageBlocks.push({ msgIdx, partIdx, block: part });
105099
105133
  }
105100
105134
  }
@@ -105102,22 +105136,36 @@ class ComposedHandler {
105102
105136
  }
105103
105137
  if (imageBlocks.length > 0) {
105104
105138
  log(`[ComposedHandler] Non-vision model received ${imageBlocks.length} image(s), calling vision proxy`);
105105
- const auth = extractAuthHeaders(c);
105106
- const descriptions = await describeImages(imageBlocks.map((b2) => b2.block), auth);
105107
- if (descriptions !== null) {
105108
- for (let i = 0;i < imageBlocks.length; i++) {
105109
- const { msgIdx, partIdx } = imageBlocks[i];
105139
+ const openAIImageBlocks = imageBlocks.filter((b2) => b2.block.type === "image_url");
105140
+ let descriptions = null;
105141
+ if (openAIImageBlocks.length > 0) {
105142
+ const auth = extractAuthHeaders(c);
105143
+ descriptions = await describeImages(openAIImageBlocks.map((b2) => b2.block), auth);
105144
+ }
105145
+ if (descriptions !== null && openAIImageBlocks.length > 0) {
105146
+ for (let i = 0;i < openAIImageBlocks.length; i++) {
105147
+ const { msgIdx, partIdx } = openAIImageBlocks[i];
105110
105148
  messages[msgIdx].content[partIdx] = {
105111
105149
  type: "text",
105112
105150
  text: `[Image Description: ${descriptions[i]}]`
105113
105151
  };
105114
105152
  }
105115
105153
  log(`[ComposedHandler] Vision proxy described ${descriptions.length} image(s)`);
105154
+ for (const msg of messages) {
105155
+ if (Array.isArray(msg.content)) {
105156
+ msg.content = msg.content.filter((part) => part.type !== "image" && part.type !== "document");
105157
+ if (msg.content.length === 1 && msg.content[0].type === "text") {
105158
+ msg.content = msg.content[0].text;
105159
+ } else if (msg.content.length === 0) {
105160
+ msg.content = "";
105161
+ }
105162
+ }
105163
+ }
105116
105164
  } else {
105117
- log(`[ComposedHandler] Vision proxy failed, stripping images`);
105165
+ log(`[ComposedHandler] Stripping image/document blocks (vision not supported)`);
105118
105166
  for (const msg of messages) {
105119
105167
  if (Array.isArray(msg.content)) {
105120
- msg.content = msg.content.filter((part) => part.type !== "image_url");
105168
+ msg.content = msg.content.filter((part) => part.type !== "image_url" && part.type !== "image" && part.type !== "document");
105121
105169
  if (msg.content.length === 1 && msg.content[0].type === "text") {
105122
105170
  msg.content = msg.content[0].text;
105123
105171
  } else if (msg.content.length === 0) {
@@ -106168,6 +106216,7 @@ var init_anthropic_compat = __esm(() => {
106168
106216
  var AnthropicAPIFormat;
106169
106217
  var init_anthropic_api_format = __esm(() => {
106170
106218
  init_base_api_format();
106219
+ init_model_catalog();
106171
106220
  AnthropicAPIFormat = class AnthropicAPIFormat extends BaseAPIFormat {
106172
106221
  providerName;
106173
106222
  constructor(modelId, providerName) {
@@ -106244,23 +106293,13 @@ var init_anthropic_api_format = __esm(() => {
106244
106293
  return "anthropic-sse";
106245
106294
  }
106246
106295
  getContextWindow() {
106247
- const model = this.modelId.toLowerCase();
106248
- if (model.includes("kimi-k2.5") || model.includes("kimi-k2-5"))
106249
- return 262144;
106250
- if (model.includes("kimi-k2"))
106251
- return 131000;
106252
- if (this.providerName === "kimi" || this.providerName === "kimi-coding" || model.includes("kimi")) {
106296
+ const catalogEntry = lookupModel(this.modelId);
106297
+ if (catalogEntry)
106298
+ return catalogEntry.contextWindow;
106299
+ if (this.providerName === "kimi" || this.providerName === "kimi-coding")
106253
106300
  return 131072;
106254
- }
106255
- if (model.includes("minimax-01") || model.includes("minimax-m1"))
106256
- return 1e6;
106257
- if (model.includes("minimax-m2.7"))
106301
+ if (this.providerName === "minimax" || this.providerName === "minimax-coding")
106258
106302
  return 204800;
106259
- if (model.includes("minimax-m2"))
106260
- return 196608;
106261
- if (this.providerName === "minimax" || this.providerName === "minimax-coding") {
106262
- return 196608;
106263
- }
106264
106303
  return 128000;
106265
106304
  }
106266
106305
  supportsVision() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
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",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "1.2.0",
3
- "lastUpdated": "2026-03-22",
3
+ "lastUpdated": "2026-03-23",
4
4
  "source": "https://openrouter.ai/models?categories=programming&fmt=cards&order=top-weekly",
5
5
  "models": [
6
6
  {