mirror of
https://github.com/bendtherules/opencode-multi-model.git
synced 2026-08-18 13:42:21 +00:00
169 lines
3.6 KiB
Markdown
169 lines
3.6 KiB
Markdown
# 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": ["@username/opencode-multi-model"]
|
|
}
|
|
```
|
|
|
|
### As Standalone CLI
|
|
|
|
```bash
|
|
# Using npx (no install)
|
|
npx @username/opencode-multi-model open my-session -m openai/gpt-4o anthropic/claude-3-5-sonnet
|
|
|
|
# Or install globally
|
|
npm install -g @username/opencode-multi-model
|
|
opencode-multi-model open my-session -m openai/gpt-4o
|
|
```
|
|
|
|
### As Project Tool
|
|
|
|
If you installed it via NPM and want to use it as a project tool, import it from the package:
|
|
|
|
```typescript
|
|
// .opencode/tools/multi-model.ts
|
|
import { openTool, closeTool } from "@username/opencode-multi-model"
|
|
export { openTool, closeTool }
|
|
```
|
|
|
|
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, closeTool }
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Plugin Usage
|
|
|
|
**Open a session:**
|
|
```
|
|
Use multi-model-open tool:
|
|
sessionName: my-session, models: ["openai/gpt-4o", "anthropic/claude-3-5-sonnet"]
|
|
```
|
|
|
|
**Close a session:**
|
|
```
|
|
Use multi-model-close tool:
|
|
sessionName: my-session, cleanupWorktrees: true
|
|
```
|
|
|
|
### CLI Usage
|
|
|
|
**Open a session:**
|
|
```bash
|
|
# Basic usage
|
|
opencode-multi-model open my-session -m openai/gpt-4o anthropic/claude-3-5-sonnet
|
|
|
|
# With custom binary (via flag)
|
|
opencode-multi-model open my-session -m openai/gpt-4o -b kilo
|
|
|
|
# With custom binary (via env)
|
|
export OPENCODE_MULTI_MODEL_BINARY=kilo
|
|
opencode-multi-model open my-session -m openai/gpt-4o
|
|
```
|
|
|
|
**Close a session:**
|
|
```bash
|
|
# Just close the tmux session
|
|
opencode-multi-model close my-session
|
|
|
|
# Close and cleanup worktrees
|
|
opencode-multi-model close my-session --cleanup-worktrees
|
|
|
|
# Force cleanup without confirmation
|
|
opencode-multi-model close my-session --cleanup-worktrees --force
|
|
```
|
|
|
|
**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-4o -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-4o
|
|
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
|
|
│ │ ├── launch.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
|
|
```
|
|
|
|
## License
|
|
|
|
MIT
|