dsh-imagegen
文件与数据 活跃维护

dsh-imagegen

ZhaoJun233/dsh-imagegen

提供多供应商兼容的图像生成能力,原生适配Gemini与OpenAI Images接口标准,无需额外适配即可调用主流图像生成服务,开箱即用显著降低集成成本

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
None
开源协议
42 KB
仓库大小
3 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:ZhaoJun233/dsh-imagegen
git clone https://github.com/ZhaoJun233/dsh-imagegen.git
git clone git@github.com:ZhaoJun233/dsh-imagegen.git
README.md main

dsh-imagegen

dsh-imagegen icon

English | 简体中文

Provider-neutral image generation plugin for DeepSeek Harness. It registers the image_generate agent tool and supports:

  • Gemini-compatible generateContent endpoints
  • image2 / OpenAI-compatible /images/generations endpoints
  • base64 and downloadable URL responses
  • runtime configuration from the DSH plugin settings page
  • secret redaction for API credentials
  • workspace-confined output paths and image-size limits

Install

Install directly from GitHub into the DSH Web profile:

dsh plugin --profile web add github:ZhaoJun233/dsh-imagegen

For local development, link the checkout instead:

dsh plugin --profile web add link:C:\path\to\dsh-imagegen

Restart the DSH Web host after installing or updating plugin code.

Configure

Open Settings → Plugins → Plugin configuration → Image generation and set:

  • protocol: auto, gemini, or image2
  • API URL
  • API Key or environment-variable name
  • credential header and optional prefix
  • default model
  • default image2 quality
  • workspace-relative output directory

The API Key field is write-only. Secret-role values are removed from settings responses and are never echoed by the page.

The public defaults use placeholder connection values. Configure a real endpoint and credential before calling the tool.

Gemini-compatible example

{
  "protocol": "gemini",
  "url": "<GEMINI_COMPATIBLE_ENDPOINT>",
  "apiKeyEnv": "IMAGEGEN_API_KEY",
  "apiKeyHeader": "x-goog-api-key",
  "apiKeyPrefix": "",
  "defaultModel": "your-image-model"
}

When a base URL is supplied, the plugin appends /v1beta/models/{model}:generateContent as needed.

image2-compatible example

{
  "protocol": "image2",
  "url": "<IMAGE_API_BASE_URL>",
  "apiKeyEnv": "IMAGEGEN_API_KEY",
  "apiKeyHeader": "Authorization",
  "apiKeyPrefix": "Bearer ",
  "defaultModel": "gpt-image-2",
  "defaultQuality": "medium"
}

When a base URL is supplied, the plugin appends /images/generations as needed. It requests b64_json and also accepts providers that return a downloadable image URL.

Tool

image_generate accepts:

  • prompt (required)
  • model
  • aspect_ratio
  • image_size for Gemini-compatible APIs
  • size and quality for image2-compatible APIs
  • output_path, relative to the current workspace

Generated files default to generated-images/ in the current session workspace.

Legacy runtime file

The optional fallback file is:

~/.dsh/dsh-imagegen.json

It is read only when neither plugin settings nor the configured environment variable supplies a credential. Do not commit this file when it contains a Key.

Composition

- id: imagegen
  name: dsh-imagegen
  config:
    runtimeConfigPath: ~/.dsh/dsh-imagegen.json
    outputDirectory: generated-images
    timeoutMs: 180000
    maxImageBytes: 20971520