Skip to content

[Bug]: OpenCode config export omits per-model image capabilities — attachments blocked for every opencodex model #4286

Closed

Description

@colthreepv

Client or integration

Other — OpenCode CLI/TUI (opencode 1.18.30), wired through the exported opencodex provider block and/or ocx opencode.

Area

Catalog / models · CLI

Summary

The OpenCode config export emits only name and limit per model and never emits opencode's per-model capability metadata (attachment, modalities). Because the custom provider id opencodex is absent from models.dev, opencode's model loader falls back to false for capabilities.attachment and capabilities.input.image. Every model is therefore cataloged text-only and the client blocks image attachments before the request ever reaches the proxy — including native OpenAI slugs that are definitely vision-capable and rows whose catalog entry advertises inputModalities: ["text","image"]. The vision sidecar is also unreachable from opencode for noVisionModels text models.

Root cause

The proxy's management API already returns per-model input modalities, e.g. GET /api/models (admin bearer):

  • gpt-5.6-luna (native, openai) -> ["text","image"]
  • gpt-6-astra (native, openai) -> ["text","image"]
  • opencode-go/glm-5.3 -> ["text","image"]
  • opencode-go/muse-spark-1.3-contributor -> ["text","image"]

The OpenCode path discards that field:

  • OpencodeProxyModelRow (src/cli/opencode.ts) has no inputModalities; opencodeCatalogFromProxyRows() never carries it.
  • OpencodeCatalogModel (src/clients/config-export/contracts.ts) has no inputModalities.
  • OpencodeModelEntry (src/clients/config-export.ts) is only { name: string; limit?: {...} }, and opencodeProviderBlocks() sets nothing else.

opencode 1.18.30 then computes capabilities as:

attachment: C.attachment ?? _?.capabilities.attachment ?? false
image:      C.modalities?.input?.includes("image") ?? _?.capabilities.input.image ?? false

where C is our model entry and _ is the models.dev record for provider opencodex (nonexistent) -> both default to false. opencode's model schema does support attachment: boolean and modalities: { input, output } (https://opencode.ai/config.json).

This is the same class of bug already fixed for Codex App in #344/#349 (auto-advertise image so images reach the vision sidecar) and already handled by the Hermes/Pi/Gajae exporters (#3146); the OpenCode serializer was missed.

Expected behavior / suggested fix

In opencodeProviderBlocks(), when a model declares inputModalities, emit opencode capability fields on both the v1 and v2 entries (the fast-row expansion already produces both):

const declared = model.inputModalities;
if (declared && declared.length > 0) {
  const input = declared.filter(m =>
    ["text","audio","image","video","pdf"].includes(m));
  entry.attachment = input.some(m => m !== "text");
  entry.modalities = { input: input.length ? input : ["text"], output: ["text"] };
}

Requires carrying inputModalities through OpencodeCatalogModel and opencodeCatalogFromProxyRows(). Rows with no declared modalities can keep the current text-only fallback (minimal fix), though parity with #344 (auto-advertise for noVisionModels) may be desirable so the sidecar is reachable from opencode.

Reproduction

  1. Wire opencode to the proxy (exported opencodex block, or ocx opencode).
  2. opencode debug config -> every provider.opencodex.models.* entry contains only name (+ limit), no attachment/modalities.
  3. In the opencode TUI select opencodex/gpt-5.6-luna and paste an image.
  4. The client reports the model does not support image input; no request reaches the proxy, even though GET /api/models reports ["text","image"] for it.

Version

2.50.0 — still present on main @ c155cc7 (2026-09-11); also in 2.51.0.

Operating system

Windows 11 24H2

Provider and model

openai native: gpt-5.6-luna / -sol / -terra, gpt-6-astra, gpt-daybreak-blue-latest
opencode-go: glm-5.3, muse-spark-1.3-contributor, deepseek-flash
(affects every provider routed through opencodex)

Redacted configuration

"gpt-5.6-luna": {
  "name": "gpt-5.6-luna (native)",
  "limit": { "context": 272000, "output": 32000 }
}

Logs or error output

Client-side gating only; e.g. "This model does not support image inputs."
No proxy-side request/error is produced.

