dsh-image-edge-cap: Restricting image dimensions sent to specific models based on the longest edge

Preface

When doing image-based conversations in DeepSeek Harness (DSH), two common kinds of limits apply: one is the total pixel budget (width × height), and the other is that no single side of an image may exceed a fixed number of pixels. The Anthropic Messages API returns HTTP 400 whenever a single request contains more than 20 images and any one of them exceeds 2000 px on either side. DSH’s built-in requestImagePixelBudget only caps total pixels, so long screenshots or full-page vertical screenshots can still hit the side-length limit even when they fit the pixel budget. Because each turn resends the entire history, once the history contains more than 20 images with at least one exceeding the side limit, every subsequent turn—including /compact—can hang.

The community plugin dsh-image-edge-cap (maintainer mrbeandev) addresses this in the model inference scenario by capping the longest side of request images sent by your chosen provider or model, with a default of 2000 px, and ships with a Settings → Image size configuration page.

What Is This

dsh-image-edge-cap is a DSH community plugin: for images sent to the model by a selected provider / model, it shrinks the longest side (default 2000 px) while preserving the aspect ratio. It only modifies the copy sent in the model request; local attachment storage and conversation logs are left untouched. Requests to unselected providers / models behave exactly as they would without the plugin installed.

The DSH community plugin directory is a standalone site with no official affiliation with DeepSeek / High-Flyer; installation and usage follow DSH’s “everything is a plugin” approach, and the facts in this article are based on the repository README.

Supported DSH and Node Versions

Check the host version with dsh --version before installing.

DSH support range: from 0.2.0-rc.1 up to (but not including) 0.3.0.

DSH version Notes
0.2.0-rc.1, 0.2.0-rc.2 Marked as tested in the README
0.2.1-alpha.1 Integration tests pass; may show an untested warning when loaded
Other versions within the range above Untested; warning shown when loaded
Below 0.2.0-rc.1 (0.1.x) Not supported: no route-chosen request-image target
0.3.0 and newer (including pre-releases) Loading refused by default; can be overridden with allowUntestedHarness: true

Node.js: ^22.19.0 or >=24.0.0.

The plugin has no runtime dependencies and does not depend on other community plugins. On a version mismatch, startup fails with a clear error and never half-loads; Settings will then indicate that the host plugin is not running.

Core Features

Capping the Longest Side, Not Total Pixels

Scaling preserves the aspect ratio. For example, in the README’s comparison: a 390×2475 vertical screenshot may remain unchanged under a 1.15 MP pixel budget, yet still violate Anthropic’s 2000 px rule for multi-image requests; after applying a 2000 px longest-side cap it becomes 315×2000, and the conversation can proceed.

Provider / Model Granularity

Each registered model provider can be configured individually:

Mode Effect
Off (default) No changes are made for this provider
All models Every model under this provider is capped
Selected models Only the checked models are capped; unchecked models of the same provider are unchanged

Max edge is adjustable from 16–16384 px, default 2000; clicking Apply takes effect from the next request onward (including session resume, sub-agents, and retries) without restarting DSH.

Only Touches Image Reads on the Request Path

Mechanism overview (README):

  1. Listen on llm/stream and match rules by provider / model; non-matching requests pass through untouched.
  2. On a match, the cap is carried in AsyncLocalStorage and intercepts the adapter’s image-reading process.
  3. Wrap the attachments service’s readImageRequest, reducing the target size within the cap’s scope; the actual scaling and caching are still done by the attachment store—the plugin contains no image-processing code.
  4. Images are never upscaled, and DSH’s existing pixel or byte budgets are not cancelled; images already offloaded from the request are not processed.

Each capped image is logged in the process log, e.g.: dsh-image-edge-cap: capped a request image 390×2475 → 315×2000 (max edge 2000).

Installation and Enabling

Install from npm for the Web profile:

dsh plugin --profile web add dsh-image-edge-cap

After finishing your current work, stop the running DSH Web process, restart it (e.g. dsh web --no-open --port 3080), and refresh the page. Open Settings → Image size, pick a mode for the desired provider / model, and set the Max edge.

Install from a local directory (the directory must stay in place; the profile links to that path):

dsh plugin --profile web add "/absolute/path/to/dsh-image-edge-cap"

Uninstall:

dsh plugin --profile web remove dsh-image-edge-cap

You can also set a provider to Off, and its next request will revert to uncapped behavior.

Typical Usage

When a routing provider serves both Claude and GPT: select Selected models for that provider, check only the Claude-family models, and set Max edge to 2000; other models still receive original-size images.

Rules are stored under the plugin’s entry in the profile patch (cordis.patch.yml) and can also be edited manually:

- id: dsh-image-edge-cap
  name: dsh-image-edge-cap
  config:
    providers:
      my-router:
        mode: selected          # off | all | selected
        models: [cc/claude-a, cc/claude-b]
        maxImageEdge: 2000

In the plugin entry’s config, each provider under providers contains fields such as mode, models (when in selected mode), and maxImageEdge, matching the Settings page.

Use Cases and Notes

Who it’s for: DSH Web users who frequently use Claude / Anthropic and other multi-image vision APIs, have many images in conversation history, and often work with screenshots with very long sides (especially full-page vertical screenshots); anyone who needs to satisfy a “longest side 2000 px” style limit in addition to the total pixel budget.

Compatibility notes (README): The plugin reversibly wraps a single method of the attachment store; this is not an official DSH extension API. The version gate refuses loading—instead of silently misbehaving—when internal APIs change. On DSH 0.2, adapters that prepare request images via readImageRequest (including pi-ai and the native DeepSeek adapter) are affected; providers set to Off are not affected.

Security and trust: The plugin runs with the permissions of the current DSH process and intercepts the image data path sent to the model. Before installing, read the source code and the MIT license, and confirm that your DSH and Node versions are within the supported range.

Conclusion

dsh-image-edge-cap applies a longest-side cap (default 2000 px) to request images for selected providers / models, along with a standalone Image size settings page. It bridges the gap between Anthropic’s multi-image side-length limit and DSH’s total pixel budget, preventing long conversations from failing wholesale due to a single over-long screenshot.

  • Directory page: https://www.skillhub.cn/plugins/mrbeandev/dsh-image-edge-cap
  • GitHub: https://github.com/mrbeandev/dsh-image-edge-cap
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye