llmist 0.2.0 → 0.2.2

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/cli.cjs CHANGED
@@ -86,17 +86,17 @@ var init_model_shortcuts = __esm({
86
86
  "gpt5-mini": "openai:gpt-5-mini",
87
87
  "gpt5-nano": "openai:gpt-5-nano",
88
88
  // Anthropic aliases
89
- sonnet: "anthropic:claude-3-5-sonnet-latest",
90
- "claude-sonnet": "anthropic:claude-3-5-sonnet-latest",
91
- haiku: "anthropic:claude-3-5-haiku-latest",
92
- "claude-haiku": "anthropic:claude-3-5-haiku-latest",
93
- opus: "anthropic:claude-3-opus-latest",
94
- "claude-opus": "anthropic:claude-3-opus-latest",
89
+ sonnet: "anthropic:claude-sonnet-4-5",
90
+ "claude-sonnet": "anthropic:claude-sonnet-4-5",
91
+ haiku: "anthropic:claude-haiku-4-5",
92
+ "claude-haiku": "anthropic:claude-haiku-4-5",
93
+ opus: "anthropic:claude-opus-4-5",
94
+ "claude-opus": "anthropic:claude-opus-4-5",
95
95
  // Gemini aliases
96
96
  flash: "gemini:gemini-2.0-flash",
97
97
  "gemini-flash": "gemini:gemini-2.0-flash",
98
- "gemini-pro": "gemini:gemini-2.0-pro",
99
- pro: "gemini:gemini-2.0-pro"
98
+ "gemini-pro": "gemini:gemini-2.5-pro",
99
+ pro: "gemini:gemini-2.5-pro"
100
100
  };
101
101
  KNOWN_MODEL_PATTERNS = [
102
102
  /^gpt-?\d/i,
@@ -2070,30 +2070,6 @@ var init_anthropic_models = __esm({
2070
2070
  "src/providers/anthropic-models.ts"() {
2071
2071
  "use strict";
2072
2072
  ANTHROPIC_MODELS = [
2073
- {
2074
- provider: "anthropic",
2075
- modelId: "claude-opus-4-5-20251124",
2076
- displayName: "Claude Opus 4.5",
2077
- contextWindow: 2e5,
2078
- maxOutputTokens: 64e3,
2079
- pricing: {
2080
- input: 5,
2081
- output: 25,
2082
- cachedInput: 0.5
2083
- },
2084
- knowledgeCutoff: "2025-03",
2085
- features: {
2086
- streaming: true,
2087
- functionCalling: true,
2088
- vision: true,
2089
- reasoning: true
2090
- },
2091
- metadata: {
2092
- family: "Claude 4",
2093
- releaseDate: "2025-11-24",
2094
- notes: "Most powerful model. 80.9% SWE-bench Verified, 66.3% OSWorld. Best for coding and computer use."
2095
- }
2096
- },
2097
2073
  {
2098
2074
  provider: "anthropic",
2099
2075
  modelId: "claude-sonnet-4-5-20250929",
@@ -2282,6 +2258,79 @@ var init_anthropic_models = __esm({
2282
2258
  releaseDate: "2024-03-07",
2283
2259
  notes: "Legacy model - upgrade to Haiku 4.5 for better performance"
2284
2260
  }
2261
+ },
2262
+ // Modern aliases (recommended by Anthropic)
2263
+ {
2264
+ provider: "anthropic",
2265
+ modelId: "claude-haiku-4-5",
2266
+ displayName: "Claude Haiku 4.5",
2267
+ contextWindow: 2e5,
2268
+ maxOutputTokens: 64e3,
2269
+ pricing: {
2270
+ input: 1,
2271
+ output: 5,
2272
+ cachedInput: 0.1
2273
+ },
2274
+ knowledgeCutoff: "2025-02",
2275
+ features: {
2276
+ streaming: true,
2277
+ functionCalling: true,
2278
+ vision: true,
2279
+ reasoning: true
2280
+ },
2281
+ metadata: {
2282
+ family: "Claude 4",
2283
+ releaseDate: "2025-10-01",
2284
+ notes: "Alias for claude-haiku-4-5-20251001. Fastest model with near-frontier intelligence."
2285
+ }
2286
+ },
2287
+ {
2288
+ provider: "anthropic",
2289
+ modelId: "claude-sonnet-4-5",
2290
+ displayName: "Claude Sonnet 4.5",
2291
+ contextWindow: 2e5,
2292
+ maxOutputTokens: 64e3,
2293
+ pricing: {
2294
+ input: 3,
2295
+ output: 15,
2296
+ cachedInput: 0.3
2297
+ },
2298
+ knowledgeCutoff: "2025-01",
2299
+ features: {
2300
+ streaming: true,
2301
+ functionCalling: true,
2302
+ vision: true,
2303
+ reasoning: true
2304
+ },
2305
+ metadata: {
2306
+ family: "Claude 4",
2307
+ releaseDate: "2025-09-29",
2308
+ notes: "Alias for claude-sonnet-4-5-20250929. Smartest model for complex agents and coding."
2309
+ }
2310
+ },
2311
+ {
2312
+ provider: "anthropic",
2313
+ modelId: "claude-opus-4-5",
2314
+ displayName: "Claude Opus 4.5",
2315
+ contextWindow: 2e5,
2316
+ maxOutputTokens: 64e3,
2317
+ pricing: {
2318
+ input: 5,
2319
+ output: 25,
2320
+ cachedInput: 0.5
2321
+ },
2322
+ knowledgeCutoff: "2025-03",
2323
+ features: {
2324
+ streaming: true,
2325
+ functionCalling: true,
2326
+ vision: true,
2327
+ reasoning: true
2328
+ },
2329
+ metadata: {
2330
+ family: "Claude 4",
2331
+ releaseDate: "2025-11-24",
2332
+ notes: "Alias for claude-opus-4-5-20251124. Most powerful model for coding and computer use."
2333
+ }
2285
2334
  }
2286
2335
  ];
2287
2336
  }
@@ -4216,7 +4265,8 @@ var CLI_NAME = "llmist";
4216
4265
  var CLI_DESCRIPTION = "Command line utilities for llmist agents and direct LLM access.";
4217
4266
  var COMMANDS = {
4218
4267
  complete: "complete",
4219
- agent: "agent"
4268
+ agent: "agent",
4269
+ models: "models"
4220
4270
  };
4221
4271
  var LOG_LEVELS = ["silly", "trace", "debug", "info", "warn", "error", "fatal"];
4222
4272
  var DEFAULT_MODEL = "openai:gpt-5-nano";
@@ -4234,7 +4284,7 @@ var OPTION_FLAGS = {
4234
4284
  noBuiltins: "--no-builtins"
4235
4285
  };
4236
4286
  var OPTION_DESCRIPTIONS = {
4237
- model: "Model identifier, e.g. openai:gpt-5-nano or anthropic:claude-3-5-sonnet-latest.",
4287
+ model: "Model identifier, e.g. openai:gpt-5-nano or anthropic:claude-sonnet-4-5.",
4238
4288
  systemPrompt: "Optional system prompt prepended to the conversation.",
4239
4289
  temperature: "Sampling temperature between 0 and 2.",
4240
4290
  maxTokens: "Maximum number of output tokens requested from the model.",
@@ -4253,7 +4303,7 @@ var import_commander3 = require("commander");
4253
4303
  // package.json
4254
4304
  var package_default = {
4255
4305
  name: "llmist",
4256
- version: "0.2.0",
4306
+ version: "0.2.1",
4257
4307
  description: "Universal TypeScript LLM client with streaming-first agent framework. Works with any model - no structured outputs or native tool calling required. Implements its own flexible grammar for function calling.",
4258
4308
  type: "module",
4259
4309
  main: "dist/index.cjs",
@@ -5025,8 +5075,7 @@ function renderSummary(metadata) {
5025
5075
  if (parts.length === 0) {
5026
5076
  return null;
5027
5077
  }
5028
- return `${import_chalk.default.dim("\u2500".repeat(40))}
5029
- ${parts.join(import_chalk.default.dim(" \u2502 "))}`;
5078
+ return parts.join(import_chalk.default.dim(" \u2502 "));
5030
5079
  }
5031
5080
  async function executeAction(action, env) {
5032
5081
  try {
@@ -5285,9 +5334,169 @@ function registerCompleteCommand(program, env) {
5285
5334
  );
5286
5335
  }
5287
5336
 
5337
+ // src/cli/models-command.ts
5338
+ var import_chalk3 = __toESM(require("chalk"), 1);
5339
+ init_model_shortcuts();
5340
+ async function handleModelsCommand(options, env) {
5341
+ const client = env.createClient();
5342
+ const models = client.modelRegistry.listModels(options.provider);
5343
+ if (options.format === "json") {
5344
+ renderJSON(models, env.stdout);
5345
+ } else {
5346
+ renderTable(models, options.verbose || false, env.stdout);
5347
+ }
5348
+ }
5349
+ function renderTable(models, verbose, stream2) {
5350
+ const grouped = /* @__PURE__ */ new Map();
5351
+ for (const model of models) {
5352
+ const provider = model.provider;
5353
+ if (!grouped.has(provider)) {
5354
+ grouped.set(provider, []);
5355
+ }
5356
+ grouped.get(provider).push(model);
5357
+ }
5358
+ stream2.write(import_chalk3.default.bold.cyan("\nAvailable Models\n"));
5359
+ stream2.write(import_chalk3.default.cyan("=".repeat(80)) + "\n\n");
5360
+ const providers = Array.from(grouped.keys()).sort();
5361
+ for (const provider of providers) {
5362
+ const providerModels = grouped.get(provider);
5363
+ const providerName = provider.charAt(0).toUpperCase() + provider.slice(1);
5364
+ stream2.write(import_chalk3.default.bold.yellow(`${providerName} Models
5365
+ `));
5366
+ if (verbose) {
5367
+ renderVerboseTable(providerModels, stream2);
5368
+ } else {
5369
+ renderCompactTable(providerModels, stream2);
5370
+ }
5371
+ stream2.write("\n");
5372
+ }
5373
+ stream2.write(import_chalk3.default.bold.magenta("Model Shortcuts\n"));
5374
+ stream2.write(import_chalk3.default.dim("\u2500".repeat(80)) + "\n");
5375
+ const shortcuts = Object.entries(MODEL_ALIASES).sort((a, b) => a[0].localeCompare(b[0]));
5376
+ for (const [shortcut, fullName] of shortcuts) {
5377
+ stream2.write(import_chalk3.default.cyan(` ${shortcut.padEnd(15)}`) + import_chalk3.default.dim(" \u2192 ") + import_chalk3.default.white(fullName) + "\n");
5378
+ }
5379
+ stream2.write("\n");
5380
+ }
5381
+ function renderCompactTable(models, stream2) {
5382
+ const idWidth = 25;
5383
+ const nameWidth = 22;
5384
+ const contextWidth = 13;
5385
+ const inputWidth = 10;
5386
+ const outputWidth = 10;
5387
+ stream2.write(import_chalk3.default.dim("\u2500".repeat(idWidth + nameWidth + contextWidth + inputWidth + outputWidth + 8)) + "\n");
5388
+ stream2.write(
5389
+ import_chalk3.default.bold(
5390
+ "Model ID".padEnd(idWidth) + " " + "Display Name".padEnd(nameWidth) + " " + "Context".padEnd(contextWidth) + " " + "Input".padEnd(inputWidth) + " " + "Output".padEnd(outputWidth)
5391
+ ) + "\n"
5392
+ );
5393
+ stream2.write(import_chalk3.default.dim("\u2500".repeat(idWidth + nameWidth + contextWidth + inputWidth + outputWidth + 8)) + "\n");
5394
+ for (const model of models) {
5395
+ const contextFormatted = formatTokens(model.contextWindow);
5396
+ const inputPrice = `$${model.pricing.input.toFixed(2)}`;
5397
+ const outputPrice = `$${model.pricing.output.toFixed(2)}`;
5398
+ stream2.write(
5399
+ import_chalk3.default.green(model.modelId.padEnd(idWidth)) + " " + import_chalk3.default.white(model.displayName.padEnd(nameWidth)) + " " + import_chalk3.default.yellow(contextFormatted.padEnd(contextWidth)) + " " + import_chalk3.default.cyan(inputPrice.padEnd(inputWidth)) + " " + import_chalk3.default.cyan(outputPrice.padEnd(outputWidth)) + "\n"
5400
+ );
5401
+ }
5402
+ stream2.write(import_chalk3.default.dim("\u2500".repeat(idWidth + nameWidth + contextWidth + inputWidth + outputWidth + 8)) + "\n");
5403
+ stream2.write(import_chalk3.default.dim(` * Prices are per 1M tokens
5404
+ `));
5405
+ }
5406
+ function renderVerboseTable(models, stream2) {
5407
+ for (const model of models) {
5408
+ stream2.write(import_chalk3.default.bold.green(`
5409
+ ${model.modelId}
5410
+ `));
5411
+ stream2.write(import_chalk3.default.dim(" " + "\u2500".repeat(60)) + "\n");
5412
+ stream2.write(` ${import_chalk3.default.dim("Name:")} ${import_chalk3.default.white(model.displayName)}
5413
+ `);
5414
+ stream2.write(` ${import_chalk3.default.dim("Context:")} ${import_chalk3.default.yellow(formatTokens(model.contextWindow))}
5415
+ `);
5416
+ stream2.write(` ${import_chalk3.default.dim("Max Output:")} ${import_chalk3.default.yellow(formatTokens(model.maxOutputTokens))}
5417
+ `);
5418
+ stream2.write(` ${import_chalk3.default.dim("Pricing:")} ${import_chalk3.default.cyan(`$${model.pricing.input.toFixed(2)} input`)} ${import_chalk3.default.dim("/")} ${import_chalk3.default.cyan(`$${model.pricing.output.toFixed(2)} output`)} ${import_chalk3.default.dim("(per 1M tokens)")}
5419
+ `);
5420
+ if (model.pricing.cachedInput !== void 0) {
5421
+ stream2.write(` ${import_chalk3.default.dim("Cached Input:")} ${import_chalk3.default.cyan(`$${model.pricing.cachedInput.toFixed(2)} per 1M tokens`)}
5422
+ `);
5423
+ }
5424
+ if (model.knowledgeCutoff) {
5425
+ stream2.write(` ${import_chalk3.default.dim("Knowledge:")} ${model.knowledgeCutoff}
5426
+ `);
5427
+ }
5428
+ const features = [];
5429
+ if (model.features.streaming) features.push("streaming");
5430
+ if (model.features.functionCalling) features.push("function-calling");
5431
+ if (model.features.vision) features.push("vision");
5432
+ if (model.features.reasoning) features.push("reasoning");
5433
+ if (model.features.structuredOutputs) features.push("structured-outputs");
5434
+ if (model.features.fineTuning) features.push("fine-tuning");
5435
+ if (features.length > 0) {
5436
+ stream2.write(` ${import_chalk3.default.dim("Features:")} ${import_chalk3.default.blue(features.join(", "))}
5437
+ `);
5438
+ }
5439
+ if (model.metadata) {
5440
+ if (model.metadata.family) {
5441
+ stream2.write(` ${import_chalk3.default.dim("Family:")} ${model.metadata.family}
5442
+ `);
5443
+ }
5444
+ if (model.metadata.releaseDate) {
5445
+ stream2.write(` ${import_chalk3.default.dim("Released:")} ${model.metadata.releaseDate}
5446
+ `);
5447
+ }
5448
+ if (model.metadata.notes) {
5449
+ stream2.write(` ${import_chalk3.default.dim("Notes:")} ${import_chalk3.default.italic(model.metadata.notes)}
5450
+ `);
5451
+ }
5452
+ }
5453
+ }
5454
+ stream2.write("\n");
5455
+ }
5456
+ function renderJSON(models, stream2) {
5457
+ const output = {
5458
+ models: models.map((model) => ({
5459
+ provider: model.provider,
5460
+ modelId: model.modelId,
5461
+ displayName: model.displayName,
5462
+ contextWindow: model.contextWindow,
5463
+ maxOutputTokens: model.maxOutputTokens,
5464
+ pricing: {
5465
+ input: model.pricing.input,
5466
+ output: model.pricing.output,
5467
+ cachedInput: model.pricing.cachedInput,
5468
+ currency: "USD",
5469
+ per: "1M tokens"
5470
+ },
5471
+ knowledgeCutoff: model.knowledgeCutoff,
5472
+ features: model.features,
5473
+ metadata: model.metadata
5474
+ })),
5475
+ shortcuts: MODEL_ALIASES
5476
+ };
5477
+ stream2.write(JSON.stringify(output, null, 2) + "\n");
5478
+ }
5479
+ function formatTokens(count) {
5480
+ if (count >= 1e6) {
5481
+ return `${(count / 1e6).toFixed(1)}M tokens`;
5482
+ } else if (count >= 1e3) {
5483
+ return `${(count / 1e3).toFixed(0)}K tokens`;
5484
+ } else {
5485
+ return `${count} tokens`;
5486
+ }
5487
+ }
5488
+ function registerModelsCommand(program, env) {
5489
+ program.command(COMMANDS.models).description("List all available LLM models with pricing and capabilities.").option("--provider <name>", "Filter by provider (openai, anthropic, gemini)").option("--format <format>", "Output format: table or json", "table").option("--verbose", "Show detailed model information", false).action(
5490
+ (options) => executeAction(
5491
+ () => handleModelsCommand(options, env),
5492
+ env
5493
+ )
5494
+ );
5495
+ }
5496
+
5288
5497
  // src/cli/environment.ts
5289
5498
  var import_node_readline = __toESM(require("readline"), 1);
5290
- var import_chalk3 = __toESM(require("chalk"), 1);
5499
+ var import_chalk4 = __toESM(require("chalk"), 1);
5291
5500
  init_client();
5292
5501
  init_logger();
5293
5502
  var LOG_LEVEL_MAP = {
@@ -5333,14 +5542,14 @@ function createPromptFunction(stdin, stdout) {
5333
5542
  output: stdout
5334
5543
  });
5335
5544
  stdout.write("\n");
5336
- stdout.write(`${import_chalk3.default.cyan("\u2500".repeat(60))}
5545
+ stdout.write(`${import_chalk4.default.cyan("\u2500".repeat(60))}
5337
5546
  `);
5338
- stdout.write(import_chalk3.default.cyan.bold("\u{1F916} Agent asks:\n"));
5547
+ stdout.write(import_chalk4.default.cyan.bold("\u{1F916} Agent asks:\n"));
5339
5548
  stdout.write(`${question}
5340
5549
  `);
5341
- stdout.write(`${import_chalk3.default.cyan("\u2500".repeat(60))}
5550
+ stdout.write(`${import_chalk4.default.cyan("\u2500".repeat(60))}
5342
5551
  `);
5343
- rl.question(import_chalk3.default.green.bold("You: "), (answer) => {
5552
+ rl.question(import_chalk4.default.green.bold("You: "), (answer) => {
5344
5553
  rl.close();
5345
5554
  resolve(answer);
5346
5555
  });
@@ -5383,6 +5592,7 @@ function createProgram(env) {
5383
5592
  });
5384
5593
  registerCompleteCommand(program, env);
5385
5594
  registerAgentCommand(program, env);
5595
+ registerModelsCommand(program, env);
5386
5596
  return program;
5387
5597
  }
5388
5598
  async function runCLI(overrides = {}) {