@jeffreyjyz/opencode-command-code 0.3.13 → 0.3.15

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
@@ -2411,6 +2411,56 @@ function refine(fn, _params = {}) {
2411
2411
  function superRefine(fn) {
2412
2412
  return _superRefine(fn);
2413
2413
  }
2414
+ // package.json
2415
+ var package_default = {
2416
+ name: "@jeffreyjyz/opencode-command-code",
2417
+ version: "0.3.15",
2418
+ description: "Command Code provider + usage dashboard for opencode: two providers (Anthropic wire for Claude, OpenAI wire for everything else) against api.commandcode.ai, live model list, plan gating, /cmd-usage. Requires the cmduse CLI for usage rendering.",
2419
+ type: "module",
2420
+ main: "dist/index.js",
2421
+ types: "dist/index.d.ts",
2422
+ exports: {
2423
+ ".": "./dist/index.js",
2424
+ "./tui": "./dist/tui.js"
2425
+ },
2426
+ scripts: {
2427
+ build: "rm -rf dist && bun build src/index.ts --outdir dist --target bun --external @opencode-ai/plugin --external @opencode/plugin --external @opencode/plugin/tui && bun scripts/build-tui.ts && tsc -p tsconfig.build.json",
2428
+ test: "bun test",
2429
+ typecheck: "tsc --noEmit",
2430
+ "build:tui": "bun scripts/build-tui.ts",
2431
+ "extract:catalog": "bun scripts/extract-catalog.ts"
2432
+ },
2433
+ dependencies: {
2434
+ "@opentui/core": "^0.5.4",
2435
+ "@opentui/solid": "^0.5.4",
2436
+ "solid-js": "1.9.12",
2437
+ zod: "4.1.8"
2438
+ },
2439
+ devDependencies: {
2440
+ "@types/bun": "latest",
2441
+ typescript: "^5",
2442
+ "@opencode-ai/plugin": "*",
2443
+ "@opencode/plugin": "^2.0.11",
2444
+ "@ai-sdk/provider": "3.0.8"
2445
+ },
2446
+ files: [
2447
+ "dist",
2448
+ "tui.js",
2449
+ "LICENSE"
2450
+ ],
2451
+ keywords: [
2452
+ "opencode",
2453
+ "command-code",
2454
+ "plugin",
2455
+ "provider",
2456
+ "ai-sdk"
2457
+ ],
2458
+ license: "MIT",
2459
+ publishConfig: {
2460
+ access: "public"
2461
+ }
2462
+ };
2463
+
2414
2464
  // src/api.ts
2415
2465
  var API_BASE = "https://api.commandcode.ai";
2416
2466
  function authHeaders(key) {
@@ -2455,6 +2505,674 @@ async function providerModels(key) {
2455
2505
  return getJson("/provider/v1/models", key, 15000);
2456
2506
  }
2457
2507
 
2508
+ // src/catalog.ts
2509
+ var MODEL_CATALOG = {
2510
+ "claude-fable-5": {
2511
+ name: "Claude Fable 5",
2512
+ context: 1e6,
2513
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2514
+ cost: { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 },
2515
+ modalities: ["text", "image"],
2516
+ minPlan: "Max"
2517
+ },
2518
+ "claude-fable-5-1": {
2519
+ name: "Claude Fable 5.1",
2520
+ context: 1e6,
2521
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2522
+ cost: { input: 10, output: 50, cacheRead: 0.25, cacheWrite: 12.5 },
2523
+ modalities: ["text", "image"],
2524
+ minPlan: "Max"
2525
+ },
2526
+ "claude-haiku-4-5-20251001": {
2527
+ name: "Claude Haiku 4.5",
2528
+ context: 200000,
2529
+ efforts: null,
2530
+ cost: { input: 1, output: 5, cacheRead: 0.1, cacheWrite: 1.25 },
2531
+ modalities: ["text", "image"],
2532
+ minPlan: "Pro"
2533
+ },
2534
+ "claude-opus-4-7": {
2535
+ name: "Claude Opus 4.7",
2536
+ context: 1e6,
2537
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2538
+ cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
2539
+ modalities: ["text", "image"],
2540
+ minPlan: "Max"
2541
+ },
2542
+ "claude-opus-4-8": {
2543
+ name: "Claude Opus 4.8",
2544
+ context: 1e6,
2545
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2546
+ cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
2547
+ modalities: ["text", "image"],
2548
+ minPlan: "Max"
2549
+ },
2550
+ "claude-opus-5": {
2551
+ name: "Claude Opus 5",
2552
+ context: 1e6,
2553
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2554
+ cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
2555
+ modalities: ["text", "image"],
2556
+ minPlan: "Max"
2557
+ },
2558
+ "claude-opus-5-5": {
2559
+ name: "Claude Opus 5.5",
2560
+ context: 1e6,
2561
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2562
+ cost: { input: 4, output: 20, cacheRead: 0.2, cacheWrite: 5 },
2563
+ modalities: ["text", "image"],
2564
+ minPlan: "Max"
2565
+ },
2566
+ "claude-sonnet-4-6": {
2567
+ name: "Claude Sonnet 4.6",
2568
+ context: 1e6,
2569
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2570
+ cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
2571
+ modalities: ["text", "image"],
2572
+ minPlan: "Pro"
2573
+ },
2574
+ "claude-sonnet-5": {
2575
+ name: "Claude Sonnet 5",
2576
+ context: 1e6,
2577
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2578
+ cost: { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 },
2579
+ modalities: ["text", "image"],
2580
+ minPlan: "Pro"
2581
+ },
2582
+ "deepseek/deepseek-v4-flash": {
2583
+ name: "DeepSeek V4 Flash (latest)",
2584
+ context: 1e6,
2585
+ efforts: ["high", "max"],
2586
+ cost: { input: 0.15, output: 0.6, cacheRead: 0.003, cacheWrite: 0 },
2587
+ modalities: ["text"],
2588
+ minPlan: "Go"
2589
+ },
2590
+ "deepseek/deepseek-v4-flash-fast": {
2591
+ name: "DeepSeek V4 Flash Fast",
2592
+ context: 1e6,
2593
+ efforts: ["low", "high", "max"],
2594
+ cost: { input: 0.28, output: 0.56, cacheRead: 0.07, cacheWrite: 0 },
2595
+ modalities: ["text"],
2596
+ minPlan: "Go"
2597
+ },
2598
+ "deepseek/deepseek-v4-flash-vision-exp": {
2599
+ name: "DeepSeek V4 Flash Vision (exp)",
2600
+ context: 1e6,
2601
+ efforts: ["high", "max"],
2602
+ cost: { input: 0.15, output: 0.6, cacheRead: 0.003, cacheWrite: 0 },
2603
+ modalities: ["text", "image"],
2604
+ minPlan: "Go"
2605
+ },
2606
+ "deepseek/deepseek-v4-pro": {
2607
+ name: "DeepSeek V4 Pro (latest)",
2608
+ context: 1e6,
2609
+ efforts: ["high", "max"],
2610
+ cost: { input: 0.66, output: 1.98, cacheRead: 0.022, cacheWrite: 0 },
2611
+ modalities: ["text"],
2612
+ minPlan: "Go"
2613
+ },
2614
+ "deepseek/deepseek-v4.1-flash": {
2615
+ name: "DeepSeek V4.1 Flash",
2616
+ context: 1e6,
2617
+ efforts: ["low", "high", "max"],
2618
+ cost: { input: 0.15, output: 0.6, cacheRead: 0.003, cacheWrite: 0 },
2619
+ modalities: ["text", "image"],
2620
+ minPlan: "Go"
2621
+ },
2622
+ "google/gemini-3.1-flash-lite": {
2623
+ name: "Gemini 3.1 Flash Lite",
2624
+ context: 1e6,
2625
+ efforts: ["low", "medium", "high"],
2626
+ cost: { input: 0.25, output: 1.5, cacheRead: 0.03, cacheWrite: 0 },
2627
+ modalities: ["text", "image"],
2628
+ minPlan: "Pro"
2629
+ },
2630
+ "google/gemini-3.5-flash": {
2631
+ name: "Gemini 3.5 Flash",
2632
+ context: 1e6,
2633
+ efforts: ["low", "medium", "high"],
2634
+ cost: { input: 1.5, output: 9, cacheRead: 0.15, cacheWrite: 0 },
2635
+ modalities: ["text", "image"],
2636
+ minPlan: "Pro"
2637
+ },
2638
+ "google/gemini-3.5-flash-lite": {
2639
+ name: "Gemini 3.5 Flash Lite",
2640
+ context: 1e6,
2641
+ efforts: ["low", "medium", "high"],
2642
+ cost: { input: 0.3, output: 2.5, cacheRead: 0.03, cacheWrite: 0 },
2643
+ modalities: ["text", "image"],
2644
+ minPlan: "Pro"
2645
+ },
2646
+ "google/gemini-3.6-flash": {
2647
+ name: "Gemini 3.6 Flash",
2648
+ context: 1e6,
2649
+ efforts: ["low", "medium", "high"],
2650
+ cost: { input: 1.5, output: 7.5, cacheRead: 0.15, cacheWrite: 0 },
2651
+ modalities: ["text", "image"],
2652
+ minPlan: "Pro"
2653
+ },
2654
+ "google/gemini-3.7-flash": {
2655
+ name: "Gemini 3.7 Flash",
2656
+ context: 1050000,
2657
+ efforts: ["low", "medium", "high"],
2658
+ cost: { input: 1.5, output: 7.5, cacheRead: 0.15, cacheWrite: 0.08334 },
2659
+ modalities: ["text", "image"],
2660
+ minPlan: "GOAT"
2661
+ },
2662
+ "google/gemini-3.8-flash": {
2663
+ name: "Gemini 3.8 Flash",
2664
+ context: 1e6,
2665
+ efforts: ["low", "medium", "high"],
2666
+ cost: { input: 1.5, output: 7.5, cacheRead: 0.15, cacheWrite: 0 },
2667
+ modalities: ["text", "image"],
2668
+ minPlan: "GOAT"
2669
+ },
2670
+ "gpt-5.3-codex": {
2671
+ name: "GPT-5.3 Codex",
2672
+ context: 400000,
2673
+ efforts: ["low", "medium", "high", "xhigh"],
2674
+ cost: { input: 2, output: 8, cacheRead: 0.5, cacheWrite: 0 },
2675
+ modalities: ["text", "image"],
2676
+ minPlan: "Pro"
2677
+ },
2678
+ "gpt-5.4": {
2679
+ name: "GPT-5.4",
2680
+ context: 400000,
2681
+ efforts: ["low", "medium", "high", "xhigh"],
2682
+ cost: { input: 2.5, output: 15, cacheRead: 0.25, cacheWrite: 0 },
2683
+ modalities: ["text", "image"],
2684
+ minPlan: "Pro"
2685
+ },
2686
+ "gpt-5.4-mini": {
2687
+ name: "GPT-5.4 Mini",
2688
+ context: 400000,
2689
+ efforts: ["low", "medium", "high"],
2690
+ cost: { input: 0.75, output: 4.5, cacheRead: 0.075, cacheWrite: 0 },
2691
+ modalities: ["text", "image"],
2692
+ minPlan: "Pro"
2693
+ },
2694
+ "gpt-5.5": {
2695
+ name: "GPT-5.5",
2696
+ context: 400000,
2697
+ efforts: ["low", "medium", "high", "xhigh"],
2698
+ cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 0 },
2699
+ modalities: ["text", "image"],
2700
+ minPlan: "Pro"
2701
+ },
2702
+ "gpt-5.6-luna": {
2703
+ name: "GPT-5.6 Luna",
2704
+ context: 1050000,
2705
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2706
+ cost: { input: 0.2, output: 1.2, cacheRead: 0.02, cacheWrite: 0.25 },
2707
+ modalities: ["text", "image"],
2708
+ minPlan: "Go"
2709
+ },
2710
+ "gpt-5.6-sol": {
2711
+ name: "GPT-5.6 Sol",
2712
+ context: 1050000,
2713
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2714
+ cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 6.25 },
2715
+ modalities: ["text", "image"],
2716
+ minPlan: "GOAT"
2717
+ },
2718
+ "gpt-5.6-terra": {
2719
+ name: "GPT-5.6 Terra",
2720
+ context: 1050000,
2721
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2722
+ cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 2.5 },
2723
+ modalities: ["text", "image"],
2724
+ minPlan: "Pro"
2725
+ },
2726
+ "gpt-6-astra": {
2727
+ name: "GPT-6 Astra",
2728
+ context: 1050000,
2729
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2730
+ cost: { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 },
2731
+ modalities: ["text", "image"],
2732
+ minPlan: "Max"
2733
+ },
2734
+ "gpt-6-luna": {
2735
+ name: "GPT-6 Luna",
2736
+ context: 1050000,
2737
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2738
+ cost: { input: 0.1, output: 0.5, cacheRead: 0.01, cacheWrite: 0.125 },
2739
+ modalities: ["text", "image"],
2740
+ minPlan: "Go"
2741
+ },
2742
+ "gpt-6-sol": {
2743
+ name: "GPT-6 Sol",
2744
+ context: 1050000,
2745
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2746
+ cost: { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 },
2747
+ modalities: ["text", "image"],
2748
+ minPlan: "Pro"
2749
+ },
2750
+ "inclusionai/ling-3.0-flash-sante:free": {
2751
+ name: "Ling 3.0 Flash Sante",
2752
+ context: 262000,
2753
+ efforts: null,
2754
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
2755
+ modalities: ["text"],
2756
+ minPlan: "Go"
2757
+ },
2758
+ "meituan/LongCat-2.0": {
2759
+ name: "LongCat 2.0",
2760
+ context: 1050000,
2761
+ efforts: null,
2762
+ cost: { input: 0.3, output: 1.2, cacheRead: 0.006, cacheWrite: 0 },
2763
+ modalities: ["text"],
2764
+ minPlan: "Go"
2765
+ },
2766
+ "meta/muse-spark-1.1": {
2767
+ name: "Muse Spark 1.1",
2768
+ context: 1050000,
2769
+ efforts: ["low", "medium", "high", "xhigh"],
2770
+ cost: { input: 1.25, output: 4.25, cacheRead: 0.15, cacheWrite: 0 },
2771
+ modalities: ["text", "image"],
2772
+ minPlan: "Pro"
2773
+ },
2774
+ "meta/muse-spark-1.2": {
2775
+ name: "Muse Spark 1.2",
2776
+ context: 1050000,
2777
+ efforts: ["low", "medium", "high", "xhigh"],
2778
+ cost: { input: 1.25, output: 4.25, cacheRead: 0.15, cacheWrite: 0 },
2779
+ modalities: ["text", "image"],
2780
+ minPlan: "GOAT"
2781
+ },
2782
+ "meta/muse-spark-1.2-contributor": {
2783
+ name: "Muse Spark 1.2 Contributor",
2784
+ context: 1050000,
2785
+ efforts: ["low", "medium", "high", "xhigh"],
2786
+ cost: { input: 0.1, output: 0.2, cacheRead: 0.002, cacheWrite: 0 },
2787
+ modalities: ["text", "image"],
2788
+ minPlan: "Go"
2789
+ },
2790
+ "meta/muse-spark-1.3": {
2791
+ name: "Muse Spark 1.3",
2792
+ context: 1050000,
2793
+ efforts: ["low", "medium", "high", "xhigh", "max"],
2794
+ cost: { input: 1.25, output: 4.25, cacheRead: 0.15, cacheWrite: 0 },
2795
+ modalities: ["text", "image"],
2796
+ minPlan: "GOAT"
2797
+ },
2798
+ "meta/muse-spark-1.3-contributor": {
2799
+ name: "Muse Spark 1.3 Contributor",
2800
+ context: 1050000,
2801
+ efforts: ["low", "medium", "high", "xhigh"],
2802
+ cost: { input: 0.1, output: 0.2, cacheRead: 0.002, cacheWrite: 0 },
2803
+ modalities: ["text", "image"],
2804
+ minPlan: "Go"
2805
+ },
2806
+ "MiniMaxAI/MiniMax-M2.5": {
2807
+ name: "MiniMax M2.5",
2808
+ context: 200000,
2809
+ efforts: null,
2810
+ cost: { input: 0.3, output: 1.2, cacheRead: 0.03, cacheWrite: 0 },
2811
+ modalities: ["text"],
2812
+ minPlan: "Go"
2813
+ },
2814
+ "MiniMaxAI/MiniMax-M2.7": {
2815
+ name: "MiniMax M2.7",
2816
+ context: 0,
2817
+ efforts: null,
2818
+ cost: { input: 0.3, output: 1.2, cacheRead: 0.06, cacheWrite: 0 },
2819
+ modalities: ["text"],
2820
+ minPlan: "Go"
2821
+ },
2822
+ "MiniMaxAI/MiniMax-M3": {
2823
+ name: "MiniMax M3",
2824
+ context: 1e6,
2825
+ efforts: ["low", "medium", "high"],
2826
+ cost: { input: 0.3, output: 1.2, cacheRead: 0.06, cacheWrite: 0 },
2827
+ modalities: ["text", "image"],
2828
+ minPlan: "Go"
2829
+ },
2830
+ "moonshotai/Kimi-K2.5": {
2831
+ name: "Kimi K2.5",
2832
+ context: 256000,
2833
+ efforts: null,
2834
+ cost: { input: 0.6, output: 3, cacheRead: 0.1, cacheWrite: 0 },
2835
+ modalities: ["text", "image"],
2836
+ minPlan: "Go"
2837
+ },
2838
+ "moonshotai/Kimi-K2.6": {
2839
+ name: "Kimi K2.6",
2840
+ context: 256000,
2841
+ efforts: null,
2842
+ cost: { input: 0.95, output: 4, cacheRead: 0.16, cacheWrite: 0 },
2843
+ modalities: ["text", "image"],
2844
+ minPlan: "Go"
2845
+ },
2846
+ "moonshotai/Kimi-K2.7-Code": {
2847
+ name: "Kimi K2.7 Code",
2848
+ context: 256000,
2849
+ efforts: null,
2850
+ cost: { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 },
2851
+ modalities: ["text", "image"],
2852
+ minPlan: "Go"
2853
+ },
2854
+ "moonshotai/Kimi-K2.7-Code-Highspeed": {
2855
+ name: "Kimi K2.7 Code HighSpeed",
2856
+ context: 262000,
2857
+ efforts: null,
2858
+ cost: { input: 1.9, output: 8, cacheRead: 0.38, cacheWrite: 0 },
2859
+ modalities: ["text", "image"],
2860
+ minPlan: "Go"
2861
+ },
2862
+ "moonshotai/Kimi-K3": {
2863
+ name: "Kimi K3",
2864
+ context: 1e6,
2865
+ efforts: ["low", "high", "max"],
2866
+ cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 0 },
2867
+ modalities: ["text", "image"],
2868
+ minPlan: "Go"
2869
+ },
2870
+ "nvidia/nemotron-3-ultra-550b-a55b": {
2871
+ name: "Nemotron 3 Ultra",
2872
+ context: 1e6,
2873
+ efforts: null,
2874
+ cost: { input: 0.6, output: 2.4, cacheRead: 0.12, cacheWrite: 0 },
2875
+ modalities: ["text"],
2876
+ minPlan: "Go"
2877
+ },
2878
+ "poolside/laguna-s-2.1-free": {
2879
+ name: "Laguna S 2.1",
2880
+ context: 256000,
2881
+ efforts: null,
2882
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
2883
+ modalities: ["text"],
2884
+ minPlan: "Go"
2885
+ },
2886
+ "Qwen/Qwen3.6-Max-Preview": {
2887
+ name: "Qwen 3.6 Max Preview",
2888
+ context: 0,
2889
+ efforts: null,
2890
+ cost: { input: 1.3, output: 7.8, cacheRead: 0.26, cacheWrite: 1.63 },
2891
+ modalities: ["text"],
2892
+ minPlan: "Go"
2893
+ },
2894
+ "Qwen/Qwen3.6-Plus": {
2895
+ name: "Qwen 3.6 Plus",
2896
+ context: 0,
2897
+ efforts: null,
2898
+ cost: { input: 0.5, output: 3, cacheRead: 0.1, cacheWrite: 0 },
2899
+ modalities: ["text", "image"],
2900
+ minPlan: "Go"
2901
+ },
2902
+ "Qwen/Qwen3.7-Flash": {
2903
+ name: "Qwen 3.7 Flash",
2904
+ context: 1e6,
2905
+ efforts: null,
2906
+ cost: { input: 0.03, output: 0.13, cacheRead: 0.006, cacheWrite: 0.038 },
2907
+ modalities: ["text", "image"],
2908
+ minPlan: "Go"
2909
+ },
2910
+ "Qwen/Qwen3.7-Max": {
2911
+ name: "Qwen 3.7 Max",
2912
+ context: 1e6,
2913
+ efforts: null,
2914
+ cost: { input: 2.5, output: 7.5, cacheRead: 0.5, cacheWrite: 3.13 },
2915
+ modalities: ["text"],
2916
+ minPlan: "Go"
2917
+ },
2918
+ "Qwen/Qwen3.7-Plus": {
2919
+ name: "Qwen 3.7 Plus",
2920
+ context: 1e6,
2921
+ efforts: null,
2922
+ cost: { input: 0.4, output: 1.6, cacheRead: 0.08, cacheWrite: 0.5 },
2923
+ modalities: ["text", "image"],
2924
+ minPlan: "Go"
2925
+ },
2926
+ "Qwen/Qwen3.8-27B": {
2927
+ name: "Qwen 3.8 27B",
2928
+ context: 262000,
2929
+ efforts: ["low", "medium", "xhigh"],
2930
+ cost: { input: 0.4, output: 3, cacheRead: 0.04, cacheWrite: 0 },
2931
+ modalities: ["text", "image"],
2932
+ minPlan: "Go"
2933
+ },
2934
+ "Qwen/Qwen3.8-Flash": {
2935
+ name: "Qwen 3.8 Flash",
2936
+ context: 1e6,
2937
+ efforts: ["low", "medium", "xhigh"],
2938
+ cost: { input: 0.16, output: 0.47, cacheRead: 0.016, cacheWrite: 0 },
2939
+ modalities: ["text", "image"],
2940
+ minPlan: "Go"
2941
+ },
2942
+ "Qwen/Qwen3.8-Max": {
2943
+ name: "Qwen 3.8 Max",
2944
+ context: 1e6,
2945
+ efforts: ["low", "medium", "xhigh"],
2946
+ cost: { input: 2, output: 6, cacheRead: 0.25, cacheWrite: 2.5 },
2947
+ modalities: ["text", "image"],
2948
+ minPlan: "Go"
2949
+ },
2950
+ "Qwen/Qwen3.8-Max-0902": {
2951
+ name: "Qwen 3.8 Max 0902",
2952
+ context: 1e6,
2953
+ efforts: ["low", "medium", "xhigh"],
2954
+ cost: { input: 2, output: 6, cacheRead: 0.25, cacheWrite: 0 },
2955
+ modalities: ["text", "image"],
2956
+ minPlan: "Go"
2957
+ },
2958
+ "Qwen/Qwen3.8-Omni-Flash": {
2959
+ name: "Qwen 3.8 Omni Flash",
2960
+ context: 1e6,
2961
+ efforts: ["low", "medium", "xhigh"],
2962
+ cost: { input: 0.15, output: 0.47, cacheRead: 0.016, cacheWrite: 0 },
2963
+ modalities: ["text", "image"],
2964
+ minPlan: "Go"
2965
+ },
2966
+ "sakana/fugu-ultra": {
2967
+ name: "Fugu Ultra",
2968
+ context: 1e6,
2969
+ efforts: ["high", "xhigh"],
2970
+ cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 0 },
2971
+ modalities: ["text", "image"],
2972
+ minPlan: "Max"
2973
+ },
2974
+ "stealth/space-bunny-alpha": {
2975
+ name: "Space Bunny Alpha",
2976
+ context: 1e6,
2977
+ efforts: ["low", "medium", "high"],
2978
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
2979
+ modalities: ["text", "image"],
2980
+ minPlan: "Go"
2981
+ },
2982
+ "stepfun/Step-3.5-Flash": {
2983
+ name: "Step 3.5 Flash",
2984
+ context: 262000,
2985
+ efforts: null,
2986
+ cost: { input: 0.09, output: 0.3, cacheRead: 0.02, cacheWrite: 0 },
2987
+ modalities: ["text"],
2988
+ minPlan: "Go"
2989
+ },
2990
+ "stepfun/Step-3.7-Flash": {
2991
+ name: "Step 3.7 Flash",
2992
+ context: 256000,
2993
+ efforts: null,
2994
+ cost: { input: 0.2, output: 1.15, cacheRead: 0.04, cacheWrite: 0 },
2995
+ modalities: ["text", "image"],
2996
+ minPlan: "Go"
2997
+ },
2998
+ "stepfun/Step-5-Preview": {
2999
+ name: "Step 5 Preview",
3000
+ context: 1e6,
3001
+ efforts: ["low", "medium", "high"],
3002
+ cost: { input: 1, output: 2.7, cacheRead: 0.05, cacheWrite: 0 },
3003
+ modalities: ["text", "image"],
3004
+ minPlan: "Go"
3005
+ },
3006
+ "tencent/hy3-paid": {
3007
+ name: "Tencent Hy3",
3008
+ context: 262000,
3009
+ efforts: null,
3010
+ cost: { input: 0.14, output: 0.58, cacheRead: 0.035, cacheWrite: 0 },
3011
+ modalities: ["text"],
3012
+ minPlan: "Go"
3013
+ },
3014
+ "tencent/hy4-preview": {
3015
+ name: "Tencent Hy4 Preview",
3016
+ context: 1050000,
3017
+ efforts: ["low", "medium", "high"],
3018
+ cost: { input: 0.834, output: 2.501, cacheRead: 0.042, cacheWrite: 0 },
3019
+ modalities: ["text"],
3020
+ minPlan: "Go"
3021
+ },
3022
+ "thinkingmachines/inkling": {
3023
+ name: "Inkling",
3024
+ context: 256000,
3025
+ efforts: null,
3026
+ cost: { input: 1, output: 4.05, cacheRead: 0.17, cacheWrite: 0 },
3027
+ modalities: ["text", "image"],
3028
+ minPlan: "Go"
3029
+ },
3030
+ "thinkingmachines/inkling-small": {
3031
+ name: "Inkling Small",
3032
+ context: 1e6,
3033
+ efforts: null,
3034
+ cost: { input: 0.5, output: 1.2, cacheRead: 0.1, cacheWrite: 0 },
3035
+ modalities: ["text", "image"],
3036
+ minPlan: "Go"
3037
+ },
3038
+ "xai/grok-4.5": {
3039
+ name: "Grok 4.5",
3040
+ context: 500000,
3041
+ efforts: ["low", "medium", "high"],
3042
+ cost: { input: 2, output: 6, cacheRead: 0.5, cacheWrite: 0 },
3043
+ modalities: ["text", "image"],
3044
+ minPlan: "Go"
3045
+ },
3046
+ "xai/grok-4.6": {
3047
+ name: "Grok 4.6",
3048
+ context: 500000,
3049
+ efforts: ["low", "medium", "high", "xhigh"],
3050
+ cost: { input: 2, output: 6, cacheRead: 0.5, cacheWrite: 0 },
3051
+ modalities: ["text", "image"],
3052
+ minPlan: "GOAT"
3053
+ },
3054
+ "xai/grok-4.7": {
3055
+ name: "Grok 4.7",
3056
+ context: 500000,
3057
+ efforts: ["low", "medium", "high", "xhigh"],
3058
+ cost: { input: 1.2, output: 3.6, cacheRead: 0.3, cacheWrite: 0 },
3059
+ modalities: ["text", "image"],
3060
+ minPlan: "GOAT"
3061
+ },
3062
+ "xiaomi/mimo-v2.5": {
3063
+ name: "MiMo V2.5",
3064
+ context: 1e6,
3065
+ efforts: null,
3066
+ cost: { input: 0.14, output: 0.28, cacheRead: 0.0028, cacheWrite: 0 },
3067
+ modalities: ["text", "image"],
3068
+ minPlan: "Go"
3069
+ },
3070
+ "xiaomi/mimo-v2.5-pro": {
3071
+ name: "MiMo V2.5 Pro",
3072
+ context: 1e6,
3073
+ efforts: null,
3074
+ cost: { input: 0.435, output: 0.87, cacheRead: 0.0036, cacheWrite: 0 },
3075
+ modalities: ["text"],
3076
+ minPlan: "Go"
3077
+ },
3078
+ "xiaomi/mimo-v2.6-flash": {
3079
+ name: "MiMo V2.6 Flash",
3080
+ context: 1050000,
3081
+ efforts: null,
3082
+ cost: { input: 0.14, output: 0.28, cacheRead: 0.0028, cacheWrite: 0 },
3083
+ modalities: ["text", "image"],
3084
+ minPlan: "Go"
3085
+ },
3086
+ "xiaomi/mimo-v2.6-pro": {
3087
+ name: "MiMo V2.6 Pro",
3088
+ context: 1050000,
3089
+ efforts: null,
3090
+ cost: { input: 0.435, output: 0.87, cacheRead: 0.0036, cacheWrite: 0 },
3091
+ modalities: ["text", "image"],
3092
+ minPlan: "Go"
3093
+ },
3094
+ "xiaomi/mimo-v2.6-pro-ultraspeed": {
3095
+ name: "MiMo V2.6 Pro UltraSpeed",
3096
+ context: 1050000,
3097
+ efforts: null,
3098
+ cost: { input: 4.35, output: 8.7, cacheRead: 0.036, cacheWrite: 0 },
3099
+ modalities: ["text", "image"],
3100
+ minPlan: "GOAT"
3101
+ },
3102
+ "z-ai/glm-5.3-flash": {
3103
+ name: "GLM-5.3 Flash",
3104
+ context: 1050000,
3105
+ efforts: ["low", "high", "max"],
3106
+ cost: { input: 0.15, output: 0.5, cacheRead: 0.03, cacheWrite: 0 },
3107
+ modalities: ["text", "image"],
3108
+ minPlan: "Go"
3109
+ },
3110
+ "z-ai/glm-5.3-flashx": {
3111
+ name: "GLM-5.3 FlashX",
3112
+ context: 1e6,
3113
+ efforts: ["low", "high", "max"],
3114
+ cost: { input: 0.37, output: 1.25, cacheRead: 0.075, cacheWrite: 0 },
3115
+ modalities: ["text", "image"],
3116
+ minPlan: "Go"
3117
+ },
3118
+ "zai-org/GLM-5": {
3119
+ name: "GLM-5",
3120
+ context: 200000,
3121
+ efforts: null,
3122
+ cost: { input: 1, output: 3.2, cacheRead: 0.2, cacheWrite: 0 },
3123
+ modalities: ["text"],
3124
+ minPlan: "Go"
3125
+ },
3126
+ "zai-org/GLM-5.1": {
3127
+ name: "GLM-5.1",
3128
+ context: 0,
3129
+ efforts: null,
3130
+ cost: { input: 1.4, output: 4.4, cacheRead: 0.26, cacheWrite: 0 },
3131
+ modalities: ["text"],
3132
+ minPlan: "Go"
3133
+ },
3134
+ "zai-org/GLM-5.2": {
3135
+ name: "GLM-5.2",
3136
+ context: 1e6,
3137
+ efforts: ["high", "max"],
3138
+ cost: { input: 1.4, output: 4.4, cacheRead: 0.26, cacheWrite: 0 },
3139
+ modalities: ["text"],
3140
+ minPlan: "Go"
3141
+ },
3142
+ "zai-org/GLM-5.2-Fast": {
3143
+ name: "GLM-5.2 Fast",
3144
+ context: 1e6,
3145
+ efforts: null,
3146
+ cost: { input: 3, output: 10.25, cacheRead: 0.5, cacheWrite: 0 },
3147
+ modalities: ["text"],
3148
+ minPlan: "Go"
3149
+ },
3150
+ "zai-org/GLM-5.3": {
3151
+ name: "GLM-5.3",
3152
+ context: 1e6,
3153
+ efforts: ["low", "high", "max"],
3154
+ cost: { input: 1.4, output: 4.4, cacheRead: 0.26, cacheWrite: 0 },
3155
+ modalities: ["text"],
3156
+ minPlan: "Go"
3157
+ }
3158
+ };
3159
+ var TEXT_ONLY = ["text"];
3160
+ function inputModalities(id) {
3161
+ return MODEL_CATALOG[id]?.modalities ?? TEXT_ONLY;
3162
+ }
3163
+ function supportsImage(id) {
3164
+ return inputModalities(id).includes("image");
3165
+ }
3166
+ function modelCost(id) {
3167
+ return MODEL_CATALOG[id]?.cost;
3168
+ }
3169
+ function reasoningVariants(id) {
3170
+ const efforts = MODEL_CATALOG[id]?.efforts;
3171
+ if (!efforts || efforts.length === 0)
3172
+ return;
3173
+ return Object.fromEntries(efforts.map((effort) => [effort, { reasoningEffort: effort }]));
3174
+ }
3175
+
2458
3176
  // src/cli.ts
