opencode-dashscope-imagegen 0.1.0
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/README.md +52 -0
- package/dist/index.js +12451 -0
- package/package.json +34 -0
- package/src/index.ts +171 -0
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# opencode-dashscope-imagegen
|
|
2
|
+
|
|
3
|
+
[OpenCode](https://opencode.ai) plugin: text-to-image generation via **Alibaba DashScope**
|
|
4
|
+
(`qwen-image-2.0`, `qwen-image-3.0`, `wan2.7-image` and compatible models).
|
|
5
|
+
Adds an `image_generate` tool that saves the PNG to disk and returns its path.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Add to your `opencode.json` (local path or npm spec once published):
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"plugin": ["D:/Sources/WhiteBite/opencode-dashscope-imagegen/src/index.ts"]
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
When referencing the plugin by **local path**, run `npm install` inside this repo once —
|
|
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).
|
|
20
|
+
|
|
21
|
+
## Auth
|
|
22
|
+
|
|
23
|
+
Key resolution order:
|
|
24
|
+
|
|
25
|
+
1. `DASHSCOPE_IMAGEGEN_API_KEY` env
|
|
26
|
+
2. `DASHSCOPE_API_KEY` env
|
|
27
|
+
3. `apiKey` of any `dashscope*` provider in your `opencode.json`
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
The agent gets a tool:
|
|
32
|
+
|
|
33
|
+
| Arg | Default | Description |
|
|
34
|
+
|-----|---------|-------------|
|
|
35
|
+
| `prompt` | required | image description |
|
|
36
|
+
| `model` | `qwen-image-2.0` | any DashScope text2image model |
|
|
37
|
+
| `size` | `1024*1024` | `W*H` (star, not `x`) |
|
|
38
|
+
| `output_path` | auto | absolute path; default `~/.config/opencode/gen-images/gen-<ts>.png` |
|
|
39
|
+
|
|
40
|
+
Output dir override: `DASHSCOPE_IMAGEGEN_DIR` env.
|
|
41
|
+
|
|
42
|
+
## Notes
|
|
43
|
+
|
|
44
|
+
- Uses the native DashScope endpoint
|
|
45
|
+
`POST /api/v1/services/aigc/multimodal-generation/generation`
|
|
46
|
+
(the OpenAI-compatible `/v1/images/generations` is not served by DashScope).
|
|
47
|
+
- Vision models (kimi-k3, qwen3.8-max, qwen-vl-*) can then inspect the saved PNG
|
|
48
|
+
via normal image attachments.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT
|