opencode-model-toggleQuick model switching for OpenCode via editor hotkeys
GitHub 星标
0
月装机量
19
近 7 天 3
综合评分SCORE
16.2
生态多维模型
最近提交
7 个月前
2026-01-14
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-model-toggle@1.0.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-model-toggle@1.0.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-model-toggleopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
README.md
查看原始文件→Quick model switching for OpenCode via editor hotkeys. Cycle between your 3 favorite models with a single keystroke instead of navigating the /models menu.
Quick Start
Installation (LLM-assisted)
Paste this into any LLM agent:
Install the opencode-model-toggle plugin by following: https://raw.githubusercontent.com/cloudboy-jh/opencode-mode-toggle/main/README.md
Installation (Manual)
npm install -g opencode-model-toggle
Add to ~/.config/opencode/opencode.json:
{ "plugin": ["opencode-model-toggle"] }
Restart OpenCode and run:
/model-toggle setup
Commands
/m # Cycle to next model
/model-toggle # Same as /m
/model-toggle show # Display rotation
/model-toggle set 2 # Jump to model #2
/model-toggle setup # Reconfigure
/model-toggle reset # Restore defaults
Configuration
Config file: ~/.config/opencode/model-toggle.json
{
"models": [
"claude-sonnet-4.5",
"gemini-2.0-flash-exp",
"claude-haiku-4.5"
],
"currentIndex": 0,
"version": "1.0.0"
}
Editor Hotkeys
Zed (~/.config/zed/keymap.json)
{
"bindings": {
"cmd+shift+m": ["task::Spawn", {
"task_name": "Model Toggle",
"command": "opencode",
"args": ["run", "/m"]
}]
}
}
VS Code / Cursor (keybindings.json)
{
"key": "cmd+shift+m",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "opencode run '/m'\n" }
}
Development
bun install
bun run dev
bun run build
bun run dev:test
License
MIT