Dashscope Imagegen
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)
1
298
109 in 7 days
37.6
Multi-signal model
2 days ago
2026-10-03
Install and configure
opencode.jsonWrites 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"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-dashscope-imagegen@0.1.3"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-dashscope-imagegenOpenCode 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.0andwan2.7-imageexposed as animage_generatetool your coding agent can call.

Highlights
- Adds a single
image_generatetool to any OpenCode agent — no extra server, no MCP setup. - Uses the native DashScope multimodal-generation endpoint (the OpenAI-compatible
/v1/images/generationsroute 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:
DASHSCOPE_IMAGEGEN_API_KEYenvDASHSCOPE_API_KEYenvapiKeyof anydashscope*provider in youropencode.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. sizerejected — useW*Hwith*(star), notx:1024*1024.- Model not supported — the key's account must have the model enabled in Model Studio.
Related
License
Who is it for
Use cases
Why choose this
Similar plugins
Img
opencode-img
An OpenCode V2 plugin that generates and edits images through OpenAI and Gemini image APIs.
Gpt Imagegen
opencode-gpt-imagegen
OpenCode plugin for GPT Image 2 generation through your ChatGPT subscription, with reference images and safe PNG output.
Tell Sessions
opencode-tell-sessions
Inter-session direct messaging (DM) for OpenCode V1 & V2: agents in different sessions can message each other