Skip to content

[FEATURE]: Auto Image Read - Automatic image preprocessing with dedicated image model #26160

Closed as not planned

Description

@SOUMITRO-SAHA

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problem

OpenCode is a harness on top of AI models that performs local operations to modify code. Most open-weight models don't support image input — they simply cannot process images at all.

When a user sends an image with a message using a model that doesn't support image input, the system either:

  1. Falls back to an error message: "This model doesn't support image input - I cannot view or analyze images."
  2. Completely replaces the image with an error token

This creates a significant limitation: as a full-stack or frontend developer, you can't pass any image to analyze and perform tasks based on that analysis. For example:

  • Paste a screenshot of a UI and ask "which file controls this component?"
  • Share a design mock and ask "update the logo to match this"
  • Send a screenshot of an error and ask "what's causing this?"

There's no way to automatically route image analysis to a dedicated image-capable model while keeping the main task on the user's chosen model.

Proposed Solution

Implement an "Auto Image Read" feature that:

  1. Automatic Image Detection & Preprocessing — When the current model doesn't support image input but the user sends an image, automatically use a dedicated image model to analyze it first. The analysis context (as text) is injected into the current session while the image data is removed to avoid input type conflicts.

  2. Two Ways to Switch Image Model —

    • Command Palette — Press Ctrl+P (Mac) and type Switch Image Model or short sim to open the image model selection UI
    • Slash Command — Use /image-models to switch the image model
    • Both allow users to view all connected providers' image-capable models, persist their preferred selection, and quickly switch between models
  3. Visual Feedback — Show status indicator when the image model is processing, so users know something is happening

  4. Seamless Integration — After the image model analyzes the image:

    • Generate a detailed text description relevant to the user's query
    • Replace the image in the message with a text description
    • Remove the image from chat history entirely (to comply with non-image model constraints)
    • Continue the conversation with the original model
    • The main intelligent task remains on the user's chosen model — the image model only analyzes the image, keeping token cost minimal

Implementation Flow

User sends message with image attachment
                │
                ▼
┌──────────────────────────────────────┐
│ Does current model support images?   │
└──────────────────────────────────────┘
                │
        ┌───────┴───────┐
        ▼               ▼
       YES              NO
        │               │
        ▼               ▼
   Continue         Resolve Image Model
   normally          (local → config →
    (skip)           provider default)
        │               │
        │               ▼
        │        ┌───────────────────┐
        │        │ Call image model  │
        │        │ with describe      │
        │        │ prompt             │
        │        └───────────────────┘
        │               │
        │               ▼
        │        ┌───────────────────┐
        │        │ Generate text      │
        │        │ description        │
        │        └───────────────────┘
        │               │
        │               ▼
        │        ┌───────────────────┐
        │        │ Remove image      │
        │        │ parts, add        │
        │        │ synthetic text    │
        │        │ part              │
        │        └───────────────────┘
        │               │
        ▼               ▼
   Original model   Continue with
   sees image       original model
                    (text only)

Image Model Resolution Chain

The image model is resolved in the following priority order:

  1. Explicit — Passed directly
  2. Config — config.image_model setting (e.g., openai/gpt-4o)
  3. Fallback — First available image-capable model from any connected provider

Edge Cases

  1. No image model available — Fall through to existing error behavior
  2. Image model call fails — Log error, keep original error message, don't block conversation
  3. Multiple images — Send all images in a single batch call
  4. Mixed content — Include user's text as context for image description
  5. Subsequent turns — After preprocessing, no images persist in history
  6. Current model supports images — Skip preprocessing entirely

Benefits

  • User Experience: Seamless image handling regardless of model capabilities
  • Flexibility: Users can mix any text model with any image model — the image model doesn't need to be highly intelligent, it just analyzes the image while the main task is handled by the current model
  • Cost-Effective: Minimal token cost since the image model only performs image analysis, not the main intelligent task
  • Transparency: Images converted to text descriptions are marked as synthetic
  • Extensibility: Can be extended to support other modalities (audio, video) in the future
  • TUI only for now: Web support can follow after initial implementation

Activity

  1. github-actions commented on May 7, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review those issues and consider adding your input there rather than opening a new one.

  2. github-actions commented on Jul 8, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions