Introduction

When using text models in DeepSeek Harness (DSH), a common issue arises: the model itself only supports text input, but users still want to attach images to the session and have the model continue answering based on the text in the images.

If you don’t want to send image bytes directly to the model API and don’t want to modify the model’s input modalities, you can perform local OCR first and then send the recognized text to the model. dsh-tesseract-ocr is a DSH plugin provided for this purpose.

What is this

dsh-tesseract-ocr is a DeepSeek Harness plugin, repository identifier maxwell-feng/dsh-tesseract-ocr, license MIT.

Its purpose is to allow text models to accept attached images. The plugin calls Tesseract OCR locally to recognize images, and by default, it only sends the recognized text to the model API.

It is suitable for scenarios where DSH is used, the text model is expected to handle image attachments, and it is desired to keep original image bytes locally by default without sending them to the model provider.

Core Capabilities

dsh-tesseract-ocr provides the following capabilities:

  • Allows text models to accept attached images.
  • Uses Tesseract OCR to recognize attached images locally.
  • By default, only the recognized text is sent to the model API.
  • By default, image bytes are kept locally and not sent to the model provider.
  • Provides optional visual model passthrough: passthrough: true.
  • Adopts a fail-closed behavior when the plugin is not loaded, rejecting image attachments.
  • Can work with providers/models in DSH without requiring modifications to the model’s input modalities.

Installation and Enablement

1. Prepare Tesseract

The plugin relies on the local tesseract CLI. The following example installs Tesseract and the Simplified Chinese language pack on Ubuntu:

sudo apt install -y tesseract-ocr tesseract-ocr-chi-sim

After installation, check the version and available languages:

tesseract --version
tesseract --list-langs

2. Install the Plugin

Install using the DSH plugin command:

dsh plugin --profile web add dsh-tesseract-ocr

--profile web is an example profile; you can replace it with your own profile when using it.

You can also install from a local source directory, a local tarball, or a GitHub repository. Verified installation methods include:

dsh plugin --profile web add ./dsh-tesseract-ocr
dsh plugin --profile web add ./dsh-tesseract-ocr-0.3.2.tgz
dsh plugin --profile web add github:maxwell-feng/dsh-tesseract-ocr

Note: Git installation pulls source code, not pre-built artifacts. In this process, the prepare script executes tsc. In pnpm 10 and above, a build may need to be allowed first.

3. Manually Load the Plugin

If you are not using an npm package installation but loading the plugin manually, you can append the following configuration to the profile’s cordis.patch.yml:

- insert:
    - id: tesseract-ocr
      name: '/home/you/tesseract-ocr/lib/index.js'
      config:
        language: eng+chi_sim
        passthrough: false

Here:

  • language: eng+chi_sim indicates enabling both English and Simplified Chinese recognition simultaneously.
  • passthrough: false indicates that by default, original image bytes are not sent to the visual model, only the OCR text is sent.

The manual path must point to the plugin’s entry file. On Windows, the manual path needs to use a file:// URL; on Linux, a regular absolute path can also be used.

4. Use a Temporary Patch Overlay

If you only want to enable it temporarily without modifying the profile, you can put the same plugin line in an overlay file and then start DSH:

dsh --profile web --patch /home/you/tesseract-ocr/dev.patch.yml

Typical Usage

After installation and enabling, when attaching images in a DSH session, the plugin will use local Tesseract OCR to recognize the images and by default only send the recognized text to the model API.

If you indeed want the visual model to receive the original image bytes, you need to explicitly enable passthrough:

config:
  language: eng+chi_sim
  passthrough: true

If the plugin is not loaded, it will not silently pass through image attachments, but will reject them.

Applicable Scenarios and Notes

dsh-tesseract-ocr is suitable for the following scenarios:

  • Using a text model with DSH, but wanting it to be able to answer based on text in images.
  • Wanting to keep image bytes locally by default without sending the original images to the model provider.
  • Not wanting to modify model configurations like input modalities.
  • Using the local Tesseract CLI, and the corresponding language packs are installed on the machine.

Please note before use:

  • The plugin runs with the permissions of the current DSH process; check source code and license before installing.
  • Do not enable windows-ocr simultaneously, as both will process the same image.
  • Choose only one loading method: npm package installation or manual insert configuration; do not register the same plugin entry multiple times simultaneously.
  • npm installation will automatically register the tesseract-ocr entry; do not manually add another insert line with the same id.
  • When dsh web encounters EADDRINUSE, it may indicate that an old instance is still occupying the port; you need to stop the old process before starting a new one.
  • This plugin targets Ubuntu as the primary verification target and is available in environments where tesseract CLI is installed.
  • Verified against dsh 0.1.2-alpha.2 (master).

Links

GitHub:

https://github.com/maxwell-feng/dsh-tesseract-ocr

Directory Page:

https://www.skillhub.cn/plugins/maxwell-feng/dsh-tesseract-ocr