Skip to content

Repository files navigation

dsh-plugin-imagine

@deepseek-ai/dsh-plugin-imagine adds attachment-backed image generation to a DeepSeek Harness profile.

It provides the replaceable ctx.images capability, an OpenAI Images-compatible provider, the agent-facing generate_image tool, and a Web composer Create image control. The agent chooses the tool from its description and complete conversation; the plugin does not classify user prompts or match keywords.

Install

Install the package into the DSH profile that should have image generation, then restart the profile's Web host. The package owns its cordis.patch.yml; no DSH workspace or resolver manifest change is needed.

pnpm dsh plugin --profile web add /absolute/path/to/dsh-plugin-imagine

The credential reference resolves through DSH's credentials provider at request time. The default patch reads IMAGINE_API_KEY.

export IMAGINE_API_KEY='...'
$env:IMAGINE_API_KEY = '...'

Configuration

Every deployment-controlled provider value is explicit in the bundle patch. Update the installed profile overlay when its endpoint, model, or limits differ.

- insert:
    - id: dsh-plugin-imagine-openai
      name: '@deepseek-ai/dsh-plugin-imagine/openai'
      config:
        baseUrl: 'https://api.openai.com/v1'
        apiKeyRef: 'IMAGINE_API_KEY'
        model: 'gpt-image-1'
        defaultSize: '1024x1024'
        defaultOutputFormat: 'png'
        timeoutMs: 120000
        maxImages: 1
        supportsStyle: false
    - id: dsh-plugin-imagine
      name: '@deepseek-ai/dsh-plugin-imagine'
      config:
        agentApproval: 'always'

baseUrl is the API root and the provider appends /images/generations. apiKeyRef is a credential name, never a browser field or tool parameter. maxImages limits model-provided n; supportsStyle determines whether the tool schema exposes style. The provider resolves omitted size, count, and output format before execution.

Use

Choose Create image in the Web composer tool row, write the final prompt, and submit. It executes /imagine <prompt> directly against ctx.images, bypassing the text model and duplicate approval. The imagine/requested and imagine/settled session events retain the prompt, state, elapsed time, safe error, and durable attachments for replay.

The agent receives generate_image. It uses it for explicit requests to create, draw, generate, illustrate, or design an image; it does not use it for concept discussion, drawing instructions, or analysis of an existing image. It creates a final prompt from sufficient conversation context and asks only when missing subject, composition, style, text, aspect ratio, or restrictions would materially change the result. Default agentApproval: always routes every model tool call through tools/pre-execute.

{
  "prompt": "A vertical Art Deco poster for a midnight tea shop, cobalt and gold, a crescent moon above the storefront, Chinese title text ‘夜茶’, no logos.",
  "size": "1024x1536",
  "n": 1
}

Successful images are downloaded when needed, validated, and saved through ctx.attachments.saveImage(). Model and Web output use durable attachment references rather than provider bearer URLs. The Web card shows elapsed seconds, preview, dimensions, open-original, and download actions.

Failures and limits

The provider does not retry because retries can create a second billable image. It returns safe actionable summaries for missing credentials, rejection, timeout or cancellation, missing images, malformed output, download failure, and attachment admission failure. Provider response bodies, API keys, and Authorization headers never reach the model or UI.

The first version supports synchronous OpenAI Images-compatible generation only. It does not include image editing, background jobs, polling, automatic rerolls, content moderation, or a host-wide image render-intent card.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages