Skip to content

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

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

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