OpenCode plugin for video analysis using Kimi AI
npm install kimi-video-plugin
An OpenCode plugin that enables video file analysis using Kimi AI.
- π€ Auto-detection of video files in chat messages
- π¬ Support for multiple formats: MP4, MOV, AVI, WEBM, MKV
- π Explicit video analysis commands
- β‘ Non-interactive Kimi CLI integration
- OpenCode installed
- Kimi CLI installed and available in PATH
``bashmacOS (with Homebrew)
brew install --cask kimi
Verify installation:
`bash
which kimi
Should output: /usr/local/bin/kimi (or similar)
`$3
#### Option A: From NPM (when published)
Add to your project's
opencode.json:`json
{
"plugins": [
"kimi-video-plugin"
]
}
`#### Option B: Local Development
Clone and link locally:
`bash
1. Clone the repository
git clone https://github.com/mastertyko/opencode-kimivideo.git
cd opencode-kimivideo2. Install dependencies
bun install3. Link for local development
bun link4. In your project directory, link the plugin
bun link kimi-video-plugin
`#### Option C: Copy to OpenCode Plugins
`bash
1. Clone
git clone https://github.com/mastertyko/opencode-kimivideo.git2. Copy to OpenCode's plugin directory
cp -r opencode-kimivideo ~/.opencode/plugins/kimi-video-plugin
`$3
Start OpenCode in your project:
`bash
opencode
`Then simply ask:
`
Analysera video ./my-video.mp4
`Or:
`
Analyze this video: /path/to/movie.mkv and tell me about the main characters
`Usage Examples
$3
`
Analysera video ./my-video.mp4
`$3
`
Analysera video ./film.mp4 med fokus pΓ₯ fΓ€rgkorrigering och ljussΓ€ttning
`$3
`
Analysera alla videos i ./videos/ mappen
`Supported Formats
| Format | Extension | Notes |
|--------|-----------|-------|
| MP4 |
.mp4 | MPEG-4 Part 14 - Most common |
| MOV | .mov | QuickTime - Apple devices |
| AVI | .avi | Audio Video Interleave |
| WebM | .webm | Web-optimized format |
| MKV | .mkv | Matroska - High quality |How It Works
When you request a video analysis:
1. OpenCode detects the video file path in your message
2. Plugin validates the file exists and format is supported
3. Kimi CLI runs in the background:
`bash
kimi --print -y -p "analysera videon /path/to/video.mp4"
`
4. Kimi processes the video:
- Extracts metadata (duration, resolution, codec)
- Generates keyframes at regular intervals
- Analyzes each frame with vision AI
5. Results returned as a comprehensive text analysisDevelopment
$3
`bash
git clone https://github.com/mastertyko/opencode-kimivideo.git
cd opencode-kimivideo
bun install
`$3
`bash
bun test
`$3
`
.
βββ src/
β βββ index.ts # Plugin entry point (exports Plugin function)
β βββ utils/
β βββ kimi-cli.ts # Kimi CLI wrapper
β βββ video-detection.ts # Video file detection
βββ .opencode/
β βββ commands/
β βββ analyze_video.json # Command discovery for OpenCode
βββ index.ts # Main export (re-exports from src/index)
βββ package.json
βββ README.md
`$3
Don't have a video handy? Create a quick test file:
`bash
With ffmpeg (creates 5-second test video)
ffmpeg -f lavfi -i testsrc=duration=5:size=640x480:rate=30 test-video.mp4
`Troubleshooting
$3
`bash
Verify Kimi is installed
which kimiIf not found, reinstall:
brew install --cask kimiOr add to PATH if installed but not found:
export PATH="$PATH:/Applications/Kimi.app/Contents/MacOS"
`$3
- Use absolute paths:
/Users/name/video.mp4 instead of ~/video.mp4
- Ensure the file has read permissions: chmod +r video.mp4
- Try relative paths from your current directory: ./video.mp4$3
- Large files (>1GB) may take 3-5 minutes
- Check your internet connection (Kimi uses cloud processing)
- Try with a smaller video file first
$3
`bash
Check OpenCode's plugin list
opencode plugins listVerify plugin is installed
ls ~/.opencode/plugins/Restart OpenCode
opencode restart
`License
MIT
Contributing
Pull requests welcome! Please ensure tests pass:
`bash
bun test
``