Skip to content

ttachment: true in custom provider model config has no effect - image upload blocked with 'does not support image input' #33542

Closed as not planned

Description

@tianpoACE

Description

When defining a custom provider with npm: "@ai-sdk/anthropic" and explicitly setting "attachment": true on a model, uploading an image still results in the error:

ERROR: Cannot read "<path>.jpg" (this model does not support image input). Inform the user.

The image is never sent to the provider — it is blocked at the frontend level before any API call is made.

Steps to Reproduce

  1. Configure a custom provider in opencode.jsonc using npm: "@ai-sdk/anthropic" with a custom baseURL (Anthropic-compatible proxy):
"my-provider": {
  "models": {
    "claude-opus-4-8": {
      "name": "Claude Opus 4.8",
      "attachment": true
    }
  },
  "npm": "@ai-sdk/anthropic",
  "options": {
    "apiKey": "<redacted>",
    "baseURL": "https://example.com/v1"
  }
}
  1. Start opencode with this provider and model selected.
  2. Try to attach an image (drag-and-drop or @ file reference).

Expected Behavior

The "attachment": true field declared in the model config should be respected, and the image should be passed to the model.

Actual Behavior

OpenCode blocks the image at the frontend with this model does not support image input, ignoring the attachment: true config.

Additional Context

  • The underlying API does support image input. Verified by calling the provider's /v1/messages endpoint directly with a base64-encoded image — the model correctly describes the image.
  • The attachment field is present in the OpenCode JSON schema (https://opencode.ai/config.json), so it appears to be an intentional config option.
  • The issue persists after a full restart of opencode.
  • Using @ file path reference also does not work — the file is read by the tool but image data is not passed to the model context.

Environment

  • OpenCode version: 1.15.13
  • OS: Windows 11
  • Provider npm: @ai-sdk/anthropic

Activity

  1. github-actions commented on Jun 23, 2026

    @github-actions
    Contributor

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

  2. cipherfoxie commented on Jul 6, 2026

    @cipherfoxie

    Update: Confirmed on local Qwen3.6-35B via vLLM — attachment: true still blocks images at frontend.

    Environment:

    • OpenCode: 1.17.13 (Go binary, aarch64)
    • Model: Qwen3.6-35B-A3B via vLLM localhost:30001
    • Config: "attachment": true set on model + "attachment.image" config at root level
    • OS: Linux ARM64 (NVIDIA DGX Spark, 121 GB Unified Memory)

    Test results:

    1. "attachment": true in model config → still blocked by frontend with "does not support image input"
    2. "attachment.image" root config (auto_resize, max_width/height, max_base64_bytes) → applied but irrelevant since image never reaches API
    3. Direct vLLM API call with base64 image → works perfectly, Qwen describes image correctly
    4. webfetch via URL → works but I cannot "see" images (only metadata), not real vision

    Workaround that works:

    python3 - <<'PY'
    import json, urllib.request
    req = {
      "model": "qwen3.6-35b",
      "max_tokens": 60, "temperature": 0,
      "messages": [{
        "role": "user",
        "content": [
          {"type": "text", "text": "Beschreib das Bild."},
          {"type": "image_url", "image_url": {"url": "<image_url>"}}
        ]
      }]
    }
    r = urllib.request.urlopen(urllib.request.Request(
      "http://localhost:30001/v1/chat/completions",
      data=json.dumps(req).encode(),
      headers={"Content-Type": "application/json"}
    ), timeout=120)
    d = json.load(r)
    print(d["choices"][0]["message"]["content"])
    PY

    Root cause hypothesis: The frontend checks model vision capability against the provider's models metadata (likely via /v1/models endpoint or hardcoded list), and attachment: true in opencode.json is not consulted. The check happens before the request is built, so the image is dropped client-side.

    Suggestion: The frontend should check both:

    1. Provider/model metadata for vision support, AND
    2. "attachment": true in the model config as an override

    Until fixed, the workaround is calling the vLLM API directly with base64 images. This is functional but breaks the opencode workflow — images cannot be part of the conversation context.

  3. github-actions commented on Sep 5, 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