kimi-video-plugin
v1.0.7
Published
OpenCode plugin for video analysis using Kimi AI
Maintainers
Readme
OpenCode Kimi Video Plugin
An OpenCode plugin that enables video file analysis using Kimi AI.
Features
- 🤖 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
Requirements
Quick Start
1. Install Kimi CLI
# macOS (with Homebrew)
brew install --cask kimi
# Or download from https://kimi.comVerify installation:
which kimi
# Should output: /usr/local/bin/kimi (or similar)2. Install the Plugin
Option A: From NPM (when published)
Add to your project's opencode.json:
{
"plugins": [
"kimi-video-plugin"
]
}Option B: Local Development
Clone and link locally:
# 1. Clone the repository
git clone https://github.com/mastertyko/opencode-kimivideo.git
cd opencode-kimivideo
# 2. Install dependencies
bun install
# 3. Link for local development
bun link
# 4. In your project directory, link the plugin
bun link kimi-video-pluginOption C: Copy to OpenCode Plugins
# 1. Clone
git clone https://github.com/mastertyko/opencode-kimivideo.git
# 2. Copy to OpenCode's plugin directory
cp -r opencode-kimivideo ~/.opencode/plugins/kimi-video-plugin3. Use It
Start OpenCode in your project:
opencodeThen simply ask:
Analysera video ./my-video.mp4Or:
Analyze this video: /path/to/movie.mkv and tell me about the main charactersUsage Examples
Basic Analysis
Analysera video ./my-video.mp4Custom Prompt
Analysera video ./film.mp4 med fokus på färgkorrigering och ljussättningMultiple Videos
Analysera alla videos i ./videos/ mappenSupported 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:
- OpenCode detects the video file path in your message
- Plugin validates the file exists and format is supported
- Kimi CLI runs in the background:
kimi --print -y -p "analysera videon /path/to/video.mp4" - Kimi processes the video:
- Extracts metadata (duration, resolution, codec)
- Generates keyframes at regular intervals
- Analyzes each frame with vision AI
- Results returned as a comprehensive text analysis
Development
Setup
git clone https://github.com/mastertyko/opencode-kimivideo.git
cd opencode-kimivideo
bun installRunning Tests
bun testProject Structure
.
├── 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.mdCreating a Test Video
Don't have a video handy? Create a quick test file:
# With ffmpeg (creates 5-second test video)
ffmpeg -f lavfi -i testsrc=duration=5:size=640x480:rate=30 test-video.mp4Troubleshooting
"Kimi CLI not found"
# Verify Kimi is installed
which kimi
# If not found, reinstall:
brew install --cask kimi
# Or add to PATH if installed but not found:
export PATH="$PATH:/Applications/Kimi.app/Contents/MacOS""Error: File not found"
- Use absolute paths:
/Users/name/video.mp4instead of~/video.mp4 - Ensure the file has read permissions:
chmod +r video.mp4 - Try relative paths from your current directory:
./video.mp4
Analysis Times Out
- Large files (>1GB) may take 3-5 minutes
- Check your internet connection (Kimi uses cloud processing)
- Try with a smaller video file first
Plugin Not Loading
# Check OpenCode's plugin list
opencode plugins list
# Verify plugin is installed
ls ~/.opencode/plugins/
# Restart OpenCode
opencode restartLicense
MIT
Contributing
Pull requests welcome! Please ensure tests pass:
bun test