@sami7786/opencode-image-proxy 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Samiul Islam
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 ADDED
@@ -0,0 +1,88 @@
1
+ # opencode-image-proxy
2
+
3
+ OpenCode plugin that proxies images through a vision-capable model, enabling image-incapable models to "see" pasted images.
4
+
5
+ ## Installation
6
+
7
+ ### From npm
8
+ Add this to opencode config (typically in : ~/.config/opencode/opencode.json)
9
+ ```json
10
+ {
11
+ "$schema": "https://opencode.ai/config.json",
12
+ "plugin": [
13
+ "@sami/opencode-image-proxy@latest"
14
+ ]
15
+ }
16
+ ```
17
+
18
+ ## How It Works
19
+
20
+ 1. Checks if the current model is in the "imageIncapableModels" list as configured
21
+ 2. **If image-incapable**: Automatically sends images to a vision-capable model for analysis, then replaces the image with a text description
22
+ 3. **If image-capable**: Images pass through natively with no transformation
23
+
24
+ All model calls use OpenCode's existing authentication - no separate API keys needed.
25
+
26
+ ## Configuration
27
+
28
+ Create `~/.config/opencode/opencode-image-proxy.json`
29
+
30
+ <i> To see available models, run: ```opencode models``` </i>
31
+
32
+ default config:
33
+ ```json
34
+ {
35
+ "imageIncapableModels": [
36
+ "zai-coding-plan/glm-4.5",
37
+ "zai-coding-plan/glm-4.5-air",
38
+ "zai-coding-plan/glm-4.5-flash",
39
+ "zai-coding-plan/glm-4.5v",
40
+ "zai-coding-plan/glm-4.6",
41
+ "zai-coding-plan/glm-4.6v",
42
+ "zai-coding-plan/glm-4.7",
43
+ "zai-coding-plan/glm-4.7-flash",
44
+ "zai-coding-plan/glm-5"
45
+ ],
46
+ "imageReaderModel": {
47
+ "providerID": "opencode",
48
+ "modelID": "kimi-k2.5-free"
49
+ },
50
+ "analysisPrompt": "The user has pasted an image into their chat. Describe what you see..."
51
+ }
52
+ ```
53
+
54
+ - `imageIncapableModels` — Models that you want to enable the proxy for.
55
+ - `imageReaderModel` — Any vision-capable model in your OpenCode setup.
56
+ - `analysisPrompt` — System prompt for image analysis.
57
+
58
+ ### Behavior
59
+
60
+ | Model | Result |
61
+ |-------|--------|
62
+ | In image-incapable list | Images proxied through vision model, replaced with descriptions |
63
+ | NOT in list | Images pass through natively |
64
+
65
+ ## Example Output
66
+
67
+ ```
68
+ [User pasted image: screenshot.png]
69
+ This is a terminal window showing a Node.js error. The error message reads:
70
+ "TypeError: Cannot read property 'map' of undefined" at line 42 in app.js.
71
+ The stack trace below shows the error originated in the UserList component...
72
+ ```
73
+
74
+ ## Requirements
75
+
76
+ - The configured `imageReaderModel` must be available and authenticated in OpenCode
77
+ - The vision model must support image input
78
+
79
+ ## Building
80
+
81
+ ```bash
82
+ npm install
83
+ npm run build
84
+ ```
85
+
86
+ ## License
87
+
88
+ MIT
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from "@opencode-ai/plugin";
2
+ export declare const OpencodeVisionPlugin: Plugin;
3
+ export default OpencodeVisionPlugin;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AA0J9D,eAAO,MAAM,oBAAoB,EAAE,MAgElC,CAAA;AAED,eAAe,oBAAoB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,187 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+ const DEFAULT_IMAGE_INCAPABLE_MODELS = [
5
+ "zai-coding-plan/glm-4.5",
6
+ "zai-coding-plan/glm-4.5-air",
7
+ "zai-coding-plan/glm-4.5-flash",
8
+ "zai-coding-plan/glm-4.5v",
9
+ "zai-coding-plan/glm-4.6",
10
+ "zai-coding-plan/glm-4.6v",
11
+ "zai-coding-plan/glm-4.7",
12
+ "zai-coding-plan/glm-4.7-flash",
13
+ "zai-coding-plan/glm-5",
14
+ ];
15
+ const DEFAULT_ANALYSIS_PROMPT = `The user has pasted an image into their chat. Describe what you see as if you are directly observing the image. Be thorough but concise. Include:
16
+ - All visible elements (objects, text, UI elements, people, etc.)
17
+ - Exact transcription of any text
18
+ - The context and purpose of the image
19
+ - Any relevant technical details
20
+
21
+ Describe it naturally, as if explaining to someone what you're looking at right now.`;
22
+ const IMAGE_WRAPPER_PREFIX = `[User pasted image: `;
23
+ const IMAGE_WRAPPER_SUFFIX = `]`;
24
+ const sessionsNeedingAnalysis = new Set();
25
+ let config = null;
26
+ let pluginContext = null;
27
+ function getConfigDir() {
28
+ const xdgConfig = process.env.XDG_CONFIG_HOME;
29
+ if (xdgConfig) {
30
+ return join(xdgConfig, "opencode");
31
+ }
32
+ return join(homedir(), ".config", "opencode");
33
+ }
34
+ function loadConfig() {
35
+ const configPath = join(getConfigDir(), "opencode-image-proxy.json");
36
+ const defaultConfig = {
37
+ imageIncapableModels: DEFAULT_IMAGE_INCAPABLE_MODELS,
38
+ imageReaderModel: { providerID: "github-copilot", modelID: "gpt-5-mini" },
39
+ analysisPrompt: DEFAULT_ANALYSIS_PROMPT,
40
+ };
41
+ if (!existsSync(configPath)) {
42
+ return defaultConfig;
43
+ }
44
+ try {
45
+ const userConfig = JSON.parse(readFileSync(configPath, "utf-8"));
46
+ return {
47
+ imageIncapableModels: Array.isArray(userConfig.imageIncapableModels)
48
+ ? userConfig.imageIncapableModels.filter((m) => typeof m === "string")
49
+ : DEFAULT_IMAGE_INCAPABLE_MODELS,
50
+ imageReaderModel: userConfig.imageReaderModel
51
+ ? {
52
+ providerID: userConfig.imageReaderModel.providerID ?? defaultConfig.imageReaderModel.providerID,
53
+ modelID: userConfig.imageReaderModel.modelID ?? defaultConfig.imageReaderModel.modelID,
54
+ }
55
+ : defaultConfig.imageReaderModel,
56
+ analysisPrompt: typeof userConfig.analysisPrompt === "string" ? userConfig.analysisPrompt : DEFAULT_ANALYSIS_PROMPT,
57
+ };
58
+ }
59
+ catch {
60
+ return defaultConfig;
61
+ }
62
+ }
63
+ function isImageIncapableModel(providerID, modelID) {
64
+ if (!providerID || !modelID)
65
+ return false;
66
+ return (config ??= loadConfig()).imageIncapableModels.includes(`${providerID}/${modelID}`);
67
+ }
68
+ function decodeDataUrl(url) {
69
+ const match = url.match(/^data:([^;,]+)(?:;[^,]+)?;base64,(.+)$/);
70
+ if (!match)
71
+ return null;
72
+ try {
73
+ const data = Buffer.from(match[2], "base64");
74
+ return data.length ? { data, mime: match[1].toLowerCase() } : null;
75
+ }
76
+ catch {
77
+ return null;
78
+ }
79
+ }
80
+ async function analyzeImageViaOpencode(imageDataUrl, filename) {
81
+ if (!pluginContext) {
82
+ return "[Image analysis failed: plugin context not initialized]";
83
+ }
84
+ const cfg = config ??= loadConfig();
85
+ const { client } = pluginContext;
86
+ try {
87
+ const session = await client.session.create({});
88
+ if (!session.data) {
89
+ return "[Image analysis failed: could not create session]";
90
+ }
91
+ const sessionID = session.data.id;
92
+ const response = await client.session.prompt({
93
+ path: { id: sessionID },
94
+ body: {
95
+ model: cfg.imageReaderModel,
96
+ system: cfg.analysisPrompt,
97
+ parts: [
98
+ {
99
+ type: "text",
100
+ text: "What do you see in this image?",
101
+ },
102
+ {
103
+ type: "file",
104
+ url: imageDataUrl,
105
+ filename: filename ?? "image.png",
106
+ mime: "image/png",
107
+ },
108
+ ],
109
+ },
110
+ });
111
+ await client.session.delete({ path: { id: sessionID } }).catch(() => { });
112
+ if (!response.data) {
113
+ return "[Image analysis failed: no response from vision model]";
114
+ }
115
+ const parts = response.data.parts ?? [];
116
+ const textParts = parts.filter((p) => p.type === "text" && p.text);
117
+ if (textParts.length === 0) {
118
+ return "[Image analysis failed: no text in response]";
119
+ }
120
+ return textParts.map((p) => p.text).join("\n");
121
+ }
122
+ catch (error) {
123
+ const errorMsg = error instanceof Error ? error.message : String(error);
124
+ return `[Image analysis failed: ${errorMsg}]`;
125
+ }
126
+ }
127
+ export const OpencodeVisionPlugin = async (ctx) => {
128
+ pluginContext = ctx;
129
+ config = loadConfig();
130
+ return {
131
+ "chat.message": async (input) => {
132
+ if (isImageIncapableModel(input.model?.providerID, input.model?.modelID)) {
133
+ sessionsNeedingAnalysis.add(input.sessionID);
134
+ }
135
+ else if (input.model?.providerID || input.model?.modelID) {
136
+ sessionsNeedingAnalysis.delete(input.sessionID);
137
+ }
138
+ },
139
+ "experimental.chat.messages.transform": async (_, output) => {
140
+ if (!output?.messages)
141
+ return;
142
+ let lastUserMsgIdx = -1;
143
+ for (let i = output.messages.length - 1; i >= 0; i--) {
144
+ if (output.messages[i].info?.role === "user") {
145
+ lastUserMsgIdx = i;
146
+ break;
147
+ }
148
+ }
149
+ if (lastUserMsgIdx === -1)
150
+ return;
151
+ const msg = output.messages[lastUserMsgIdx];
152
+ if (!msg?.parts)
153
+ return;
154
+ const sid = msg.info?.sessionID;
155
+ if (!sid || !sessionsNeedingAnalysis.has(sid))
156
+ return;
157
+ const imageAnalysisPromises = [];
158
+ for (let i = 0; i < msg.parts.length; i++) {
159
+ const p = msg.parts[i];
160
+ if (p.type === "file" && p.mime?.startsWith("image/") && p.url) {
161
+ const index = i;
162
+ const filename = p.filename;
163
+ const imageUrl = p.url;
164
+ imageAnalysisPromises.push(analyzeImageViaOpencode(imageUrl, filename).then((analysis) => ({
165
+ index,
166
+ analysis,
167
+ filename,
168
+ })));
169
+ }
170
+ }
171
+ if (imageAnalysisPromises.length === 0)
172
+ return;
173
+ const results = await Promise.all(imageAnalysisPromises);
174
+ for (const { index, analysis, filename } of results) {
175
+ const p = msg.parts[index];
176
+ const displayName = filename ?? `image.${p.mime?.split("/")[1] ?? "bin"}`;
177
+ const textPart = {
178
+ type: "text",
179
+ text: `${IMAGE_WRAPPER_PREFIX}${displayName}${IMAGE_WRAPPER_SUFFIX}\n${analysis}`,
180
+ };
181
+ msg.parts[index] = textPart;
182
+ }
183
+ },
184
+ };
185
+ };
186
+ export default OpencodeVisionPlugin;
187
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,MAAM,8BAA8B,GAAG;IACrC,yBAAyB;IACzB,6BAA6B;IAC7B,+BAA+B;IAC/B,0BAA0B;IAC1B,yBAAyB;IACzB,0BAA0B;IAC1B,yBAAyB;IACzB,+BAA+B;IAC/B,uBAAuB;CACxB,CAAA;AAED,MAAM,uBAAuB,GAAG;;;;;;qFAMqD,CAAA;AAErF,MAAM,oBAAoB,GAAG,sBAAsB,CAAA;AACnD,MAAM,oBAAoB,GAAG,GAAG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wBACR,QAAQ;qBACT,CAAC,CAAC,CACJ,CAAA;gBACH,CAAC;YACH,CAAC;YAED,IAAI,qBAAqB,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAM;YAE9C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;YAExD,KAAK,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,OAAO,EAAE,CAAC;gBACpD,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;gBAC1B,MAAM,WAAW,GAAG,QAAQ,IAAI,SAAS,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAA;gBACzE,MAAM,QAAQ,GAAS;oBACrB,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,GAAG,oBAAoB,GAAG,WAAW,GAAG,oBAAoB,KAAK,QAAQ,EAAE;iBAClF,CAAA;gBACD,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAA;YAC7B,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAED,eAAe,oBAAoB,CAAA"}
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@sami7786/opencode-image-proxy",
3
+ "version": "1.0.0",
4
+ "description": "OpenCode plugin that proxies images through a vision-capable model, enabling image-incapable models to \"see\"",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "prepublishOnly": "npm run build"
20
+ },
21
+ "peerDependencies": {
22
+ "@opencode-ai/plugin": ">=0.0.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^25.2.3",
26
+ "typescript": "^5.9.3"
27
+ },
28
+ "keywords": [
29
+ "opencode",
30
+ "plugin",
31
+ "vision",
32
+ "image",
33
+ "multimodal"
34
+ ],
35
+ "license": "MIT"
36
+ }