opencode-glm-clipboard
v2.1.2
Published
OpenCode plugin that converts pasted clipboard data URLs to temp files for GLM models
Maintainers
Readme
opencode-glm-clipboard
OpenCode plugin that fixes pasted clipboard image flow for GLM models.
When a clipboard image arrives as a data:image/... part, this plugin:
- Saves the image to a temporary local file
- Rewrites the message part to text containing the local file path
- Keeps paste-first UX (
Cmd+V) without manual file save steps - Cleans old temp files automatically (24h default)
Why
Some GLM model routes in OpenCode reject direct image input, even when MCP image tools are available. This plugin provides a transparent fallback so the model can still analyze pasted images through tools using a local file path.
Install
npx -y opencode-glm-clipboard@latestThen restart OpenCode.
Uninstall
npx -y opencode-glm-clipboard@latest --uninstallLocal development
npm install
npm run buildRelease flow
Recommended release order:
- Bump version in
package.json - Commit and push
main - Create and push tag
vX.Y.Z - Publish GitHub Release for that tag
- GitHub Actions publishes to npm automatically
This repository includes a workflow that publishes to npm when a GitHub Release is published.
Recommended setup: npm Trusted Publishing (OIDC), no long-lived NPM_TOKEN required.
Add local plugin path in your OpenCode config if testing without publish:
{
"plugin": [
"file:///absolute/path/to/opencode-glm-clipboard/dist/index.js"
]
}Configuration
OPENCODE_GLM_CLIPBOARD_MAX_AGE_HOURS- Optional
- Default:
24 - Controls temp image cleanup threshold
Temp directory used:
${TMPDIR:-/tmp}/opencode-pasted-images
Compatibility
- Acts on models from providers that don't declare native image input support:
CrofAIprovider (e.g.deepseek-v4-pro)zai-coding-planprovider (e.g.claude-sonnet-4)- Legacy
glm-*model IDs
- Leaves other providers/models untouched
License
MIT
