# opencode-multi-model Launch multiple AI models in tmux sessions. Available as: - OpenCode Plugin - Standalone CLI - Project-level tool ## Installation ### As OpenCode Plugin Add to your OpenCode config (`opencode.json`): ```json { "plugin": ["opencode-multi-model"] } ``` ### As Standalone CLI ```bash # Using bunx (no install) bunx opencode-multi-model open my-session -m openai/gpt-5.2 anthropic/claude-3-5-sonnet # Or install globally bun install -g opencode-multi-model opencode-multi-model open my-session -m openai/gpt-5.2 ``` ### As Project Tool If you installed it via bun and want to use it as a project tool, import it from the package: ```typescript // .opencode/tools/multi-model.ts import { openTool as open, closeTool as close } from "opencode-multi-model" export { open, close } ``` If you are developing this package locally and want to test it in a project without publishing, import via relative paths: ```typescript // .opencode/tools/multi-model.ts import { openTool } from "../../src/tools/open" import { closeTool } from "../../src/tools/close" export { openTool as open, closeTool as close } ``` ## Usage ### Plugin Usage **Open a session:** ``` Use multi-model-open tool: sessionName: my-session, models: ["openai/gpt-5.2", "anthropic/claude-3-5-sonnet"] ``` **Close a session (using tool):** ``` call tool multi-model-close with sessionName: my-session ``` **Close a session (using manual command):** ```bash tmux kill-session -t my-session && rm -rf ~/.local/share/opencode/multi-model/my-session && git worktree prune && git branch -D $(git branch --format='%(refname:short)' --list 'opencode/my-session/*') ``` ### CLI Usage **Open a session:** ```bash # Basic usage opencode-multi-model open my-session -m openai/gpt-5.2 anthropic/claude-3-5-sonnet # With custom binary (via flag) opencode-multi-model open my-session -m openai/gpt-5.2 -b kilo # With custom binary (via env) export OPENCODE_MULTI_MODEL_BINARY=kilo opencode-multi-model open my-session -m openai/gpt-5.2 ``` **Close a session (CLI command):** ```bash # Close and cleanup worktrees opencode-multi-model close my-session ``` **Close a session (manual command):** ```bash tmux kill-session -t my-session && rm -rf ~/.local/share/opencode/multi-model/my-session && git worktree prune && git branch -D $(git branch --format='%(refname:short)' --list 'opencode/my-session/*') ``` **Help:** ```bash opencode-multi-model --help opencode-multi-model open --help opencode-multi-model close --help ``` ## Configuration ### Custom Binary By default uses `opencode`. To use `kilo` instead: **Via environment variable:** ```bash export OPENCODE_MULTI_MODEL_BINARY=kilo ``` **Via CLI flag:** ```bash opencode-multi-model open my-session -m openai/gpt-5.2 -b kilo ``` Priority: CLI flag > Environment variable > Default ("opencode") ## Requirements - tmux - git - opencode or kilo binary - Bun runtime ## Development For local development and testing without publishing: ```bash # Install dependencies bun install # Build bun run build # Run tests bun test # Test CLI locally bun dist/cli.js open test-session -m openai/gpt-5.2 bun dist/cli.js close test-session ``` ## Architecture ``` ├── src/ │ ├── index.ts # Plugin entry point │ ├── cli.ts # CLI entry point │ ├── types.ts # Shared TypeScript types │ ├── core/ │ │ ├── index.ts # Core exports │ │ ├── open.ts # Launch session logic │ │ ├── close.ts # Close session logic │ │ └── utils.ts # Helper functions │ └── tools/ │ ├── open.ts # Open tool definition │ └── close.ts # Close tool definition ├── tests/ │ └── multi-model.test.ts # Tests ├── package.json ├── tsconfig.json └── README.md ``` ## Local code coverage The test suite can generate a coverage report locally. ```bash # Run tests with coverage (HTML report generated in ./coverage) npm run coverage # or: bun run coverage # Open the HTML report open coverage/index.html # macOS ``` The `coverage` directory is ignored by Git but can be inspected to see which lines are exercised. ## License MIT