Introduction

The plugin-based architecture of DeepSeek Harness (DSH) allows developers to extend its model toolset. The dsh-grok-image plugin is designed to meet the need for directly using Grok Imagine to generate images within a DSH environment. It registers the capabilities of Grok Imagine subscription endpoints as the standard DSH model tool image_gen, making agent development and orchestration easier.

Plugin Overview

This plugin is maintained by user clarkzhao and follows the MIT license. It was developed for DSH version 0.1.7-rc.2, with its main feature being integration of Grok Imagine’s image generation capabilities into the DSH ecosystem.

Core Features

  1. Tool registration: Registers Grok Imagine as the DSH model tool image_gen.
  2. API calls: Uses the Grok subscription endpoint https://cli-chat-proxy.grok.com/v1/images/generations.
  3. Model configuration: Supports the grok-imagine-image-quality model and allows configuration.
  4. Aspect ratio control: Supports multiple image aspect ratios: auto, 1:1, 16:9, 9:16, 3:2, 2:3.
  5. Inline and on-disk output:
    • inline_image is enabled by default, inserting images inline into the conversation.
    • Generation results are written to the DSH attachment service, supporting direct rendering in the Web UI.
    • They are also saved on the local outputDir (default: ~/grok-images).
  6. Usage logging: Usage is recorded in usage.log.jsonl.
  7. AIRP support (optional): If dsh-airp is installed, generated images can be mounted to /airp-media, and the tool response returns an absolute URL, supporting Markdown rendering.

Installation and Enablement

Install the plugin using the DSH CLI:

dsh plugin --profile web add dsh-grok-image

After installation, the bundle is written to grok-image and the image_gen tool is registered. A DSH process restart is required after installation for the changes to take effect.

Configuration Example

Add the following content to the DSH configuration file:

- id: grok-image
  name: dsh-grok-image
  config:
    baseURL: https://cli-chat-proxy.grok.com/v1
    apiKeyEnv: GROK_SESSION_TOKEN
    proxy: http://127.0.0.1:7890
    model: grok-imagine-image-quality
    outputDir: ~/Workspace/grok-images
    usageLog: true

Note: Credentials are read from the environment variable GROK_SESSION_TOKEN. If not automatically synchronized, refer to the dsh-llm-grok documentation to attach the Grok CLI token to DSH.

Usage Limitations

  1. Feature scope: Currently only image_gen is implemented; image_edit (image-to-image) and video_gen are not implemented.
  2. User permissions: Image generation depends on Grok subscription endpoints. Free or X Basic users may encounter zero-quota limits (this is a SuperGrok-exclusive capability).
  3. Performance and timeout: Generation can take 1–2 minutes, and the tool timeout is set to 300 seconds.
  4. Model compatibility: If the current model adapter does not support image content (for example, deepseek), set inline_image to false; the tool will only return the saved path.

Conclusion

The dsh-grok-image plugin provides a standard entry point for integrating Grok Imagine capabilities into the DSH ecosystem. For agent development scenarios that require advanced image generation, it is a directly usable tool.

  • Repository URL: https://github.com/clarkzhao/dsh-grok-image
  • Directory page: https://www.skillhub.cn/plugins/clarkzhao/dsh-grok-image