- ホーム
- プラグイン
- ビジョン、音声とマルチモーダル
- dsh-mimo-video
dsh-mimo-video
vainhappy/dsh-mimo-video
Adds a mimo_video tool that sends video, audio, or images to Xiaomi MiMo and returns a text answer, reusing a provider from Settings > Models.
インストール
dsh plugin --profile web add github:vainhappy/dsh-mimo-videoREADME
dsh-mimo-video
Video understanding for DeepSeek Harness, powered by Xiaomi MiMo's video API.
The agent passes a video and a question; MiMo samples frames, watches it, and answers in text. There is also a Settings → MiMo video page for the call recipe.
中文说明见 README.zh.md。
What it adds
| Tool | mimo_video — one video plus one question in, a written answer out |
| Settings page | Model id, endpoint, frame rate, resolution tier, timeout, size cap |
| Credential | Resolved from DSH credentials, then the environment — never stored in config |
Install
dsh plugin --profile web add @vainhappy/dsh-mimo-video
Or from the DSH GUI: Plugins → Add plugin, and paste the package name.
Then open Settings → MiMo video and confirm the API-key badge is green. If it is not, store a MiMo key first — see Credentials below.
Use
Just ask, in chat:
Summarise this video https://cdn.example.com/demo.mp4
Describe what happens in /path/to/clip.mp4
Or the agent may call the tool directly:
{
"video": "https://cdn.example.com/demo.mp4",
"question": "Summarise with approximate timestamps.",
"fps": 3,
"media_resolution": "max"
}
Video requirements
Direct media links only. The URL must serve the video bytes, not a page that plays them. A video-site watch page (Bilibili, YouTube, …), a cloud-drive preview, or an SPA player returns HTML, and the provider receives no video at all. Resolve such a page to its real media URL first.
Video: MP4, MOV, AVI, WMV. Audio: MP3, WAV, FLAC, M4A, OGG. Image: JPEG, PNG, GIF, WebP, BMP.
For audio and image files, fps and media_resolution are ignored.
Size — the two routes differ:
| Local file | Public URL | |
|---|---|---|
| How it travels | base64 in the request body | the provider downloads it |
| Inflation | 4/3 (×1.33) | none |
| Limit | 37.5 MB original | Video 300 MB / Audio 100 MB / Image 50 MB |
| Checked by | this plugin, before sending | MiMo's server |
Base64 encodes every 3 bytes into 4 characters, so the encoded string is exactly 4/3 the file size; MiMo caps that string at 50 MB, which puts the hard ceiling for a local file at 37.5 MB. The plugin's own default cap is 35 MB, which leaves a little headroom.
Asking for a useful answer
Only text comes back, and timestamps are not included by default:
- ask for them explicitly (
with approximate timestamps) - state the shape you need (a list, N points, per-scene)
- audio is not transcribed unless you ask
- the call is synchronous and can take tens of seconds
The two knobs that matter
| Parameter | Range | Default | When to raise it |
|---|---|---|---|
fps | 0.1 – 10 | 2 | fast motion, ordering, timing detail |
media_resolution | default / max | default | small text, small objects, fine texture |
Both raise token cost.
Credentials
MiMo issues a different Base URL and key per account region, and they do not interoperate:
| Plan | Key format | Endpoint |
|---|---|---|
| Token Plan | tp-xxxxx / ttp-xxxxx | https://token-plan-{cn,sgp,ams}.xiaomimimo.com/v1 |
| Pay as you go | sk-… | https://api.xiaomimimo.com/v1 |
A Token Plan key sent to the pay-as-you-go host returns 401 Invalid API Key.
When a provider is selected, the plugin reads only that provider's own credential reference — it never falls back to another account's key. This ensures you cannot accidentally spend a subscription you did not pick.
Without a provider (flat-field mode via config file), the lookup order is:
- The configured
apiKeyEnvreference XIAOMI_TOKEN_PLAN_CN_API_KEY,XIAOMI_TOKEN_PLAN_SGP_API_KEY,XIAOMI_TOKEN_PLAN_AMS_API_KEYMIMO_API_KEY,XIAOMI_API_KEY
Each is resolved through DSH credentials first, then the process environment, then .env.
Reusing a provider from Settings > Models
If your MiMo account is already configured on Settings > Models (for example both xiaomi and
xiaomi-token-plan-cn), you do not need to enter the key again: the Model provider dropdown on
Settings > MiMo video lists every MiMo-related provider, and the selected one supplies both its
credential and its endpoint.
Switching providers takes effect on the next call. If the chosen provider has no API key yet, the error names it, so you know exactly where to fix it.
The dropdown only lists MiMo providers already configured on Settings > Models. Selecting one reuses its credential and endpoint entirely.
Multiple accounts or subscriptions
Add a separate provider for each MiMo account on Settings > Models (e.g. xiaomi-token-plan-cn,
xiaomi-token-plan-sgp), then switch between them in the Settings > MiMo video dropdown. Each
provider's credential and endpoint are independent and never cross-used.
Advanced: the
accountsandactiveAccountfields can still be edited manually in the config file for setups that need plugin-local account management. The UI no longer exposes them; using providers from Settings > Models is recommended.
MiMo also offers an Anthropic-protocol endpoint and a Batch API; neither accepts video, so this plugin uses the OpenAI-compatible protocol only.
Configuration
Every field is live, so settings apply to the next call without a restart.
| Field | Default | Meaning |
|---|---|---|
model | mimo-v2.6-flash | MiMo model id (mimo-v2.6-flash, mimo-v2.6-pro, mimo-v2.6-pro-ultraspeed) |
baseURL | Token Plan CN host | Endpoint; /chat/completions is appended |
apiKeyEnv | XIAOMI_TOKEN_PLAN_CN_API_KEY | Credential reference |
fps | 2 | Default frames per second, 0.1–10 |
mediaResolution | default | default or max |
timeoutSeconds | 600 | This plugin's own budget, not a MiMo limit (1–3600) |
maxLocalMegabytes | 35 | Pre-flight cap for local files (max 37) |
Token estimation
The plugin uses the official MiMo formula to estimate video token cost. The usage.videoTokens and usage.audioTokens in the result are actual values reported by the API.
Factors:
- duration × fps → frame count (capped at 2048)
- resolution + media_resolution → tokens per frame (default caps at 300/frame)
- audio ≈ duration(s) × 6.25 tokens
If the estimate exceeds 100k tokens, consider lowering fps/resolution or splitting into shorter segments.
Timestamp precision
Accuracy depends on fps: at fps=2 each frame covers 0.5s, so timestamps are approximate to ±0.5s. At fps<1 the error exceeds 1 second. For precise alignment, raise fps or analyse shorter excerpts.
Errors
| Code | Meaning |
|---|---|
MIMO_VIDEO_NOT_FOUND / MIMO_VIDEO_NOT_FILE | The local path is missing or is not a file |
MIMO_VIDEO_UNSUPPORTED_FORMAT | Format not in the supported video/audio/image list |
MIMO_VIDEO_TOO_LARGE | Above a size limit — compress, or use a URL |
MIMO_VIDEO_MISSING_CREDENTIAL | No API key found |
MIMO_VIDEO_PROVIDER_ERROR | Non-2xx from MiMo; 401/403 usually means key and endpoint disagree; moderation rejections suggest retry / lower fps / split |
MIMO_VIDEO_NETWORK | Network error, usually transient — retry |
MIMO_VIDEO_EMPTY_RESPONSE | No text answer — rephrase and retry |
MIMO_VIDEO_INVALID_ARGS | Bad fps or media_resolution |
Concurrency and moderation
Each call is an independent HTTP request and the tool is marked concurrency-safe: analysing several segments or images can be issued in parallel rather than queued serially.
MiMo runs server-side content moderation and may reject some inputs (e.g. "high risk"). The API gives no frame or category detail, and sampling is partly random — a retry may pass; otherwise lower fps to resample, or split the clip and analyse a shorter segment.
Privacy
Videos and questions are sent to Xiaomi's servers for analysis. With the plugin disabled, the tool disappears and no video leaves the machine.
Development
The package is plain ESM with no build step:
src/index.js entry: resolves the Host's shared packages, exports apply + Config
src/runtime.js tool implementation and the Config schema
src/client.js the Settings page (browser module)
cordis.patch.yml the bundle patch
runtime.js must stay a static import of index.js: HMR builds its reload graph from Node's
static link table, so a dynamic import() would hide the edge and editing it would never reload
the plugin.
Check syntax with node --check src/*.js. There is no test suite yet.
License
MIT