Skip to content

Latest commit

 

History

History
174 lines (124 loc) · 4.65 KB

CONFIGURATION.md

File metadata and controls

174 lines (124 loc) · 4.65 KB

Configuration

This plugin reads its configuration from dedicated .json or .jsonc files. See Config File Locations for where to place them.

Table of Contents

Config File Locations

Each config option uses the following priority (highest first):

Priority Level Path
1 Project .opencode/opencode-easy-vision.json or .jsonc
2 User ~/.config/opencode/opencode-easy-vision.json or .jsonc

The plugin merges options across levels. For example, a project models setting overrides the user setting while the user-level imageAnalysisTool remains in effect when the project config does not set it.

At each level, a valid JSONC file takes precedence over JSON. The plugin also reads the legacy opencode-minimax-easy-vision filenames when no current filename exists at that level. Current filenames take precedence over legacy filenames.

If no config exists, the plugin uses hardcoded defaults. On first load, an example .jsonc file is created at ~/.config/opencode/opencode-easy-vision.jsonc.

Config Options

models

Type: string[]
Default:

[
  "minimax/*",
  "minimax-cn/*",
  "minimax-coding-plan/*",
  "minimax-cn-coding-plan/*",
  "minimax-token-plan/*",
  "minimax-cn-token-plan/*"
]

Controls which models trigger the plugin. The format is provider/model with wildcard support:

Pattern Matches
* All models
minimax/* All models from the minimax provider
*/minimax-m2.5 The specific model from any provider
z-ai/glm-4.7 Exact match

Patterns without a / are matched against both the provider ID and the model ID.

Example:

{
  "models": ["z-ai/*", "*/some-model"]
}

imageAnalysisTool

Type: string
Default: "mcp_minimax_understand_image"

The MCP tool the plugin instructs the model to use. Use the exact tool name OpenCode exposes.

Example:

{
  "imageAnalysisTool": "openrouter_image_analyze_image"
}

promptTemplate

Type: string
Default: built-in template (see below)

Override the default prompt with a custom template. The template must include at least one of the following variables. If none are present, the plugin falls back to the default. Include both {imageList} and {toolName} when the model needs the image paths and the MCP tool name.

Variable Description
{imageList} Newline-separated list: - Image 1: /path/to/file
{imageCount} Number of images, e.g. 1, 3
{toolName} The configured MCP tool name
{userText} The user's original message text (may be empty)

Default template:

The user has shared {imageCount} image(s). The image(s) are saved at:
{imageList}

Use the `{toolName}` tool to analyze each image.

User's request: {userText}

Example custom template:

{
  "promptTemplate": "I'm attaching {imageCount} image(s) for you to analyze.\n\nImages:\n{imageList}\n\nUse the `{toolName}` tool on each one.\n\nMy question: {userText}"
}

tempDir

Type: string
Default: OS temp directory + opencode-easy-vision/

Custom directory where pasted images are saved before being passed to the MCP tool.

Example:

{
  "tempDir": "/tmp/my-custom-vision-dir"
}

cleanupAfterHours

Type: number
Default: 24

Temp files older than this many hours are deleted when the plugin initializes. The plugin does not delete files on a timer while OpenCode is running.

Example:

{
  "cleanupAfterHours": 48
}

Full Example Configs

Minimal — just change the models

{
  "models": ["z-ai/*"]
}

Use OpenRouter for image analysis

{
  "models": ["z-ai/*"],
  "imageAnalysisTool": "openrouter_image_analyze_image"
}

Custom prompt + custom temp dir

{
  "models": ["*"],
  "promptTemplate": "Analyze these {imageCount} images using `{toolName}`:\n{imageList}\n\nUser asked: {userText}",
  "tempDir": "/tmp/vision",
  "cleanupAfterHours": 48
}