[FEATURE]: Add supportsAttachments/vision capability for custom providers #6472

Closed
opened 2026-02-16 18:04:19 -05:00 by yindo · 3 comments
Owner

Originally created by @karthick-kk on GitHub (Jan 16, 2026).

Originally assigned to: @thdxr on GitHub.

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

Custom providers using @ai-sdk/openai-compatible cannot send image attachments to vision-capable models. Attachments
are silently stripped before the request is sent.

Root Cause

In internal/llm/models/, SupportsAttachments is hardcoded per-model for built-in providers only. Custom provider
models return empty from SupportedModels, defaulting SupportsAttachments to false.

The stripping happens in the agent code:

go
if !a.provider.Model().SupportsAttachments && attachments != nil {
    attachments = nil
}

Use Case

I'm running a local OpenAI-compatible proxy (kiro-gateway) that supports vision. The proxy correctly handles images (
verified via curl), but opencode strips them before sending because it doesn't know the custom model supports
attachments.

Proposed Solution

Add a supportsAttachments (or capabilities.vision) option to custom provider model config:

json
{
  "provider": {
    "my-proxy": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "http://localhost:8000/v1" },
      "models": {
        "claude-sonnet-4-5": {
          "name": "Claude Sonnet 4.5",
          "supportsAttachments": true
        }
      }
    }
  }
}

Alternatives Considered

  • Model aliases matching built-in names - custom providers don't inherit built-in model capabilities

Environment

  • opencode version: latest
  • OS: Linux
Originally created by @karthick-kk on GitHub (Jan 16, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request ## Problem Custom providers using `@ai-sdk/openai-compatible` cannot send image attachments to vision-capable models. Attachments are silently stripped before the request is sent. ## Root Cause In `internal/llm/models/`, `SupportsAttachments` is hardcoded per-model for built-in providers only. Custom provider models return empty from `SupportedModels`, defaulting `SupportsAttachments` to `false`. The stripping happens in the agent code: ``` go if !a.provider.Model().SupportsAttachments && attachments != nil { attachments = nil } ``` ## Use Case I'm running a local OpenAI-compatible proxy (kiro-gateway) that supports vision. The proxy correctly handles images ( verified via curl), but opencode strips them before sending because it doesn't know the custom model supports attachments. ## Proposed Solution Add a `supportsAttachments` (or `capabilities.vision`) option to custom provider model config: ``` json { "provider": { "my-proxy": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "http://localhost:8000/v1" }, "models": { "claude-sonnet-4-5": { "name": "Claude Sonnet 4.5", "supportsAttachments": true } } } } } ``` ## Alternatives Considered - Model aliases matching built-in names - custom providers don't inherit built-in model capabilities ## Environment - opencode version: latest - OS: Linux
yindo added the discussion label 2026-02-16 18:04:19 -05:00
yindo closed this issue 2026-02-16 18:04:19 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 16, 2026):

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

  • #7198: [FEATURE]: Add query parameter support for custom OpenAI-compatible providers - addresses configuration extensibility for custom providers with @ai-sdk/openai-compatible
  • #5210: Custom OpenAI-compatible provider returns no text content - highlights issues with custom provider model capabilities not being properly recognized

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 16, 2026): This issue might be a duplicate of existing issues. Please check: - #7198: [FEATURE]: Add query parameter support for custom OpenAI-compatible providers - addresses configuration extensibility for custom providers with @ai-sdk/openai-compatible - #5210: Custom OpenAI-compatible provider returns no text content - highlights issues with custom provider model capabilities not being properly recognized Feel free to ignore if none of these address your specific case.
Author
Owner

@karthick-kk commented on GitHub (Jan 16, 2026):

The feature already exists in opencode - it's just not documented! closing this issue for now

The modalities config option is already supported.

"modalities": {
  "input": ["text", "image"],
  "output": ["text"]
}

The implementation is in provider.ts lines 760-764:

image: model.modalities?.input?.includes("image") ?? existingModel?.capabilities.input.image ?? false,

Add this to the custom provider section at https://opencode.ai/docs/providers/#custom-provider to make the users figure this easily 👍

@karthick-kk commented on GitHub (Jan 16, 2026): The feature already exists in opencode - it's just not documented! closing this issue for now The modalities config option is already supported. ```json "modalities": { "input": ["text", "image"], "output": ["text"] } ``` The implementation is in provider.ts lines 760-764: ```typescript image: model.modalities?.input?.includes("image") ?? existingModel?.capabilities.input.image ?? false, ``` Add this to the custom provider section at https://opencode.ai/docs/providers/#custom-provider to make the users figure this easily 👍
Author
Owner

@1saifj commented on GitHub (Feb 1, 2026):

@karthick-kk worked thank you!

@1saifj commented on GitHub (Feb 1, 2026): @karthick-kk worked thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6472