Checks

  • I searched existing issues and this is not a duplicate.
  • I can reproduce this on the latest release.

done with ds41flash help.

Activity

  1. added 2 commits that reference this issue on Sep 11, 2026
    4e543d4
    ab26dde
  2. lidge-jun commented on Sep 11, 2026

    @lidge-jun
    Owner

    리뷰 · 우선순위 68 / 80

    이 이슈는 OpenCode로 내보낸 opencodex provider 블록에 모델별 이미지(첨부) 가능 표시가 없어서, opencode TUI가 붙여넣기를 프록시 앞에서 전부 막는 버그입니다. GET /api/models는 이미 inputModalities를 주는데, export 경로(OpencodeProxyModelRow → 카탈로그 → OpencodeModelEntry)가 그 필드를 버리고 name/limit만 남깁니다. provider id opencodex는 models.dev에 없으므로 opencode 1.18.30은 attachment와 capabilities.input.image를 false로 둡니다. 네이티브 비전 모델과 vision sidecar가 받기로 한 text-only 행이 같이 막힙니다.

    재현 경로도 분명합니다. 관리 API에서 gpt-5.6-luna나 opencode-go/glm-5.3처럼 ["text","image"]인 행을 확인한 뒤, ocx export --client opencode(또는 launcher가 주입하는 OPENCODE_CONFIG_CONTENT) 결과의 해당 모델 엔트리에 attachment/modalities가 없는지 보면 됩니다. 지금 dev HEAD eb314c53a(#4290 omo 직후)에도 그 export 구멍은 그대로입니다. omo는 Pi/senpi models.json을 재사용하는 다른 클라이언트라서 이 이슈와 직접 겹치지 않습니다.

    고치는 PR이 이미 열려 있습니다. #4293이 카탈로그에 inputModalities를 싣고, opencodeModelCapabilities()로 enum을 걸러 V1/V2 블록에 attachment/modalities를 쓰며, disabled 중복의 modality 기증도 막습니다. Fast 행 상속과 문서 절도 들어 있습니다. 다만 #4290과 config-export 계열 파일이 겹쳐 rebase가 필요하고, 아직 draft입니다. custom model이 stored text-only인데 sidecar가 image를 붙이는 경우는 #4293 범위 밖이라 이 이슈를 닫아도 그 조각은 남을 수 있습니다.

    경로 src/cli/opencode.ts OpencodeProxyModelRow - inputModalities 필드 부재가 뿌리. #4293이 추가함.
    경로 src/clients/config-export/contracts.ts OpencodeCatalogModel - 카탈로그가 modality를 안 들고 감. #4293이 추가함.
    경로 src/clients/config-export.ts OpencodeModelEntry / opencodeProviderBlocks - export JSON에 capability 미기록. #4293이 기록함.
    경로 custom/listManagementModelRows + sidecar - stored modalities만 복사하면 sidecar image가 빠짐. #4293도 out-of-scope로 명시. 별도 추적 필요.
    이슈 본문 재현 - /api/models 예시와 opencode loader 기본값 설명이 현재 dev와도 맞음.

    메인테이너의 판단이 필요한 지점

    너의 추천
    #4293을 #4290 위로 rebase·Ready 후 merge하고 이 이슈는 Closes로 닫으세요. custom+sidecar 승격만 남으면 후속 이슈로 쪼개면 됩니다.

    이 댓글은 grok-bot이 작성했습니다

  3. added a commit that references this issue on Sep 11, 2026
    9ad2057
  4. added a commit that references this issue on Sep 11, 2026
    ad09340
  5. lidge-jun commented on Sep 11, 2026

    @lidge-jun
    Owner

    Fixed on dev via maintainer PR #4300 (squash merge ad09340d79bae6db0a949f9a382c7574ecfc32e2). Export/catalog now advertise per-model attachment / modalities from catalog inputModalities, so OpenCode no longer refuses attachments for every opencodex model. Closing by hand because #4300 targeted dev (GitHub only auto-closes linked issues on merge to the default branch).

  6. added a commit that references this issue on Sep 17, 2026
    fc4927c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions