@austinthesing/magic-shell 0.2.22 → 0.2.24

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 (4) hide show
  1. package/dist/cli.js +109 -368
  2. package/dist/index.js +110 -408
  3. package/dist/tui.js +109 -368
  4. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2117,20 +2117,13 @@ import { cwd as getCwd } from "process";
2117
2117
  // src/lib/models.ts
2118
2118
  var OPENROUTER_MODELS = [
2119
2119
  {
2120
- id: "xiaomi/mimo-v2.5",
2121
- name: "MiMo V2.5",
2122
- description: "Xiaomi's latest long-context MiMo model",
2120
+ id: "deepseek/deepseek-v4-flash:free",
2121
+ name: "DeepSeek V4 Flash (Free)",
2122
+ description: "DeepSeek's fast open-source model on OpenRouter's free tier (rate-limited)",
2123
2123
  category: "fast",
2124
2124
  provider: "openrouter",
2125
- contextLength: 1048576
2126
- },
2127
- {
2128
- id: "xiaomi/mimo-v2.5-pro",
2129
- name: "MiMo V2.5 Pro",
2130
- description: "Xiaomi's latest pro MiMo model for agentic coding",
2131
- category: "smart",
2132
- provider: "openrouter",
2133
- contextLength: 1048576
2125
+ contextLength: 1048576,
2126
+ cost: "free"
2134
2127
  },
2135
2128
  {
2136
2129
  id: "deepseek/deepseek-v4-flash",
@@ -2138,15 +2131,8 @@ var OPENROUTER_MODELS = [
2138
2131
  description: "DeepSeek's latest fast open-source model",
2139
2132
  category: "fast",
2140
2133
  provider: "openrouter",
2141
- contextLength: 1048576
2142
- },
2143
- {
2144
- id: "minimax/minimax-m3",
2145
- name: "MiniMax M3",
2146
- description: "MiniMax's latest open-weight multimodal model for agentic coding",
2147
- category: "fast",
2148
- provider: "openrouter",
2149
- contextLength: 1048576
2134
+ contextLength: 1048576,
2135
+ cost: "lower-cost"
2150
2136
  },
2151
2137
  {
2152
2138
  id: "z-ai/glm-5-turbo",
@@ -2154,39 +2140,8 @@ var OPENROUTER_MODELS = [
2154
2140
  description: "Z.ai's latest fast GLM model",
2155
2141
  category: "fast",
2156
2142
  provider: "openrouter",
2157
- contextLength: 202752
2158
- },
2159
- {
2160
- id: "openai/gpt-latest",
2161
- name: "OpenAI GPT Latest",
2162
- description: "OpenRouter alias that redirects to the latest OpenAI GPT model",
2163
- category: "smart",
2164
- provider: "openrouter",
2165
- contextLength: 1050000
2166
- },
2167
- {
2168
- id: "openai/gpt-5.5",
2169
- name: "GPT 5.5",
2170
- description: "OpenAI's latest flagship GPT model",
2171
- category: "smart",
2172
- provider: "openrouter",
2173
- contextLength: 1050000
2174
- },
2175
- {
2176
- id: "anthropic/claude-sonnet-latest",
2177
- name: "Claude Sonnet Latest",
2178
- description: "OpenRouter alias that redirects to the latest Claude Sonnet model",
2179
- category: "smart",
2180
- provider: "openrouter",
2181
- contextLength: 1e6
2182
- },
2183
- {
2184
- id: "anthropic/claude-sonnet-4.6",
2185
- name: "Claude Sonnet 4.6",
2186
- description: "Anthropic's latest Sonnet model",
2187
- category: "smart",
2188
- provider: "openrouter",
2189
- contextLength: 1e6
2143
+ contextLength: 202752,
2144
+ cost: "lower-cost"
2190
2145
  },
2191
2146
  {
2192
2147
  id: "moonshotai/kimi-k2.7-code",
@@ -2194,23 +2149,8 @@ var OPENROUTER_MODELS = [
2194
2149
  description: "Moonshot's latest open-weight coding model",
2195
2150
  category: "smart",
2196
2151
  provider: "openrouter",
2197
- contextLength: 262144
2198
- },
2199
- {
2200
- id: "moonshotai/kimi-k2.6",
2201
- name: "Kimi K2.6",
2202
- description: "Moonshot's latest Kimi model for coding agents",
2203
- category: "smart",
2204
- provider: "openrouter",
2205
- contextLength: 262142
2206
- },
2207
- {
2208
- id: "z-ai/glm-5.2",
2209
- name: "GLM 5.2",
2210
- description: "Z.ai's latest open-weight long-context GLM model",
2211
- category: "smart",
2212
- provider: "openrouter",
2213
- contextLength: 1048576
2152
+ contextLength: 262144,
2153
+ cost: "lower-cost"
2214
2154
  },
2215
2155
  {
2216
2156
  id: "deepseek/deepseek-v4-pro",
@@ -2218,39 +2158,26 @@ var OPENROUTER_MODELS = [
2218
2158
  description: "DeepSeek's latest high-context open-source model",
2219
2159
  category: "smart",
2220
2160
  provider: "openrouter",
2221
- contextLength: 1048576
2222
- },
2223
- {
2224
- id: "z-ai/glm-5.1",
2225
- name: "GLM 5.1",
2226
- description: "Z.ai's latest GLM model",
2227
- category: "smart",
2228
- provider: "openrouter",
2229
- contextLength: 202752
2161
+ contextLength: 1048576,
2162
+ cost: "lower-cost"
2230
2163
  },
2231
2164
  {
2232
- id: "qwen/qwen3.7-plus",
2233
- name: "Qwen3.7 Plus",
2234
- description: "Qwen's latest long-context open-weight plus model",
2165
+ id: "anthropic/claude-sonnet-4.6",
2166
+ name: "Claude Sonnet 4.6",
2167
+ description: "Anthropic's latest Sonnet model",
2235
2168
  category: "smart",
2236
2169
  provider: "openrouter",
2237
- contextLength: 1e6
2170
+ contextLength: 1e6,
2171
+ cost: "premium"
2238
2172
  },
2239
2173
  {
2240
- id: "minimax/minimax-m2.7",
2241
- name: "MiniMax M2.7",
2242
- description: "MiniMax's latest model",
2174
+ id: "openai/gpt-5.5",
2175
+ name: "GPT 5.5",
2176
+ description: "OpenAI's latest flagship GPT model",
2243
2177
  category: "smart",
2244
2178
  provider: "openrouter",
2245
- contextLength: 196608
2246
- },
2247
- {
2248
- id: "anthropic/claude-opus-latest",
2249
- name: "Claude Opus Latest",
2250
- description: "OpenRouter alias that redirects to the latest Claude Opus model",
2251
- category: "reasoning",
2252
- provider: "openrouter",
2253
- contextLength: 1e6
2179
+ contextLength: 1050000,
2180
+ cost: "premium"
2254
2181
  },
2255
2182
  {
2256
2183
  id: "anthropic/claude-opus-4.8",
@@ -2258,41 +2185,19 @@ var OPENROUTER_MODELS = [
2258
2185
  description: "Anthropic's latest Opus model",
2259
2186
  category: "reasoning",
2260
2187
  provider: "openrouter",
2261
- contextLength: 1e6
2262
- },
2263
- {
2264
- id: "openai/gpt-5.5-pro",
2265
- name: "GPT 5.5 Pro",
2266
- description: "OpenAI's latest high-capability reasoning model",
2267
- category: "reasoning",
2268
- provider: "openrouter",
2269
- contextLength: 1050000
2270
- },
2271
- {
2272
- id: "qwen/qwen3.7-max",
2273
- name: "Qwen3.7 Max",
2274
- description: "Qwen's latest high-capability open-weight model",
2275
- category: "reasoning",
2276
- provider: "openrouter",
2277
- contextLength: 1e6
2188
+ contextLength: 1e6,
2189
+ cost: "premium"
2278
2190
  }
2279
2191
  ];
2280
2192
  var VERCEL_AI_GATEWAY_MODELS = [
2281
- {
2282
- id: "openai/gpt-latest",
2283
- name: "OpenAI GPT Latest",
2284
- description: "Vercel AI Gateway alias that redirects to the latest OpenAI GPT model",
2285
- category: "smart",
2286
- provider: "vercel-ai-gateway",
2287
- contextLength: 1050000
2288
- },
2289
2193
  {
2290
2194
  id: "openai/gpt-5.5",
2291
2195
  name: "GPT 5.5",
2292
2196
  description: "OpenAI's latest flagship GPT model",
2293
2197
  category: "smart",
2294
2198
  provider: "vercel-ai-gateway",
2295
- contextLength: 1050000
2199
+ contextLength: 1050000,
2200
+ cost: "premium"
2296
2201
  },
2297
2202
  {
2298
2203
  id: "anthropic/claude-sonnet-4.6",
@@ -2300,7 +2205,8 @@ var VERCEL_AI_GATEWAY_MODELS = [
2300
2205
  description: "Anthropic's latest Sonnet model",
2301
2206
  category: "smart",
2302
2207
  provider: "vercel-ai-gateway",
2303
- contextLength: 1e6
2208
+ contextLength: 1e6,
2209
+ cost: "premium"
2304
2210
  },
2305
2211
  {
2306
2212
  id: "anthropic/claude-opus-4.8",
@@ -2308,25 +2214,28 @@ var VERCEL_AI_GATEWAY_MODELS = [
2308
2214
  description: "Anthropic's latest Opus model",
2309
2215
  category: "reasoning",
2310
2216
  provider: "vercel-ai-gateway",
2311
- contextLength: 1e6
2312
- },
2313
- {
2314
- id: "openai/gpt-5.5-pro",
2315
- name: "GPT 5.5 Pro",
2316
- description: "OpenAI's latest high-capability reasoning model",
2317
- category: "reasoning",
2318
- provider: "vercel-ai-gateway",
2319
- contextLength: 1050000
2217
+ contextLength: 1e6,
2218
+ cost: "premium"
2320
2219
  }
2321
2220
  ];
2322
2221
  var CLOUDFLARE_AI_GATEWAY_MODELS = [
2222
+ {
2223
+ id: "workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast",
2224
+ name: "Workers AI Llama 3.3 70B Fast",
2225
+ description: "Cloudflare Workers AI fast Llama model routed through AI Gateway",
2226
+ category: "smart",
2227
+ provider: "cloudflare-ai-gateway",
2228
+ contextLength: 24000,
2229
+ cost: "lower-cost"
2230
+ },
2323
2231
  {
2324
2232
  id: "openai/gpt-5.5",
2325
2233
  name: "GPT 5.5",
2326
2234
  description: "OpenAI's latest flagship GPT model through Cloudflare AI Gateway",
2327
2235
  category: "smart",
2328
2236
  provider: "cloudflare-ai-gateway",
2329
- contextLength: 1050000
2237
+ contextLength: 1050000,
2238
+ cost: "premium"
2330
2239
  },
2331
2240
  {
2332
2241
  id: "anthropic/claude-sonnet-4-6",
@@ -2334,7 +2243,8 @@ var CLOUDFLARE_AI_GATEWAY_MODELS = [
2334
2243
  description: "Anthropic's latest Sonnet model through Cloudflare AI Gateway",
2335
2244
  category: "smart",
2336
2245
  provider: "cloudflare-ai-gateway",
2337
- contextLength: 1e6
2246
+ contextLength: 1e6,
2247
+ cost: "premium"
2338
2248
  },
2339
2249
  {
2340
2250
  id: "anthropic/claude-opus-4-8",
@@ -2342,33 +2252,28 @@ var CLOUDFLARE_AI_GATEWAY_MODELS = [
2342
2252
  description: "Anthropic's latest Opus model through Cloudflare AI Gateway",
2343
2253
  category: "reasoning",
2344
2254
  provider: "cloudflare-ai-gateway",
2345
- contextLength: 1e6
2346
- },
2347
- {
2348
- id: "workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast",
2349
- name: "Workers AI Llama 3.3 70B Fast",
2350
- description: "Cloudflare Workers AI fast Llama model routed through AI Gateway",
2351
- category: "smart",
2352
- provider: "cloudflare-ai-gateway",
2353
- contextLength: 24000
2255
+ contextLength: 1e6,
2256
+ cost: "premium"
2354
2257
  }
2355
2258
  ];
2356
2259
  var WORKERS_AI_MODELS = [
2357
- {
2358
- id: "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
2359
- name: "Llama 3.3 70B Fast",
2360
- description: "Cloudflare Workers AI fast Llama instruct model",
2361
- category: "smart",
2362
- provider: "workers-ai",
2363
- contextLength: 24000
2364
- },
2365
2260
  {
2366
2261
  id: "@cf/meta/llama-3.1-8b-instruct",
2367
2262
  name: "Llama 3.1 8B Instruct",
2368
2263
  description: "Cloudflare Workers AI lightweight Llama instruct model",
2369
2264
  category: "fast",
2370
2265
  provider: "workers-ai",
2371
- contextLength: 8000
2266
+ contextLength: 8000,
2267
+ cost: "lower-cost"
2268
+ },
2269
+ {
2270
+ id: "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
2271
+ name: "Llama 3.3 70B Fast",
2272
+ description: "Cloudflare Workers AI fast Llama instruct model",
2273
+ category: "smart",
2274
+ provider: "workers-ai",
2275
+ contextLength: 24000,
2276
+ cost: "lower-cost"
2372
2277
  },
2373
2278
  {
2374
2279
  id: "@cf/openai/gpt-oss-120b",
@@ -2376,7 +2281,8 @@ var WORKERS_AI_MODELS = [
2376
2281
  description: "OpenAI open-weight model hosted by Cloudflare Workers AI",
2377
2282
  category: "reasoning",
2378
2283
  provider: "workers-ai",
2379
- contextLength: 32000
2284
+ contextLength: 32000,
2285
+ cost: "lower-cost"
2380
2286
  }
2381
2287
  ];
2382
2288
  var OPENCODE_ZEN_MODELS = [
@@ -2388,57 +2294,17 @@ var OPENCODE_ZEN_MODELS = [
2388
2294
  provider: "opencode-zen",
2389
2295
  zenApiType: "openai-compatible",
2390
2296
  contextLength: 1048576,
2391
- free: true
2392
- },
2393
- {
2394
- id: "mimo-v2.5-free",
2395
- name: "MiMo V2.5 Free",
2396
- description: "Xiaomi's free long-context MiMo model (limited time)",
2397
- category: "fast",
2398
- provider: "opencode-zen",
2399
- zenApiType: "openai-compatible",
2400
- contextLength: 1048576,
2401
- free: true
2402
- },
2403
- {
2404
- id: "north-mini-code-free",
2405
- name: "North Mini Code Free",
2406
- description: "North's free coding model (limited time)",
2407
- category: "fast",
2408
- provider: "opencode-zen",
2409
- zenApiType: "openai-compatible",
2410
- contextLength: 200000,
2411
- free: true
2412
- },
2413
- {
2414
- id: "nemotron-3-ultra-free",
2415
- name: "Nemotron 3 Ultra Free",
2416
- description: "NVIDIA Nemotron free trial model (limited time)",
2417
- category: "smart",
2418
- provider: "opencode-zen",
2419
- zenApiType: "openai-compatible",
2420
- contextLength: 131072,
2421
- free: true
2422
- },
2423
- {
2424
- id: "big-pickle",
2425
- name: "Big Pickle",
2426
- description: "OpenCode stealth model (free, limited time)",
2427
- category: "smart",
2428
- provider: "opencode-zen",
2429
- zenApiType: "openai-compatible",
2430
- contextLength: 131072,
2431
- free: true
2297
+ cost: "free"
2432
2298
  },
2433
2299
  {
2434
2300
  id: "gpt-5-nano",
2435
2301
  name: "GPT 5 Nano",
2436
- description: "OpenAI's free lightweight GPT model",
2302
+ description: "OpenAI's lightweight GPT model ($0.05/$0.40 per 1M tokens)",
2437
2303
  category: "fast",
2438
2304
  provider: "opencode-zen",
2439
2305
  zenApiType: "openai-responses",
2440
2306
  contextLength: 400000,
2441
- free: true
2307
+ cost: "lower-cost"
2442
2308
  },
2443
2309
  {
2444
2310
  id: "claude-haiku-4-5",
@@ -2447,7 +2313,8 @@ var OPENCODE_ZEN_MODELS = [
2447
2313
  category: "fast",
2448
2314
  provider: "opencode-zen",
2449
2315
  zenApiType: "anthropic",
2450
- contextLength: 200000
2316
+ contextLength: 200000,
2317
+ cost: "lower-cost"
2451
2318
  },
2452
2319
  {
2453
2320
  id: "gemini-3.5-flash",
@@ -2456,52 +2323,8 @@ var OPENCODE_ZEN_MODELS = [
2456
2323
  category: "fast",
2457
2324
  provider: "opencode-zen",
2458
2325
  zenApiType: "google",
2459
- contextLength: 1048576
2460
- },
2461
- {
2462
- id: "gemini-3-flash",
2463
- name: "Gemini 3 Flash",
2464
- description: "Google's fast Gemini model",
2465
- category: "fast",
2466
- provider: "opencode-zen",
2467
- zenApiType: "google",
2468
- contextLength: 200000
2469
- },
2470
- {
2471
- id: "mimo-v2.5",
2472
- name: "MiMo V2.5",
2473
- description: "Xiaomi's latest long-context MiMo model",
2474
- category: "fast",
2475
- provider: "opencode-zen",
2476
- zenApiType: "openai-compatible",
2477
- contextLength: 1048576
2478
- },
2479
- {
2480
- id: "gpt-5.4-mini",
2481
- name: "GPT 5.4 Mini",
2482
- description: "OpenAI's latest fast GPT mini model",
2483
- category: "fast",
2484
- provider: "opencode-zen",
2485
- zenApiType: "openai-responses",
2486
- contextLength: 400000
2487
- },
2488
- {
2489
- id: "gpt-5.4-nano",
2490
- name: "GPT 5.4 Nano",
2491
- description: "OpenAI's latest lightweight GPT model",
2492
- category: "fast",
2493
- provider: "opencode-zen",
2494
- zenApiType: "openai-responses",
2495
- contextLength: 400000
2496
- },
2497
- {
2498
- id: "claude-fable-5",
2499
- name: "Claude Fable 5",
2500
- description: "Anthropic's latest Fable model",
2501
- category: "smart",
2502
- provider: "opencode-zen",
2503
- zenApiType: "anthropic",
2504
- contextLength: 1e6
2326
+ contextLength: 1048576,
2327
+ cost: "lower-cost"
2505
2328
  },
2506
2329
  {
2507
2330
  id: "claude-sonnet-4-6",
@@ -2510,16 +2333,8 @@ var OPENCODE_ZEN_MODELS = [
2510
2333
  category: "smart",
2511
2334
  provider: "opencode-zen",
2512
2335
  zenApiType: "anthropic",
2513
- contextLength: 1e6
2514
- },
2515
- {
2516
- id: "gemini-3.1-pro",
2517
- name: "Gemini 3.1 Pro",
2518
- description: "Google's high-end Gemini model",
2519
- category: "smart",
2520
- provider: "opencode-zen",
2521
- zenApiType: "google",
2522
- contextLength: 200000
2336
+ contextLength: 1e6,
2337
+ cost: "premium"
2523
2338
  },
2524
2339
  {
2525
2340
  id: "gpt-5.5",
@@ -2528,115 +2343,8 @@ var OPENCODE_ZEN_MODELS = [
2528
2343
  category: "smart",
2529
2344
  provider: "opencode-zen",
2530
2345
  zenApiType: "openai-responses",
2531
- contextLength: 1050000
2532
- },
2533
- {
2534
- id: "gpt-5.5-pro",
2535
- name: "GPT 5.5 Pro",
2536
- description: "OpenAI's latest high-capability reasoning model",
2537
- category: "smart",
2538
- provider: "opencode-zen",
2539
- zenApiType: "openai-responses",
2540
- contextLength: 1050000
2541
- },
2542
- {
2543
- id: "gpt-5.3-codex",
2544
- name: "GPT 5.3 Codex",
2545
- description: "OpenAI's latest coding-focused GPT model",
2546
- category: "smart",
2547
- provider: "opencode-zen",
2548
- zenApiType: "openai-responses",
2549
- contextLength: 400000
2550
- },
2551
- {
2552
- id: "gpt-5.3-codex-spark",
2553
- name: "GPT 5.3 Codex Spark",
2554
- description: "OpenAI's latest fast coding-focused GPT model",
2555
- category: "smart",
2556
- provider: "opencode-zen",
2557
- zenApiType: "openai-responses",
2558
- contextLength: 400000
2559
- },
2560
- {
2561
- id: "qwen3.7-plus",
2562
- name: "Qwen3.7 Plus",
2563
- description: "Qwen's latest long-context open-weight plus model",
2564
- category: "smart",
2565
- provider: "opencode-zen",
2566
- zenApiType: "anthropic",
2567
- contextLength: 1e6
2568
- },
2569
- {
2570
- id: "qwen3.7-max",
2571
- name: "Qwen3.7 Max",
2572
- description: "Qwen's latest high-capability open-weight model",
2573
- category: "smart",
2574
- provider: "opencode-zen",
2575
- zenApiType: "anthropic",
2576
- contextLength: 1e6
2577
- },
2578
- {
2579
- id: "minimax-m2.7",
2580
- name: "MiniMax M2.7",
2581
- description: "MiniMax's latest model",
2582
- category: "smart",
2583
- provider: "opencode-zen",
2584
- zenApiType: "openai-compatible",
2585
- contextLength: 196608
2586
- },
2587
- {
2588
- id: "kimi-k2.6",
2589
- name: "Kimi K2.6",
2590
- description: "Moonshot's latest model",
2591
- category: "smart",
2592
- provider: "opencode-zen",
2593
- zenApiType: "openai-compatible",
2594
- contextLength: 262144
2595
- },
2596
- {
2597
- id: "glm-5.2",
2598
- name: "GLM 5.2",
2599
- description: "Z.ai's latest open-weight long-context GLM model",
2600
- category: "smart",
2601
- provider: "opencode-zen",
2602
- zenApiType: "openai-compatible",
2603
- contextLength: 1048576
2604
- },
2605
- {
2606
- id: "deepseek-v4-pro",
2607
- name: "DeepSeek V4 Pro",
2608
- description: "DeepSeek's latest high-context open-source model",
2609
- category: "smart",
2610
- provider: "opencode-zen",
2611
- zenApiType: "openai-compatible",
2612
- contextLength: 1048576
2613
- },
2614
- {
2615
- id: "mimo-v2.5-pro",
2616
- name: "MiMo V2.5 Pro",
2617
- description: "Xiaomi's latest pro MiMo model for agentic coding",
2618
- category: "smart",
2619
- provider: "opencode-zen",
2620
- zenApiType: "openai-compatible",
2621
- contextLength: 1048576
2622
- },
2623
- {
2624
- id: "glm-5.1",
2625
- name: "GLM 5.1",
2626
- description: "Z.ai's latest GLM model",
2627
- category: "smart",
2628
- provider: "opencode-zen",
2629
- zenApiType: "openai-compatible",
2630
- contextLength: 202752
2631
- },
2632
- {
2633
- id: "deepseek-v4-flash",
2634
- name: "DeepSeek V4 Flash",
2635
- description: "DeepSeek's latest fast open-source model",
2636
- category: "fast",
2637
- provider: "opencode-zen",
2638
- zenApiType: "openai-compatible",
2639
- contextLength: 1048576
2346
+ contextLength: 1050000,
2347
+ cost: "premium"
2640
2348
  },
2641
2349
  {
2642
2350
  id: "claude-opus-4-8",
@@ -2645,7 +2353,8 @@ var OPENCODE_ZEN_MODELS = [
2645
2353
  category: "reasoning",
2646
2354
  provider: "opencode-zen",
2647
2355
  zenApiType: "anthropic",
2648
- contextLength: 1e6
2356
+ contextLength: 1e6,
2357
+ cost: "premium"
2649
2358
  }
2650
2359
  ];
2651
2360
  var ALL_MODELS = [
@@ -2695,6 +2404,27 @@ function getProviderDisplayName(provider) {
2695
2404
  }
2696
2405
  }
2697
2406
  }
2407
+ var COST_TIER_ORDER = {
2408
+ free: 0,
2409
+ "lower-cost": 1,
2410
+ premium: 2
2411
+ };
2412
+ var CATEGORY_ORDER = {
2413
+ fast: 0,
2414
+ smart: 1,
2415
+ reasoning: 2
2416
+ };
2417
+ function sortModelsByCost(models) {
2418
+ return [...models].sort((a, b) => {
2419
+ const costDiff = COST_TIER_ORDER[a.cost] - COST_TIER_ORDER[b.cost];
2420
+ if (costDiff !== 0)
2421
+ return costDiff;
2422
+ const catDiff = CATEGORY_ORDER[a.category] - CATEGORY_ORDER[b.category];
2423
+ if (catDiff !== 0)
2424
+ return catDiff;
2425
+ return a.name.localeCompare(b.name);
2426
+ });
2427
+ }
2698
2428
  // src/lib/config.ts
2699
2429
  import { homedir } from "os";
2700
2430
  import { join } from "path";
@@ -46599,44 +46329,16 @@ ${colors.bold}CONFIG${colors.reset}
46599
46329
  function printModels() {
46600
46330
  const config2 = loadConfig();
46601
46331
  const customModels = getCustomModels();
46602
- console.log(`
46603
- ${colors.bold}OpenCode Zen Models${colors.reset}`);
46604
- console.log(`${colors.dim}(* = free, X = temporarily disabled)${colors.reset}
46605
- `);
46606
- const sortedZenModels = [...OPENCODE_ZEN_MODELS].sort((a, b) => a.name.localeCompare(b.name));
46607
- for (const model of sortedZenModels) {
46608
- const isCurrent = config2.provider === "opencode-zen" && config2.defaultModel === model.id;
46609
- const marker24 = isCurrent ? colors.success + "\u2192 " : " ";
46610
- const free = model.free ? colors.success + " *" + colors.reset : "";
46611
- const disabled = model.disabled ? colors.error + " X" + colors.reset : "";
46612
- const category = colors.dim + `[${model.category}]` + colors.reset;
46613
- const name24 = model.disabled ? colors.dim + model.id + colors.reset : model.id;
46614
- console.log(`${marker24}${name24}${free}${disabled} ${category}`);
46615
- if (model.disabled && model.disabledReason) {
46616
- console.log(` ${colors.error}${model.disabledReason}${colors.reset}`);
46617
- } else {
46618
- console.log(` ${colors.dim}${model.description}${colors.reset}`);
46619
- }
46620
- }
46621
- console.log(`
46622
- ${colors.bold}OpenRouter Models${colors.reset}
46623
- `);
46624
- const sortedRouterModels = [...OPENROUTER_MODELS].sort((a, b) => a.name.localeCompare(b.name));
46625
- for (const model of sortedRouterModels) {
46626
- const isCurrent = config2.provider === "openrouter" && config2.defaultModel === model.id;
46627
- const marker24 = isCurrent ? colors.success + "\u2192 " : " ";
46628
- const free = model.free ? colors.success + " *" + colors.reset : "";
46629
- const disabled = model.disabled ? colors.error + " X" + colors.reset : "";
46630
- const category = colors.dim + `[${model.category}]` + colors.reset;
46631
- const name24 = model.disabled ? colors.dim + model.id + colors.reset : model.id;
46632
- console.log(`${marker24}${name24}${free}${disabled} ${category}`);
46633
- if (model.disabled && model.disabledReason) {
46634
- console.log(` ${colors.error}${model.disabledReason}${colors.reset}`);
46635
- } else {
46636
- console.log(` ${colors.dim}${model.description}${colors.reset}`);
46637
- }
46638
- }
46332
+ const costLabel = (cost) => {
46333
+ if (cost === "free")
46334
+ return colors.success + "[free]" + colors.reset;
46335
+ if (cost === "lower-cost")
46336
+ return colors.dim + "[lower-cost]" + colors.reset;
46337
+ return colors.dim + "[premium]" + colors.reset;
46338
+ };
46639
46339
  const providerSections = [
46340
+ ["OpenCode Zen Models", OPENCODE_ZEN_MODELS, "opencode-zen"],
46341
+ ["OpenRouter Models", OPENROUTER_MODELS, "openrouter"],
46640
46342
  ["Vercel AI Gateway Models", VERCEL_AI_GATEWAY_MODELS, "vercel-ai-gateway"],
46641
46343
  ["Cloudflare AI Gateway Models", CLOUDFLARE_AI_GATEWAY_MODELS, "cloudflare-ai-gateway"],
46642
46344
  ["Cloudflare Workers AI Models", WORKERS_AI_MODELS, "workers-ai"]
@@ -46645,12 +46347,13 @@ ${colors.bold}OpenRouter Models${colors.reset}
46645
46347
  console.log(`
46646
46348
  ${colors.bold}${title}${colors.reset}
46647
46349
  `);
46648
- const sortedModels = [...models].sort((a, b) => a.name.localeCompare(b.name));
46649
- for (const model of sortedModels) {
46350
+ const sorted = sortModelsByCost(models.filter((m) => !m.disabled));
46351
+ for (const model of sorted) {
46650
46352
  const isCurrent = config2.provider === provider && config2.defaultModel === model.id;
46651
46353
  const marker24 = isCurrent ? colors.success + "\u2192 " : " ";
46652
- const category = colors.dim + `[${model.category}]` + colors.reset;
46653
- console.log(`${marker24}${model.id} ${category}`);
46354
+ const name24 = model.id;
46355
+ const cost = costLabel(model.cost);
46356
+ console.log(`${marker24}${name24} ${cost}`);
46654
46357
  console.log(` ${colors.dim}${model.description}${colors.reset}`);
46655
46358
  }
46656
46359
  }
@@ -46662,8 +46365,7 @@ ${colors.bold}Custom Models${colors.reset} ${colors.info}(custom)${colors.reset}
46662
46365
  for (const model of sortedCustomModels) {
46663
46366
  const isCurrent = config2.defaultModel === model.id;
46664
46367
  const marker24 = isCurrent ? colors.success + "\u2192 " : " ";
46665
- const category = colors.dim + `[${model.category}]` + colors.reset;
46666
- console.log(`${marker24}${model.id} ${colors.info}(custom)${colors.reset} ${category}`);
46368
+ console.log(`${marker24}${model.id} ${colors.info}[custom]${colors.reset}`);
46667
46369
  console.log(` ${colors.dim}${model.name} - ${model.baseUrl}${colors.reset}`);
46668
46370
  }
46669
46371
  }
@@ -46804,12 +46506,12 @@ Cloudflare account ID: `);
46804
46506
  config2.cloudflareAiGatewayId = gatewayId.trim() || config2.cloudflareAiGatewayId || "default";
46805
46507
  }
46806
46508
  const models = getProviderModels(provider);
46807
- const freeModels = models.filter((m) => m.free);
46509
+ const freeModels = models.filter((m) => m.cost === "free");
46808
46510
  console.log(`
46809
46511
  Recommended models:`);
46810
46512
  const displayModels = freeModels.length > 0 ? freeModels.slice(0, 5) : models.slice(0, 5);
46811
46513
  displayModels.forEach((m, i) => {
46812
- const free = m.free ? colors.green + " (free)" + colors.reset : "";
46514
+ const free = m.cost === "free" ? colors.green + " (free)" + colors.reset : "";
46813
46515
  console.log(` ${i + 1}. ${m.name}${free} - ${m.description}`);
46814
46516
  });
46815
46517
  const modelChoice = await question(`