用一百来行代码写了个 claude code 模型渠道切换工具 Code Switch ,欢迎使用反馈 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
onewesong
V2EX    分享创造

用一百来行代码写了个 claude code 模型渠道切换工具 Code Switch ,欢迎使用反馈

  •  
  •   onewesong 24 天前 1370 次点击

    一个精简而强大的配置切换工具,通过硬链接 + Git 分支的巧妙组合,让您在不同 AI 服务提供商和模型之间实现快速切换配置。

    一键安装

    curl -sSL https://raw.githubusercontent.com/onewesong/code-switch/refs/heads/master/code-switch.sh -o /usr/bin/code-switch && chmod +x /usr/bin/code-switch && code-switch 

    demo 源码: https://github.com/onewesong/code-switch

    4 条回复    2025-11-30 14:29:03 +08:00
    zisen
        1
    zisen  
       24 天前
    claude code router 可以在 cc 交互界面切换模型但是依赖 nodejs ,公司服务器不让装 nodejs 的情况下用这个 code switch 感觉方便些,等周一上班去试试效果
    maemolee
        2
    maemolee  
       23 天前
    我自己也写了好几个,cc 用一个,codex 用一个(但是用不上),其他 python 脚本用一个。
    jayin
        3
    jayin  
       23 天前
    我比较土,直接搞 alias cc-glm='ANTHROPIC_BASE_URL=xxx ANTHROPIC_AUTH_TOKEN=xxx claude --model glm-4.6'

    cc-glm 就切换到 glm ,是不是更省事?
    onewesong
        4
    onewesong  
    OP
       22 天前
    @jayin 我最开始也是用的你说的这个方式

    但后来觉得添加模型/渠道改别名设环境变量太麻烦

    另外像 vscode 点击 claude code 的图标自动进入的 claude 还是使用的 settings 下配置

    所以才写了 code switch 这个工具方便管理和切换
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2275 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 23ms UTC 16:06 PVG 00:06 LAX 08:06 JFK 11:06
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86