The philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” The dsh-plugin-grok plugin introduced in this article is a developer preview plugin that uses the local Grok Build CLI to provide text, image, and video generation capabilities for models. It does not call Imagine via raw HTTP requests; instead, it directly executes the local grok binary.

Plugin Overview

  • Plugin Name: dsh-plugin-grok
  • Maintainer: toolazytoname
  • Category: Model Inference
  • License: MIT
  • Core Value: Exposes the local Grok Build CLI as a DSH tool, supporting text, image, and video generation.

Installation and Enabling

Install the plugin under the web profile:

dsh plugin --profile web add github:toolazytoname/dsh-plugin-grok

After installation, restart dsh web and force refresh the browser.

If pnpm version >= 10 blocks the git prepare script, you can allow the build in the corresponding profile configuration:

# 在 ~/.dsh/profiles/web/pnpm-workspace.yaml
allowBuilds:
  dsh-plugin-grok: true

Or install directly from a local checkout directory:

dsh plugin --profile web add /absolute/path/to/dsh-plugin-grok

Prerequisites

The following conditions must be met before using this plugin:

  1. Local Environment: Install Grok Build CLI and ensure the grok command is available in PATH (usually located at ~/.grok/bin/grok).
  2. Authentication Method: Provide one of the following (official CLI priority is as follows):
    • grok login: A SuperGrok or grok.com session, which is written to ~/.grok/auth.json. If both are present, this method takes priority.
    • XAI_API_KEY: An API key obtained from console.x.ai.
  3. Network Proxy: When using the plugin in mainland China, set the environment variable https_proxy or HTTPS_PROXY (for example, the Clash mixed port http://127.0.0.1:7891); the plugin forwards these variables.

Core Features

This plugin exposes three tools to the model:

  • grok_ask: For text tasks, including code review, planning, and writing. It calls grok --prompt-file … --always-approve under the hood.
  • grok_imagine_image: For generating or editing still images. It calls grok and restricts the tool set to image_gen and image_edit.
  • grok_imagine_video: For generating video clips. It calls grok and restricts the tool set to image_gen and image_to_video. Grok does not natively support text-to-video generation; this plugin implements it by first generating a still image and then converting it to video.

All operations will fail if grok is missing, no authentication is provided, the prompt is empty, the command exits with a non-zero code, or the media path cannot be resolved after the media run.

Typical Usage

You can test the plugin status and features via the CLI:

# 查看插件状态
npx dsh-plugin-grok status

# 文本生成
npx dsh-plugin-grok ask "summarize this repo"

# 图像生成
npx dsh-plugin-grok image "a red cube on a table" --ratio 1:1

# 视频生成
npx dsh-plugin-grok video "slow cinematic push-in" --duration 6 --resolution 480p

Notes and Limitations

  • Quota Consumption: Users who use grok login consume SuperGrok/coding-plan quota; users who use an API key consume console credits.
  • Generation Speed: Image and video generation are relatively slow.
  • Video Generation Mechanism: Videos are generated by first creating still frames and then animating them, rather than being natively text-to-video.
  • Process Isolation: Each tool call starts a local grok process and does not use ACP or the grok agent stdio wrapper.
  • Development Status: DeepSeek Harness is in developer preview; Cordis’s apply + ctx.tools.register interface may change.
  • License: MIT License.

References