opencode-dashscope-imagegen 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +68 -26
- package/package.json +33 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 WhiteBite
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,52 +1,94 @@
|
|
|
1
1
|
# opencode-dashscope-imagegen
|
|
2
2
|
|
|
3
|
-
[OpenCode](https://opencode.ai)
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
> Text-to-image generation for [OpenCode](https://opencode.ai) via **Alibaba DashScope** —
|
|
4
|
+
> `qwen-image-2.0`, `qwen-image-3.0` and `wan2.7-image` exposed as an `image_generate` tool
|
|
5
|
+
> your coding agent can call.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[](https://www.npmjs.com/package/opencode-dashscope-imagegen)
|
|
8
|
+
[](https://www.npmjs.com/package/opencode-dashscope-imagegen)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://opencode.ai/docs/plugins/)
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## Highlights
|
|
15
|
+
|
|
16
|
+
- Adds a single `image_generate` tool to any OpenCode agent — no extra server, no MCP setup.
|
|
17
|
+
- Uses the native DashScope multimodal-generation endpoint (the OpenAI-compatible
|
|
18
|
+
`/v1/images/generations` route is not served by DashScope).
|
|
19
|
+
- Saves the PNG to disk and returns the absolute path, so vision models
|
|
20
|
+
(`qwen3-vl-plus`, `kimi-k3`, …) can inspect the result via normal image attachments.
|
|
21
|
+
- Works with any DashScope text-to-image model, including the Wan series (`wan2.7-image`).
|
|
22
|
+
|
|
23
|
+
## Supported models
|
|
24
|
+
|
|
25
|
+
| Model | Notes |
|
|
26
|
+
|-------|-------|
|
|
27
|
+
| `qwen-image-2.0` (default) | fast general-purpose text-to-image |
|
|
28
|
+
| `qwen-image-3.0` | newer Qwen-Image generation |
|
|
29
|
+
| `wan2.7-image` | Wan (Tongyi Wanxiang) image models |
|
|
30
|
+
|
|
31
|
+
## Prerequisites
|
|
32
|
+
|
|
33
|
+
- [OpenCode](https://opencode.ai) installed.
|
|
34
|
+
- A DashScope API key from [Alibaba Cloud Model Studio](https://dashscope.console.aliyun.com/)
|
|
35
|
+
(Bailian console). Key resolution order:
|
|
36
|
+
1. `DASHSCOPE_IMAGEGEN_API_KEY` env
|
|
37
|
+
2. `DASHSCOPE_API_KEY` env
|
|
38
|
+
3. `apiKey` of any `dashscope*` provider in your `opencode.json`
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
Add the npm package name to your `opencode.json` — OpenCode installs it on next launch:
|
|
10
43
|
|
|
11
44
|
```json
|
|
12
45
|
{
|
|
13
|
-
"plugin": ["
|
|
46
|
+
"plugin": ["opencode-dashscope-imagegen"]
|
|
14
47
|
}
|
|
15
48
|
```
|
|
16
49
|
|
|
17
|
-
|
|
18
|
-
the plugin imports `@opencode-ai/plugin`, which must resolve from the plugin's own
|
|
19
|
-
directory (OpenCode does not provide it for out-of-tree plugins).
|
|
50
|
+
### Developing locally
|
|
20
51
|
|
|
21
|
-
|
|
52
|
+
To run from a checkout instead of npm, reference the plugin directory and install its
|
|
53
|
+
dependencies once (`@opencode-ai/plugin` must resolve from the plugin's own directory):
|
|
22
54
|
|
|
23
|
-
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"plugin": ["file:///path/to/opencode-dashscope-imagegen"]
|
|
58
|
+
}
|
|
59
|
+
```
|
|
24
60
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
61
|
+
```bash
|
|
62
|
+
npm install
|
|
63
|
+
npm run build # bun build → dist/index.js
|
|
64
|
+
```
|
|
28
65
|
|
|
29
66
|
## Usage
|
|
30
67
|
|
|
31
|
-
|
|
68
|
+
Just ask your agent: *"generate an image of a lighthouse at dusk"* — it will call the tool:
|
|
32
69
|
|
|
33
70
|
| Arg | Default | Description |
|
|
34
71
|
|-----|---------|-------------|
|
|
35
72
|
| `prompt` | required | image description |
|
|
36
|
-
| `model` | `qwen-image-2.0` | any DashScope
|
|
37
|
-
| `size` | `1024*1024` | `W*H`
|
|
38
|
-
| `output_path` | auto | absolute path; default
|
|
73
|
+
| `model` | `qwen-image-2.0` | any DashScope text-to-image model |
|
|
74
|
+
| `size` | `1024*1024` | `W*H` with a star, e.g. `1280*720` |
|
|
75
|
+
| `output_path` | auto | absolute path; default `<config>/gen-images/gen-<ts>.png` |
|
|
76
|
+
|
|
77
|
+
Output directory override: `DASHSCOPE_IMAGEGEN_DIR` env.
|
|
78
|
+
|
|
79
|
+
## Troubleshooting
|
|
39
80
|
|
|
40
|
-
|
|
81
|
+
- **`InvalidApiKey` / 401** — no key found; check the resolution order above.
|
|
82
|
+
- **Tool not appearing** — restart OpenCode after editing `opencode.json`; plugins load at startup.
|
|
83
|
+
- **`size` rejected** — use `W*H` with `*` (star), not `x`: `1024*1024`.
|
|
84
|
+
- **Model not supported** — the key's account must have the model enabled in Model Studio.
|
|
41
85
|
|
|
42
|
-
##
|
|
86
|
+
## Related
|
|
43
87
|
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- Vision models (kimi-k3, qwen3.8-max, qwen-vl-*) can then inspect the saved PNG
|
|
48
|
-
via normal image attachments.
|
|
88
|
+
- [OpenCode plugin docs](https://opencode.ai/docs/plugins/)
|
|
89
|
+
- [OpenCode ecosystem](https://opencode.ai/docs/ecosystem/)
|
|
90
|
+
- [awesome-opencode](https://github.com/awesome-opencode/awesome-opencode)
|
|
49
91
|
|
|
50
92
|
## License
|
|
51
93
|
|
|
52
|
-
MIT
|
|
94
|
+
[MIT](LICENSE)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-dashscope-imagegen",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "OpenCode plugin
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "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)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -17,18 +17,45 @@
|
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"opencode",
|
|
20
|
+
"opencode-plugin",
|
|
21
|
+
"opencode-ai",
|
|
20
22
|
"plugin",
|
|
21
23
|
"dashscope",
|
|
24
|
+
"alibaba",
|
|
25
|
+
"aliyun",
|
|
26
|
+
"bailian",
|
|
22
27
|
"qwen",
|
|
28
|
+
"qwen-image",
|
|
29
|
+
"wan",
|
|
23
30
|
"image-generation",
|
|
24
|
-
"text-to-image"
|
|
31
|
+
"text-to-image",
|
|
32
|
+
"image",
|
|
33
|
+
"imagegen",
|
|
34
|
+
"ai",
|
|
35
|
+
"ai-image",
|
|
36
|
+
"typescript"
|
|
25
37
|
],
|
|
26
38
|
"license": "MIT",
|
|
39
|
+
"author": "WhiteBite",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/WhiteBite/opencode-dashscope-imagegen.git"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/WhiteBite/opencode-dashscope-imagegen#readme",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/WhiteBite/opencode-dashscope-imagegen/issues"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=18"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
27
54
|
"dependencies": {
|
|
28
|
-
"@opencode-ai/plugin": "
|
|
55
|
+
"@opencode-ai/plugin": "^1.18.19"
|
|
29
56
|
},
|
|
30
57
|
"devDependencies": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
58
|
+
"@types/node": "^22.0.0",
|
|
59
|
+
"typescript": "^5.5.0"
|
|
33
60
|
}
|
|
34
61
|
}
|