Skip to content
    ↑↓ select↵ openesc close
    WhiteBite

    Dashscope Imagegen

    opencode-dashscope-imagegen·v0.1.3·Code Intelligence

    OpenCode plugin that adds an image_generate tool for text-to-image generation with Alibaba DashScope models (qwen-image-2.0, qwen-image-3.0, wan2.7-image)

    GitHub stars

    1

    Monthly installs

    298

    109 in 7 days

    Composite score

    37.6

    Multi-signal model

    Last commit

    2 days ago

    2026-10-03

    Install and configure

    opencode.json

    Writes to this project's opencode.json — applies to this repository only.

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-dashscope-imagegen@0.1.3"]
    }

    OpenCode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.

    English | Русский

    Text-to-image generation for OpenCode via Alibaba DashScope — qwen-image-2.0, qwen-image-3.0 and wan2.7-image exposed as an image_generate tool your coding agent can call.

    npm version npm downloads license OpenCode plugin

    Example output: generated with qwen-image-2.0

    Highlights

    • Adds a single image_generate tool to any OpenCode agent — no extra server, no MCP setup.
    • Uses the native DashScope multimodal-generation endpoint (the OpenAI-compatible /v1/images/generations route is not served by DashScope).
    • Saves the PNG to disk and returns the absolute path, so vision models (qwen3-vl-plus, kimi-k3, …) can inspect the result via normal image attachments.
    • Works with any DashScope text-to-image model, including the Wan series (wan2.7-image).

    Supported models

    Model Notes
    qwen-image-2.0 (default) fast general-purpose text-to-image
    qwen-image-3.0 newer Qwen-Image generation
    wan2.7-image Wan (Tongyi Wanxiang) image models

    Prerequisites

    • OpenCode installed.
    • A DashScope API key from Alibaba Cloud Model Studio (Bailian console). Key resolution order:
      1. DASHSCOPE_IMAGEGEN_API_KEY env
      2. DASHSCOPE_API_KEY env
      3. apiKey of any dashscope* provider in your opencode.json

    Installation

    Add the npm package name to your opencode.json — OpenCode installs it on next launch:

    {
      "plugin": ["opencode-dashscope-imagegen"]
    }
    

    Developing locally

    To run from a checkout instead of npm, reference the plugin directory and install its dependencies once (@opencode-ai/plugin must resolve from the plugin's own directory):

    {
      "plugin": ["file:///path/to/opencode-dashscope-imagegen"]
    }
    
    npm install
    npm run build   # tsc → dist/ (js + d.ts)
    

    Usage

    Example (replace with a real one)

    npm start
    

    Example (replace with a real one)

    npm start
    

    Just ask your agent: "generate an image of a lighthouse at dusk" — it will call the tool:

    Arg Default Description
    prompt required image description
    model qwen-image-2.0 any DashScope text-to-image model
    size 1024*1024 W*H with a star, e.g. 1280*720
    output_path auto absolute path; default <config>/gen-images/gen-<ts>.png

    Output directory override: DASHSCOPE_IMAGEGEN_DIR env.

    Troubleshooting

    • InvalidApiKey / 401 — no key found; check the resolution order above.
    • Tool not appearing — restart OpenCode after editing opencode.json; plugins load at startup.
    • size rejected — use W*H with * (star), not x: 1024*1024.
    • Model not supported — the key's account must have the model enabled in Model Studio.

    Related

    License

    MIT

    Who is it for

    Use cases

    Why choose this

    Similar plugins