爱意满满的作品展示区。
onewesong

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

  •  
  •   onewesong · Nov 28, 2025 · 2241 views
    This topic created in 178 days ago, the information mentioned may be changed or developed.

    一个精简而强大的配置切换工具,通过硬链接 + 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 replies    2025-11-30 14:29:03 +08:00
    zisen
        1
    zisen  
       Nov 28, 2025
    claude code router 可以在 cc 交互界面切换模型但是依赖 nodejs ,公司服务器不让装 nodejs 的情况下用这个 code switch 感觉方便些,等周一上班去试试效果
    maemolee
        2
    maemolee  
       Nov 29, 2025
    我自己也写了好几个,cc 用一个,codex 用一个(但是用不上),其他 python 脚本用一个。
    jayin
        3
    jayin  
       Nov 29, 2025
    我比较土,直接搞 alias cc-glm='ANTHROPIC_BASE_URL=xxx ANTHROPIC_AUTH_TOKEN=xxx claude --model glm-4.6'

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

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

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

    所以才写了 code switch 这个工具方便管理和切换
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3179 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 13:31 · PVG 21:31 · LAX 06:31 · JFK 09:31
    ♥ Do have faith in what you're doing.