2459
3177
  import { spawn } from "child_process";
2460
3178
  function cmduseCandidates(env = process.env) {
@@ -2598,107 +3316,6 @@ async function resolveKey(getAuth) {
2598
3316
  } catch {}
2599
3317
  throw new Error("No Command Code API key found. Run /connect, choose Command Code, and paste your key (or `cmd login` in a terminal, or set CMD_API_KEY).");
2600
3318
  }
2601
-
2602
- // src/catalog.ts
2603
- var MODEL_CATALOG = {
2604
- "claude-fable-5": { name: "Claude Fable 5", context: 1e6, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 }, modalities: ["text", "image"], minPlan: "Max" },
2605
- "claude-fable-5-1": { name: "Claude Fable 5.1", context: 1e6, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 10, output: 50, cacheRead: 0.25, cacheWrite: 12.5 }, modalities: ["text", "image"], minPlan: "Max" },
2606
- "claude-haiku-4-5-20251001": { name: "Claude Haiku 4.5", context: 200000, efforts: null, cost: { input: 1, output: 5, cacheRead: 0.1, cacheWrite: 1.25 }, modalities: ["text", "image"], minPlan: "Pro" },
2607
- "claude-opus-4-7": { name: "Claude Opus 4.7", context: 1e6, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 }, modalities: ["text", "image"], minPlan: "Max" },
2608
- "claude-opus-4-8": { name: "Claude Opus 4.8", context: 1e6, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 }, modalities: ["text", "image"], minPlan: "Max" },
2609
- "claude-opus-5": { name: "Claude Opus 5", context: 1e6, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 }, modalities: ["text", "image"], minPlan: "Max" },
2610
- "claude-opus-5-5": { name: "Claude Opus 5.5", context: 1e6, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 4, output: 20, cacheRead: 0.2, cacheWrite: 5 }, modalities: ["text", "image"], minPlan: "Max" },
2611
- "claude-sonnet-4-6": { name: "Claude Sonnet 4.6", context: 1e6, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 }, modalities: ["text", "image"], minPlan: "Pro" },
2612
- "claude-sonnet-5": { name: "Claude Sonnet 5", context: 1e6, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 }, modalities: ["text", "image"], minPlan: "Pro" },
2613
- "deepseek/deepseek-v4-flash": { name: "DeepSeek V4 Flash (latest)", context: 1e6, efforts: ["high", "max"], cost: { input: 0.15, output: 0.6, cacheRead: 0.003, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2614
- "deepseek/deepseek-v4-flash-fast": { name: "DeepSeek V4 Flash Fast", context: 1e6, efforts: ["low", "high", "max"], cost: { input: 0.28, output: 0.56, cacheRead: 0.07, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2615
- "deepseek/deepseek-v4-flash-vision-exp": { name: "DeepSeek V4 Flash Vision (exp)", context: 1e6, efforts: ["high", "max"], cost: { input: 0.15, output: 0.6, cacheRead: 0.003, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2616
- "deepseek/deepseek-v4-pro": { name: "DeepSeek V4 Pro (latest)", context: 1e6, efforts: ["high", "max"], cost: { input: 0.66, output: 1.98, cacheRead: 0.022, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2617
- "deepseek/deepseek-v4.1-flash": { name: "DeepSeek V4.1 Flash", context: 1e6, efforts: ["low", "high", "max"], cost: { input: 0.15, output: 0.6, cacheRead: 0.003, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2618
- "google/gemini-3.1-flash-lite": { name: "Gemini 3.1 Flash Lite", context: 1e6, efforts: ["low", "medium", "high"], cost: { input: 0.25, output: 1.5, cacheRead: 0.03, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Pro" },
2619
- "google/gemini-3.5-flash": { name: "Gemini 3.5 Flash", context: 1e6, efforts: ["low", "medium", "high"], cost: { input: 1.5, output: 9, cacheRead: 0.15, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Pro" },
2620
- "google/gemini-3.5-flash-lite": { name: "Gemini 3.5 Flash Lite", context: 1e6, efforts: ["low", "medium", "high"], cost: { input: 0.3, output: 2.5, cacheRead: 0.03, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Pro" },
2621
- "google/gemini-3.6-flash": { name: "Gemini 3.6 Flash", context: 1e6, efforts: ["low", "medium", "high"], cost: { input: 1.5, output: 7.5, cacheRead: 0.15, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Pro" },
2622
- "google/gemini-3.7-flash": { name: "Gemini 3.7 Flash", context: 1050000, efforts: ["low", "medium", "high"], cost: { input: 1.5, output: 7.5, cacheRead: 0.15, cacheWrite: 0.08334 }, modalities: ["text", "image"], minPlan: "GOAT" },
2623
- "google/gemini-3.8-flash": { name: "Gemini 3.8 Flash", context: 1e6, efforts: ["low", "medium", "high"], cost: { input: 1.5, output: 7.5, cacheRead: 0.15, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "GOAT" },
2624
- "gpt-5.3-codex": { name: "GPT-5.3 Codex", context: 400000, efforts: ["low", "medium", "high", "xhigh"], cost: { input: 2, output: 8, cacheRead: 0.5, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Pro" },
2625
- "gpt-5.4": { name: "GPT-5.4", context: 400000, efforts: ["low", "medium", "high", "xhigh"], cost: { input: 2.5, output: 15, cacheRead: 0.25, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Pro" },
2626
- "gpt-5.4-mini": { name: "GPT-5.4 Mini", context: 400000, efforts: ["low", "medium", "high"], cost: { input: 0.75, output: 4.5, cacheRead: 0.075, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Pro" },
2627
- "gpt-5.5": { name: "GPT-5.5", context: 400000, efforts: ["low", "medium", "high", "xhigh"], cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Pro" },
2628
- "gpt-5.6-luna": { name: "GPT-5.6 Luna", context: 1050000, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 0.2, output: 1.2, cacheRead: 0.02, cacheWrite: 0.25 }, modalities: ["text", "image"], minPlan: "Go" },
2629
- "gpt-5.6-sol": { name: "GPT-5.6 Sol", context: 1050000, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 6.25 }, modalities: ["text", "image"], minPlan: "GOAT" },
2630
- "gpt-5.6-terra": { name: "GPT-5.6 Terra", context: 1050000, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 2.5 }, modalities: ["text", "image"], minPlan: "Pro" },
2631
- "gpt-6-astra": { name: "GPT-6 Astra", context: 1050000, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 }, modalities: ["text", "image"], minPlan: "Max" },
2632
- "gpt-6-luna": { name: "GPT-6 Luna", context: 1050000, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 0.1, output: 0.5, cacheRead: 0.01, cacheWrite: 0.125 }, modalities: ["text", "image"], minPlan: "Go" },
2633
- "gpt-6-sol": { name: "GPT-6 Sol", context: 1050000, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 }, modalities: ["text", "image"], minPlan: "Pro" },
2634
- "inclusionai/ling-3.0-flash-sante:free": { name: "Ling 3.0 Flash Sante", context: 262000, efforts: null, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2635
- "meituan/LongCat-2.0": { name: "LongCat 2.0", context: 1050000, efforts: null, cost: { input: 0.3, output: 1.2, cacheRead: 0.006, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2636
- "meta/muse-spark-1.1": { name: "Muse Spark 1.1", context: 1050000, efforts: ["low", "medium", "high", "xhigh"], cost: { input: 1.25, output: 4.25, cacheRead: 0.15, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Pro" },
2637
- "meta/muse-spark-1.2": { name: "Muse Spark 1.2", context: 1050000, efforts: ["low", "medium", "high", "xhigh"], cost: { input: 1.25, output: 4.25, cacheRead: 0.15, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "GOAT" },
2638
- "meta/muse-spark-1.2-contributor": { name: "Muse Spark 1.2 Contributor", context: 1050000, efforts: ["low", "medium", "high", "xhigh"], cost: { input: 0.1, output: 0.2, cacheRead: 0.002, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2639
- "meta/muse-spark-1.3": { name: "Muse Spark 1.3", context: 1050000, efforts: ["low", "medium", "high", "xhigh", "max"], cost: { input: 1.25, output: 4.25, cacheRead: 0.15, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "GOAT" },
2640
- "meta/muse-spark-1.3-contributor": { name: "Muse Spark 1.3 Contributor", context: 1050000, efforts: ["low", "medium", "high", "xhigh"], cost: { input: 0.1, output: 0.2, cacheRead: 0.002, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2641
- "MiniMaxAI/MiniMax-M2.5": { name: "MiniMax M2.5", context: 200000, efforts: null, cost: { input: 0.3, output: 1.2, cacheRead: 0.03, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2642
- "MiniMaxAI/MiniMax-M2.7": { name: "MiniMax M2.7", context: 0, efforts: null, cost: { input: 0.3, output: 1.2, cacheRead: 0.06, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2643
- "MiniMaxAI/MiniMax-M3": { name: "MiniMax M3", context: 1e6, efforts: ["low", "medium", "high"], cost: { input: 0.3, output: 1.2, cacheRead: 0.06, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2644
- "moonshotai/Kimi-K2.5": { name: "Kimi K2.5", context: 256000, efforts: null, cost: { input: 0.6, output: 3, cacheRead: 0.1, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2645
- "moonshotai/Kimi-K2.6": { name: "Kimi K2.6", context: 256000, efforts: null, cost: { input: 0.95, output: 4, cacheRead: 0.16, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2646
- "moonshotai/Kimi-K2.7-Code": { name: "Kimi K2.7 Code", context: 256000, efforts: null, cost: { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2647
- "moonshotai/Kimi-K2.7-Code-Highspeed": { name: "Kimi K2.7 Code HighSpeed", context: 262000, efforts: null, cost: { input: 1.9, output: 8, cacheRead: 0.38, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2648
- "moonshotai/Kimi-K3": { name: "Kimi K3", context: 1e6, efforts: ["low", "high", "max"], cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2649
- "nvidia/nemotron-3-ultra-550b-a55b": { name: "Nemotron 3 Ultra", context: 1e6, efforts: null, cost: { input: 0.6, output: 2.4, cacheRead: 0.12, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2650
- "poolside/laguna-s-2.1-free": { name: "Laguna S 2.1", context: 256000, efforts: null, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2651
- "Qwen/Qwen3.6-Max-Preview": { name: "Qwen 3.6 Max Preview", context: 0, efforts: null, cost: { input: 1.3, output: 7.8, cacheRead: 0.26, cacheWrite: 1.63 }, modalities: ["text"], minPlan: "Go" },
2652
- "Qwen/Qwen3.6-Plus": { name: "Qwen 3.6 Plus", context: 0, efforts: null, cost: { input: 0.5, output: 3, cacheRead: 0.1, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2653
- "Qwen/Qwen3.7-Flash": { name: "Qwen 3.7 Flash", context: 1e6, efforts: null, cost: { input: 0.03, output: 0.13, cacheRead: 0.006, cacheWrite: 0.038 }, modalities: ["text", "image"], minPlan: "Go" },
2654
- "Qwen/Qwen3.7-Max": { name: "Qwen 3.7 Max", context: 1e6, efforts: null, cost: { input: 2.5, output: 7.5, cacheRead: 0.5, cacheWrite: 3.13 }, modalities: ["text"], minPlan: "Go" },
2655
- "Qwen/Qwen3.7-Plus": { name: "Qwen 3.7 Plus", context: 1e6, efforts: null, cost: { input: 0.4, output: 1.6, cacheRead: 0.08, cacheWrite: 0.5 }, modalities: ["text", "image"], minPlan: "Go" },
2656
- "Qwen/Qwen3.8-27B": { name: "Qwen 3.8 27B", context: 262000, efforts: ["low", "medium", "xhigh"], cost: { input: 0.4, output: 3, cacheRead: 0.04, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2657
- "Qwen/Qwen3.8-Flash": { name: "Qwen 3.8 Flash", context: 1e6, efforts: ["low", "medium", "xhigh"], cost: { input: 0.16, output: 0.47, cacheRead: 0.016, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2658
- "Qwen/Qwen3.8-Max": { name: "Qwen 3.8 Max", context: 1e6, efforts: ["low", "medium", "xhigh"], cost: { input: 2, output: 6, cacheRead: 0.25, cacheWrite: 2.5 }, modalities: ["text", "image"], minPlan: "Go" },
2659
- "Qwen/Qwen3.8-Max-0902": { name: "Qwen 3.8 Max 0902", context: 1e6, efforts: ["low", "medium", "xhigh"], cost: { input: 2, output: 6, cacheRead: 0.25, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2660
- "Qwen/Qwen3.8-Omni-Flash": { name: "Qwen 3.8 Omni Flash", context: 1e6, efforts: ["low", "medium", "xhigh"], cost: { input: 0.15, output: 0.47, cacheRead: 0.016, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2661
- "sakana/fugu-ultra": { name: "Fugu Ultra", context: 1e6, efforts: ["high", "xhigh"], cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Max" },
2662
- "stealth/space-bunny-alpha": { name: "Space Bunny Alpha", context: 1e6, efforts: ["low", "medium", "high"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2663
- "stepfun/Step-3.5-Flash": { name: "Step 3.5 Flash", context: 262000, efforts: null, cost: { input: 0.09, output: 0.3, cacheRead: 0.02, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2664
- "stepfun/Step-3.7-Flash": { name: "Step 3.7 Flash", context: 256000, efforts: null, cost: { input: 0.2, output: 1.15, cacheRead: 0.04, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2665
- "stepfun/Step-5-Preview": { name: "Step 5 Preview", context: 1e6, efforts: ["low", "medium", "high"], cost: { input: 1, output: 2.7, cacheRead: 0.05, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2666
- "tencent/hy3-paid": { name: "Tencent Hy3", context: 262000, efforts: null, cost: { input: 0.14, output: 0.58, cacheRead: 0.035, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2667
- "tencent/hy4-preview": { name: "Tencent Hy4 Preview", context: 1050000, efforts: ["low", "medium", "high"], cost: { input: 0.834, output: 2.501, cacheRead: 0.042, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2668
- "thinkingmachines/inkling": { name: "Inkling", context: 256000, efforts: null, cost: { input: 1, output: 4.05, cacheRead: 0.17, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2669
- "thinkingmachines/inkling-small": { name: "Inkling Small", context: 1e6, efforts: null, cost: { input: 0.5, output: 1.2, cacheRead: 0.1, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2670
- "xai/grok-4.5": { name: "Grok 4.5", context: 500000, efforts: ["low", "medium", "high"], cost: { input: 2, output: 6, cacheRead: 0.5, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2671
- "xai/grok-4.6": { name: "Grok 4.6", context: 500000, efforts: ["low", "medium", "high", "xhigh"], cost: { input: 2, output: 6, cacheRead: 0.5, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "GOAT" },
2672
- "xai/grok-4.7": { name: "Grok 4.7", context: 500000, efforts: ["low", "medium", "high", "xhigh"], cost: { input: 1.2, output: 3.6, cacheRead: 0.3, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "GOAT" },
2673
- "xiaomi/mimo-v2.5": { name: "MiMo V2.5", context: 1e6, efforts: null, cost: { input: 0.14, output: 0.28, cacheRead: 0.0028, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2674
- "xiaomi/mimo-v2.5-pro": { name: "MiMo V2.5 Pro", context: 1e6, efforts: null, cost: { input: 0.435, output: 0.87, cacheRead: 0.0036, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2675
- "xiaomi/mimo-v2.6-flash": { name: "MiMo V2.6 Flash", context: 1050000, efforts: null, cost: { input: 0.14, output: 0.28, cacheRead: 0.0028, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2676
- "xiaomi/mimo-v2.6-pro": { name: "MiMo V2.6 Pro", context: 1050000, efforts: null, cost: { input: 0.435, output: 0.87, cacheRead: 0.0036, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2677
- "xiaomi/mimo-v2.6-pro-ultraspeed": { name: "MiMo V2.6 Pro UltraSpeed", context: 1050000, efforts: null, cost: { input: 4.35, output: 8.7, cacheRead: 0.036, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "GOAT" },
2678
- "z-ai/glm-5.3-flash": { name: "GLM-5.3 Flash", context: 1050000, efforts: ["low", "high", "max"], cost: { input: 0.15, output: 0.5, cacheRead: 0.03, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2679
- "z-ai/glm-5.3-flashx": { name: "GLM-5.3 FlashX", context: 1e6, efforts: ["low", "high", "max"], cost: { input: 0.37, output: 1.25, cacheRead: 0.075, cacheWrite: 0 }, modalities: ["text", "image"], minPlan: "Go" },
2680
- "zai-org/GLM-5": { name: "GLM-5", context: 200000, efforts: null, cost: { input: 1, output: 3.2, cacheRead: 0.2, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2681
- "zai-org/GLM-5.1": { name: "GLM-5.1", context: 0, efforts: null, cost: { input: 1.4, output: 4.4, cacheRead: 0.26, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2682
- "zai-org/GLM-5.2": { name: "GLM-5.2", context: 1e6, efforts: ["high", "max"], cost: { input: 1.4, output: 4.4, cacheRead: 0.26, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2683
- "zai-org/GLM-5.2-Fast": { name: "GLM-5.2 Fast", context: 1e6, efforts: null, cost: { input: 3, output: 10.25, cacheRead: 0.5, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" },
2684
- "zai-org/GLM-5.3": { name: "GLM-5.3", context: 1e6, efforts: ["low", "high", "max"], cost: { input: 1.4, output: 4.4, cacheRead: 0.26, cacheWrite: 0 }, modalities: ["text"], minPlan: "Go" }
2685
- };
2686
- var TEXT_ONLY = ["text"];
2687
- function inputModalities(id) {
2688
- return MODEL_CATALOG[id]?.modalities ?? TEXT_ONLY;
2689
- }
2690
- function supportsImage(id) {
2691
- return inputModalities(id).includes("image");
2692
- }
2693
- function modelCost(id) {
2694
- return MODEL_CATALOG[id]?.cost;
2695
- }
2696
- function reasoningVariants(id) {
2697
- const efforts = MODEL_CATALOG[id]?.efforts;
2698
- if (!efforts || efforts.length === 0)
2699
- return;
2700
- return Object.fromEntries(efforts.map((effort) => [effort, { reasoningEffort: effort }]));
2701
- }
2702
3319
  // ../core/gating.json
2703
3320
  var gating_default = {
2704
3321
  extractedAt: "2026-09-27T06:27:06.878Z",
@@ -3121,6 +3738,38 @@ async function loadModels(key) {
3121
3738
  return { claude, open, gated };
3122
3739
  }
3123
3740
 
3741
+ // src/modelsCache.ts
3742
+ import { mkdir, readFile as readFile2, writeFile } from "fs/promises";
3743
+ import { homedir as homedir2 } from "os";
3744
+ import { join } from "path";
3745
+ function cachePath() {
3746
+ const base = process.env.XDG_CACHE_HOME ?? join(homedir2(), ".cache");
3747
+ return join(base, "command-code", "models.json");
3748
+ }
3749
+ async function readModelsCache() {
3750
+ try {
3751
+ const parsed = JSON.parse(await readFile2(cachePath(), "utf8"));
3752
+ if (!Array.isArray(parsed.claude) || !Array.isArray(parsed.open))
3753
+ return;
3754
+ return parsed;
3755
+ } catch {
3756
+ return;
3757
+ }
3758
+ }
3759
+ async function writeModelsCache(cache) {
3760
+ try {
3761
+ const path = cachePath();
3762
+ await mkdir(join(path, ".."), { recursive: true });
3763
+ await writeFile(path, JSON.stringify(cache));
3764
+ } catch {}
3765
+ }
3766
+ function idsDiffer(a, b) {
3767
+ if (a.length !== b.length)
3768
+ return true;
3769
+ const left = new Set(a.map((m) => m.id));
3770
+ return b.some((m) => !left.has(m.id));
3771
+ }
3772
+
3124
3773
  // src/provider/stream.ts
3125
3774
  function sseDecoder(onEvent) {
3126
3775
  let buffer = "";
@@ -3150,8 +3799,18 @@ function sseDecoder(onEvent) {
3150
3799
  var text = (v) => typeof v === "string" ? v : "";
3151
3800
  var num = (v) => typeof v === "number" && Number.isFinite(v) ? v : 0;
3152
3801
  var rec = (v) => v && typeof v === "object" ? v : {};
3153
- var TOOL_FINISH = new Set(["tool_use", "tool_calls", "tool-call", "function_call"]);
3154
- var LENGTH_FINISH = new Set(["length", "max_tokens", "max_output_tokens", "model_context_window_exceeded"]);
3802
+ var TOOL_FINISH = new Set([
3803
+ "tool_use",
3804
+ "tool_calls",
3805
+ "tool-call",
3806
+ "function_call"
3807
+ ]);
3808
+ var LENGTH_FINISH = new Set([
3809
+ "length",
3810
+ "max_tokens",
3811
+ "max_output_tokens",
3812
+ "model_context_window_exceeded"
3813
+ ]);
3155
3814
  function finishReason(raw) {
3156
3815
  const value = (raw ?? "unknown").toLowerCase();
3157
3816
  if (TOOL_FINISH.has(value))
@@ -3165,7 +3824,11 @@ function finishReason(raw) {
3165
3824
  function usageFrom(total, noCache, cacheRead, cacheWrite, output, reasoning) {
3166
3825
  return {
3167
3826
  inputTokens: { total, noCache, cacheRead, cacheWrite },
3168
- outputTokens: { total: output, text: Math.max(0, output - reasoning), reasoning }
3827
+ outputTokens: {
3828
+ total: output,
3829
+ text: Math.max(0, output - reasoning),
3830
+ reasoning
3831
+ }
3169
3832
  };
3170
3833
  }
3171
3834
  function anthropicUsage(raw) {
@@ -3261,11 +3924,23 @@ function anthropicReducer() {
3261
3924
  if (finished)
3262
3925
  return [];
3263
3926
  finished = true;
3264
- return [{ type: "finish", finishReason: last, usage: anthropicUsage(rec(event.usage)) }];
3927
+ return [
3928
+ {
3929
+ type: "finish",
3930
+ finishReason: last,
3931
+ usage: anthropicUsage(rec(event.usage))
3932
+ }
3933
+ ];
3265
3934
  }
3266
3935
  if (type === "message_stop" && !finished) {
3267
3936
  finished = true;
3268
- return [{ type: "finish", finishReason: last, usage: usageFrom(0, 0, 0, 0, 0, 0) }];
3937
+ return [
3938
+ {
3939
+ type: "finish",
3940
+ finishReason: last,
3941
+ usage: usageFrom(0, 0, 0, 0, 0, 0)
3942
+ }
3943
+ ];
3269
3944
  }
3270
3945
  return [];
3271
3946
  },
@@ -3316,7 +3991,12 @@ function openaiReducer() {
3316
3991
  buffer.closed = true;
3317
3992
  return [
3318
3993
  { type: "tool-input-end", id: buffer.id },
3319
- { type: "tool-call", toolCallId: buffer.id, toolName: buffer.name, input: buffer.input }
3994
+ {
3995
+ type: "tool-call",
3996
+ toolCallId: buffer.id,
3997
+ toolName: buffer.name,
3998
+ input: buffer.input
3999
+ }
3320
4000
  ];
3321
4001
  };
3322
4002
  const flushTools = () => {
@@ -3324,7 +4004,12 @@ function openaiReducer() {
3324
4004
  for (const [index, buffer] of tools) {
3325
4005
  if (buffer.opened && !buffer.closed) {
3326
4006
  parts.push({ type: "tool-input-end", id: buffer.id });
3327
- parts.push({ type: "tool-call", toolCallId: buffer.id, toolName: buffer.name, input: buffer.input });
4007
+ parts.push({
4008
+ type: "tool-call",
4009
+ toolCallId: buffer.id,
4010
+ toolName: buffer.name,
4011
+ input: buffer.input
4012
+ });
3328
4013
  buffer.closed = true;
3329
4014
  }
3330
4015
  tools.delete(index);
@@ -3348,7 +4033,11 @@ function openaiReducer() {
3348
4033
  reasoningId = "reasoning-0";
3349
4034
  parts.push({ type: "reasoning-start", id: reasoningId });
3350
4035
  }
3351
- parts.push({ type: "reasoning-delta", id: reasoningId, delta: reasoning });
4036
+ parts.push({
4037
+ type: "reasoning-delta",
4038
+ id: reasoningId,
4039
+ delta: reasoning
4040
+ });
3352
4041
  }
3353
4042
  const content = text(delta.content);
3354
4043
  if (content) {
@@ -3369,7 +4058,13 @@ function openaiReducer() {
3369
4058
  const index = typeof call.index === "number" ? call.index : tools.size;
3370
4059
  let buffer = tools.get(index);
3371
4060
  if (!buffer) {
3372
- buffer = { id: text(call.id) || `tool-${index}`, name: text(fn.name), input: "", opened: false, closed: false };
4061
+ buffer = {
4062
+ id: text(call.id) || `tool-${index}`,
4063
+ name: text(fn.name),
4064
+ input: "",
4065
+ opened: false,
4066
+ closed: false
4067
+ };
3373
4068
  tools.set(index, buffer);
3374
4069
  }
3375
4070
  if (text(call.id))
@@ -3379,11 +4074,23 @@ function openaiReducer() {
3379
4074
  const args = text(fn.arguments);
3380
4075
  if (!buffer.opened && buffer.name) {
3381
4076
  buffer.opened = true;
3382
- parts.push({ type: "tool-input-start", id: buffer.id, toolName: buffer.name });
4077
+ parts.push({
4078
+ type: "tool-input-start",
4079
+ id: buffer.id,
4080
+ toolName: buffer.name
4081
+ });
3383
4082
  if (buffer.input)
3384
- parts.push({ type: "tool-input-delta", id: buffer.id, delta: buffer.input });
4083
+ parts.push({
4084
+ type: "tool-input-delta",
4085
+ id: buffer.id,
4086
+ delta: buffer.input
4087
+ });
3385
4088
  } else if (args && !buffer.closed) {
3386
- parts.push({ type: "tool-input-delta", id: buffer.id, delta: args });
4089
+ parts.push({
4090
+ type: "tool-input-delta",
4091
+ id: buffer.id,
4092
+ delta: args
4093
+ });
3387
4094
  }
3388
4095
  if (!buffer.closed) {
3389
4096
  buffer.input += args;
@@ -3399,7 +4106,11 @@ function openaiReducer() {
3399
4106
  if (pending && !finished && (usage !== undefined || choices.length === 0)) {
3400
4107
  finished = true;
3401
4108
  parts.push(...closeReasoning(), ...closeText(), ...flushTools());
3402
- parts.push({ type: "finish", finishReason: pending, usage: usage ?? usageFrom(0, 0, 0, 0, 0, 0) });
4109
+ parts.push({
4110
+ type: "finish",
4111
+ finishReason: pending,
4112
+ usage: usage ?? usageFrom(0, 0, 0, 0, 0, 0)
4113
+ });
3403
4114
  }
3404
4115
  return parts;
3405
4116
  },
@@ -3407,7 +4118,11 @@ function openaiReducer() {
3407
4118
  const parts = [...closeReasoning(), ...closeText(), ...flushTools()];
3408
4119
  if (pending && !finished) {
3409
4120
  finished = true;
3410
- parts.push({ type: "finish", finishReason: pending, usage: usage ?? usageFrom(0, 0, 0, 0, 0, 0) });
4121
+ parts.push({
4122
+ type: "finish",
4123
+ finishReason: pending,
4124
+ usage: usage ?? usageFrom(0, 0, 0, 0, 0, 0)
4125
+ });
3411
4126
  }
3412
4127
  return parts;
3413
4128
  }
@@ -3480,7 +4195,10 @@ function anthropicUserContent(content, images) {
3480
4195
  const url = imageUrl(part);
3481
4196
  if (url?.startsWith("data:")) {
3482
4197
  const [head, b64] = url.slice(5).split(";base64,");
3483
- blocks.push({ type: "image", source: { type: "base64", media_type: head, data: b64 } });
4198
+ blocks.push({
4199
+ type: "image",
4200
+ source: { type: "base64", media_type: head, data: b64 }
4201
+ });
3484
4202
  }
3485
4203
  }
3486
4204
  }
@@ -3516,7 +4234,10 @@ function anthropicBody(model, prompt, options) {
3516
4234
  if (message.role === "system")
3517
4235
  continue;
3518
4236
  if (message.role === "user") {
3519
- messages.push({ role: "user", content: anthropicUserContent(message.content, options.images) });
4237
+ messages.push({
4238
+ role: "user",
4239
+ content: anthropicUserContent(message.content, options.images)
4240
+ });
3520
4241
  continue;
3521
4242
  }
3522
4243
  if (message.role === "assistant") {
@@ -3527,7 +4248,12 @@ function anthropicBody(model, prompt, options) {
3527
4248
  if (text)
3528
4249
  content.push({ type: "text", text });
3529
4250
  } else if (part.type === "tool-call" && paired.has(String(part.toolCallId))) {
3530
- content.push({ type: "tool_use", id: part.toolCallId, name: part.toolName, input: part.input ?? {} });
4251
+ content.push({
4252
+ type: "tool_use",
4253
+ id: part.toolCallId,
4254
+ name: part.toolName,
4255
+ input: part.input ?? {}
4256
+ });
3531
4257
  }
3532
4258
  }
3533
4259
  if (content.length > 0)
@@ -3550,11 +4276,22 @@ function anthropicBody(model, prompt, options) {
3550
4276
  }
3551
4277
  }
3552
4278
  const system = systemText(prompt);
3553
- const body = { model, stream: true, messages, max_tokens: capTokens(options.maxOutputTokens) };
4279
+ const body = {
4280
+ model,
4281
+ stream: true,
4282
+ messages,
4283
+ max_tokens: capTokens(options.maxOutputTokens)
4284
+ };
3554
4285
  if (system)
3555
- body.system = [{ type: "text", text: system, cache_control: { type: "ephemeral" } }];
4286
+ body.system = [
4287
+ { type: "text", text: system, cache_control: { type: "ephemeral" } }
4288
+ ];
3556
4289
  if (options.tools?.length) {
3557
- body.tools = options.tools.map((t) => ({ name: t.name, description: t.description, input_schema: t.inputSchema ?? {} }));
4290
+ body.tools = options.tools.map((t) => ({
4291
+ name: t.name,
4292
+ description: t.description,
4293
+ input_schema: t.inputSchema ?? {}
4294
+ }));
3558
4295
  }
3559
4296
  if (options.temperature !== undefined)
3560
4297
  body.temperature = options.temperature;
@@ -3572,7 +4309,10 @@ function openaiBody(model, prompt, options) {
3572
4309
  if (message.role === "system")
3573
4310
  continue;
3574
4311
  if (message.role === "user") {
3575
- messages.push({ role: "user", content: openaiUserContent(message.content, options.images) });
4312
+ messages.push({
4313
+ role: "user",
4314
+ content: openaiUserContent(message.content, options.images)
4315
+ });
3576
4316
  continue;
3577
4317
  }
3578
4318
  if (message.role === "assistant") {
@@ -3588,12 +4328,19 @@ function openaiBody(model, prompt, options) {
3588
4328
  tool_calls: calls.map((c) => ({
3589
4329
  id: c.toolCallId,
3590
4330
  type: "function",
3591
- function: { name: c.toolName, arguments: JSON.stringify(c.input ?? {}) }
4331
+ function: {
4332
+ name: c.toolName,
4333
+ arguments: JSON.stringify(c.input ?? {})
4334
+ }
3592
4335
  }))
3593
4336
  });
3594
4337
  } else if (texts.length > 0) {
3595
- messages.push({ role: "assistant", ...reasoning ? { reasoning_content: reasoning } : {}, content: texts.join(`
3596
- `) });
4338
+ messages.push({
4339
+ role: "assistant",
4340
+ ...reasoning ? { reasoning_content: reasoning } : {},
4341
+ content: texts.join(`
4342
+ `)
4343
+ });
3597
4344
  }
3598
4345
  continue;
3599
4346
  }
@@ -3607,11 +4354,20 @@ function openaiBody(model, prompt, options) {
3607
4354
  });
3608
4355
  }
3609
4356
  }
3610
- const body = { model, stream: true, messages, max_tokens: capTokens(options.maxOutputTokens) };
4357
+ const body = {
4358
+ model,
4359
+ stream: true,
4360
+ messages,
4361
+ max_tokens: capTokens(options.maxOutputTokens)
4362
+ };
3611
4363
  if (options.tools?.length) {
3612
4364
  body.tools = options.tools.map((t) => ({
3613
4365
  type: "function",
3614
- function: { name: t.name, description: t.description, parameters: t.inputSchema ?? {} }
4366
+ function: {
4367
+ name: t.name,
4368
+ description: t.description,
4369
+ parameters: t.inputSchema ?? {}
4370
+ }
3615
4371
  }));
3616
4372
  }
3617
4373
  if (options.temperature !== undefined)
@@ -3715,13 +4471,19 @@ function createCommandCode(options = {}, images = () => false) {
3715
4471
  }
3716
4472
  }
3717
4473
  });
3718
- return { stream, response: { headers: Object.fromEntries(response.headers) } };
4474
+ return {
4475
+ stream,
4476
+ response: { headers: Object.fromEntries(response.headers) }
4477
+ };
3719
4478
  },
3720
4479
  async doGenerate(callOptions) {
3721
4480
  const { stream } = await this.doStream(callOptions);
3722
4481
  const reader = stream.getReader();
3723
4482
  const content = [];
3724
- let finish = { unified: "stop", raw: "unknown" };
4483
+ let finish = {
4484
+ unified: "stop",
4485
+ raw: "unknown"
4486
+ };
3725
4487
  let usage = {
3726
4488
  inputTokens: { total: 0, noCache: 0, cacheRead: 0, cacheWrite: 0 },
3727
4489
  outputTokens: { total: 0, text: 0, reasoning: 0 }
@@ -3738,7 +4500,10 @@ function createCommandCode(options = {}, images = () => false) {
3738
4500
  else if (part.type === "reasoning-delta") {
3739
4501
  content.push({ type: "reasoning", text: String(part.delta) });
3740
4502
  } else if (part.type === "tool-input-start") {
3741
- toolsById.set(String(part.id), { name: String(part.toolName), input: "" });
4503
+ toolsById.set(String(part.id), {
4504
+ name: String(part.toolName),
4505
+ input: ""
4506
+ });
3742
4507
  } else if (part.type === "tool-input-delta") {
3743
4508
  const buffer = toolsById.get(String(part.id));
3744
4509
  if (buffer)
@@ -3769,40 +4534,8 @@ function createCommandCode(options = {}, images = () => false) {
3769
4534
  return { languageModel: model };
3770
4535
  }
3771
4536
 
3772
- // src/modelsCache.ts
3773
- import { mkdir, readFile as readFile2, writeFile } from "fs/promises";
3774
- import { homedir as homedir2 } from "os";
3775
- import { join } from "path";
3776
- function cachePath() {
3777
- const base = process.env.XDG_CACHE_HOME ?? join(homedir2(), ".cache");
3778
- return join(base, "command-code", "models.json");
3779
- }
3780
- async function readModelsCache() {
3781
- try {
3782
- const parsed = JSON.parse(await readFile2(cachePath(), "utf8"));
3783
- if (!Array.isArray(parsed.claude) || !Array.isArray(parsed.open))
3784
- return;
3785
- return parsed;
3786
- } catch {
3787
- return;
3788
- }
3789
- }
3790
- async function writeModelsCache(cache) {
3791
- try {
3792
- const path = cachePath();
3793
- await mkdir(join(path, ".."), { recursive: true });
3794
- await writeFile(path, JSON.stringify(cache));
3795
- } catch {}
3796
- }
3797
- function idsDiffer(a, b) {
3798
- if (a.length !== b.length)
3799
- return true;
3800
- const left = new Set(a.map((m) => m.id));
3801
- return b.some((m) => !left.has(m.id));
3802
- }
3803
-
3804
4537
  // src/startupLog.ts
3805
- import { mkdir as mkdir2, appendFile } from "fs/promises";
4538
+ import { appendFile, mkdir as mkdir2 } from "fs/promises";
3806
4539
  import { homedir as homedir3 } from "os";
3807
4540
  import { join as join2 } from "path";
3808
4541
  function setupTimingLine(t) {
@@ -3827,7 +4560,11 @@ var PROVIDER_BASE = "https://api.commandcode.ai/provider/v1";
3827
4560
  var INTEGRATION_ID = "command-code";
3828
4561
  var INTEGRATION_NAME = "Command Code";
3829
4562
  var LANES = [
3830
- { id: "command-code-anthropic", name: "Command Code (Anthropic)", pkg: "@opencode/ai/providers/anthropic" },
4563
+ {
4564
+ id: "command-code-anthropic",
4565
+ name: "Command Code (Anthropic)",
4566
+ pkg: "@opencode/ai/providers/anthropic"
4567
+ },
3831
4568
  {
3832
4569
  id: "command-code-openai",
3833
4570
  name: "Command Code (OpenAI)",
@@ -3838,7 +4575,13 @@ var LANES = [
3838
4575
  var TOOL_DESCRIPTION = "Fetch live Command Code plan/usage: plan name, monthly credits, 5-hour & weekly windows, billing-period summary. Pass arg='plans' for the plan comparison table only, or extra cmduse flags (e.g. '--tz +05:30 daily').";
3839
4576
  function costEntry(id) {
3840
4577
  const cost = modelCost(id);
3841
- return cost ? [{ input: cost.input, output: cost.output, cache: { read: cost.cacheRead, write: cost.cacheWrite } }] : [];
4578
+ return cost ? [
4579
+ {
4580
+ input: cost.input,
4581
+ output: cost.output,
4582
+ cache: { read: cost.cacheRead, write: cost.cacheWrite }
4583
+ }
4584
+ ] : [];
3842
4585
  }
3843
4586
  function toV2Model(m, lane) {
3844
4587
  const efforts = reasoningVariants(m.id);
@@ -3848,7 +4591,11 @@ function toV2Model(m, lane) {
3848
4591
  modelID: m.id,
3849
4592
  providerID: lane.id,
3850
4593
  name: m.name,
3851
- capabilities: { tools: true, input: [...inputModalities(m.id)], output: ["text"] },
4594
+ capabilities: {
4595
+ tools: true,
4596
+ input: [...inputModalities(m.id)],
4597
+ output: ["text"]
4598
+ },
3852
4599
  variants,
3853
4600
  time: { released: 0 },
3854
4601
  cost: costEntry(m.id),
@@ -3979,7 +4726,9 @@ var commandCodeV2 = {
3979
4726
  const arg = typeof input?.arg === "string" ? input.arg : "";
3980
4727
  const key = await credentialKey(ctx);
3981
4728
  return {
3982
- content: await runCmduse(arg, { env: key ? { CMD_API_KEY: key } : undefined })
4729
+ content: await runCmduse(arg, {
4730
+ env: key ? { CMD_API_KEY: key } : undefined
4731
+ })
3983
4732
  };
3984
4733
  }
3985
4734
  });
@@ -4032,7 +4781,11 @@ var commandCodeV2 = {
4032
4781
  logTimings(Date.now() - refreshStart, modelCount);
4033
4782
  return;
4034
4783
  }
4035
- writeModelsCache({ fetchedAt: Date.now(), claude: split.claude, open: split.open });
4784
+ writeModelsCache({
4785
+ fetchedAt: Date.now(),
4786
+ claude: split.claude,
4787
+ open: split.open
4788
+ });
4036
4789
  if (!canTransform || !idsDiffer(split.claude, appliedClaude) && !idsDiffer(split.open, appliedOpen)) {
4037
4790
  logTimings(Date.now() - refreshStart, modelCount);
4038
4791
  return;
@@ -4060,55 +4813,6 @@ var commandCodeV2 = {
4060
4813
  };
4061
4814
  }
4062
4815
  };
4063
- // package.json
4064
- var package_default = {
4065
- name: "@jeffreyjyz/opencode-command-code",
4066
- version: "0.3.13",
4067
- description: "Command Code provider + usage dashboard for opencode: two providers (Anthropic wire for Claude, OpenAI wire for everything else) against api.commandcode.ai, live model list, plan gating, /cmd-usage. Requires the cmduse CLI for usage rendering.",
4068
- type: "module",
4069
- main: "dist/index.js",
4070
- types: "dist/index.d.ts",
4071
- exports: {
4072
- ".": "./dist/index.js",
4073
- "./tui": "./dist/tui.js"
4074
- },
4075
- scripts: {
4076
- build: "rm -rf dist && bun build src/index.ts --outdir dist --target bun --external @opencode-ai/plugin --external @opencode/plugin --external @opencode/plugin/tui && bun scripts/build-tui.ts && tsc -p tsconfig.build.json",
4077
- test: "bun test",
4078
- typecheck: "tsc --noEmit",
4079
- "build:tui": "bun scripts/build-tui.ts",
4080
- "extract:catalog": "bun scripts/extract-catalog.ts"
4081
- },
4082
- dependencies: {
4083
- "@opentui/core": "^0.5.4",
4084
- "@opentui/solid": "^0.5.4",
4085
- "solid-js": "1.9.12",
4086
- zod: "4.1.8"
4087
- },
4088
- devDependencies: {
4089
- "@types/bun": "latest",
4090
- typescript: "^5",
4091
- "@opencode-ai/plugin": "*",
4092
- "@opencode/plugin": "^2.0.11",
4093
- "@ai-sdk/provider": "3.0.8"
4094
- },
4095
- files: [
4096
- "dist",
4097
- "tui.js",
4098
- "LICENSE"
4099
- ],
4100
- keywords: [
4101
- "opencode",
4102
- "command-code",
4103
- "plugin",
4104
- "provider",
4105
- "ai-sdk"
4106
- ],
4107
- license: "MIT",
4108
- publishConfig: {
4109
- access: "public"
4110
- }
4111
- };
4112
4816
 
4113
4817
  // src/index.ts
4114
4818
  var PROVIDER_NPM = `${package_default.name}@${package_default.version}`;
@@ -4142,7 +4846,10 @@ function toModelDefs(models, providerID, npm, interleaved = false) {
4142
4846
  capabilities: {
4143
4847
  ...MODEL_CAPABILITIES,
4144
4848
  interleaved,
4145
- ...supportsImage(m.id) ? { attachment: true, input: { ...MODEL_CAPABILITIES.input, image: true } } : {}
4849
+ ...supportsImage(m.id) ? {
4850
+ attachment: true,
4851
+ input: { ...MODEL_CAPABILITIES.input, image: true }
4852
+ } : {}
4146
4853
  },
4147
4854
  cost: costFor(m.id),
4148
4855
  limit: { context: m.contextLength || 128000, output: 32000 },
@@ -4184,7 +4891,11 @@ var CommandCodePlugin = async (_input) => {
4184
4891
  const me = await whoami(key);
4185
4892
  if (!me.success)
4186
4893
  return { type: "failed" };
4187
- return { type: "success", key, provider: "command-code-anthropic" };
4894
+ return {
4895
+ type: "success",
4896
+ key,
4897
+ provider: "command-code-anthropic"
4898
+ };
4188
4899
  } catch {
4189
4900
  return { type: "failed" };
4190
4901
  }
@@ -4208,7 +4919,9 @@ var CommandCodePlugin = async (_input) => {
4208
4919
  }
4209
4920
  }
4210
4921
  const claudeDefs = split ? toModelDefs(split.claude, "command-code-anthropic", PROVIDER_NPM) : {};
4211
- const openDefs = split ? toModelDefs(split.open, "command-code-openai", PROVIDER_NPM, { field: "reasoning_content" }) : {};
4922
+ const openDefs = split ? toModelDefs(split.open, "command-code-openai", PROVIDER_NPM, {
4923
+ field: "reasoning_content"
4924
+ }) : {};
4212
4925
  const userAnthropic = existing("command-code-anthropic");
4213
4926
  cfg.provider["command-code-anthropic"] = {
4214
4927
  npm: userAnthropic.npm ?? PROVIDER_NPM,