openwork icon indicating copy to clipboard operation
openwork copied to clipboard

[Bug]: Model list and capabilities are hardcoded/stale - new models require manual opencode.jsonc edits; add a 'Refresh models' action

Open krixx646 opened this issue 2 months ago • 3 comments

Summary

OpenWork's model list and per-model capabilities are effectively hardcoded / cached as a snapshot. When a provider releases a new model — or changes an existing model's capabilities (e.g. adds vision/multimodal input) — the app does not pick it up automatically. Even when the user supplies their own API key via a custom provider, the new model does not become usable (or usable with its real capabilities) until the user manually edits opencode.jsonc. There is no "refresh / fetch latest models" action.

Environment

  • OpenWork Desktop: 0.18.42
  • opencode sidecar: 1.18.18
  • OS: Windows 11 Pro (10.0.26200)
  • Provider: custom DeepSeek (user-supplied API key)
  • Example model: deepseek/deepseek-v4-flash

Steps to reproduce

  1. Configure a provider using your own API key (e.g. DeepSeek).
  2. A new model is released upstream. Concrete example: DeepSeek V4.1-Flash (released 2026-09-10), a natively multimodal model. Per DeepSeek's own docs, deepseek-v4-flash is now a legacy alias whose requests are served by V4.1-Flash.
  3. Open the model picker / provider model list.
  4. The new model is missing, and/or its changed capabilities (image input) are not reflected.

Expected

  • The app fetches the live model list and capabilities for each configured provider (models.dev and/or the provider's /models endpoint) and the picker reflects new models and capability changes without editing config files.
  • There is a visible "Refresh models" action, plus automatic refresh on provider connect and app start.

Actual

  • The model list / capability map is effectively static. To use a newly released model, or to correct its capabilities, the user must hand-write provider.<id>.models.<model> overrides in opencode.jsonc.

Evidence

  • ~/.config/opencode/opencode.jsonc contains hand-written overrides added solely to work around this, including the comment:
    // Models-only override (no npm/baseURL) so Disconnect stays auth-based.
    // OpenCode's models.dev cache still marks Flash as text-only; V4.1 Flash is multimodal.
    "deepseek": {
      "models": {
        "deepseek-flash": { "name": "DeepSeek V4.1 Flash", "attachment": true, "modalities": { "input": ["text", "image"], "output": ["text"] } },
        "deepseek-v4-flash": { "attachment": true, "modalities": { "input": ["text", "image"], "output": ["text"] } }
      }
    }
    
  • The catalog is stored as a cached snapshot with a fixed name (~/.cache/opencode/models-<hash>.json), refreshed on an unclear trigger rather than on demand.

Impact

  • Users cannot use a newly released model through their own API key without manual config surgery.
  • Every upstream release creates manual integration work; non-technical users are stuck until the app is updated.
  • Capability changes (e.g. a model gaining vision) are not surfaced, so functionality silently appears unavailable.

Proposed fix

  • Fetch model lists and capabilities dynamically per provider (models.dev + provider /models endpoints), with a "Refresh models" button and automatic refresh on connect/startup.
  • Do not hardcode model IDs or capability flags in the backend; treat cached data as a fallback only.
  • Keep user overrides available but make them optional, never required.

Related issues

  • #4035 [Bug]: Opencode go models are outdated (do not update automatically)
  • #3553 [Bug]: Provider Cortecs.ai does not update the table of available models
  • #4166 [Bug]: Vision model not available in model picker even when provider exposes one
  • #2346 Cloud provider re-import doesn't update model list (closed)
  • #2345 Add manual 'Reload OpenCode config' action to command palette (closed)

krixx646 avatar Sep 10 '26 08:09 krixx646

Root-cause evidence (confirmed)

The upstream models.dev catalog that OpenWork/opencode consumes is stale for this model. Queried directly from https://models.dev/api.json:

model id models.dev attachment models.dev modalities.input reality per DeepSeek docs
deepseek-v4-flash false ["text"] (text-only) legacy alias -> V4.1-Flash, image-capable
deepseek-flash absent absent the current canonical model name
deepseek-v4-flash-vision-exp true ["text","image"] retired exp model
deepseek-v4-pro false ["text"] being phased out

DeepSeek's own docs (https://api-docs.deepseek.com/guides/vision) state that deepseek-flash accepts images, and the release note (https://www.deepseek.com/en/news/deepseek-v4-1-flash/, 2026-09-10) states deepseek-v4-flash is a legacy alias routed to V4.1-Flash.

Consequences:

  • The new model name (deepseek-flash) does not appear in the picker because it is absent from the catalog.
  • The existing id (deepseek-v4-flash) is treated as text-only, so image input is rejected.
  • Because there is no on-demand refresh and no provider /models probe, the only way to use the new model and its capabilities is to hand-edit opencode.jsonc:
// Models-only override (no npm/baseURL) so Disconnect stays auth-based.
// OpenCode's models.dev cache still marks Flash as text-only; V4.1 Flash is multimodal.
"deepseek": {
  "models": {
    "deepseek-flash": { "attachment": true, "modalities": { "input": ["text", "image"], "output": ["text"] } },
    "deepseek-v4-flash": { "attachment": true, "modalities": { "input": ["text", "image"], "output": ["text"] } }
  }
}

This manual override is what makes the model usable at all — which is precisely the problem. A live fetch (models.dev + provider /models endpoint) with a "Refresh models" action would remove the need for it.

krixx646 avatar Sep 10 '26 08:09 krixx646

Is anyone actually working on keeping the model lineup in OpenWork up to date? There are so many issues, and they still haven't been resolved.

petrbaloun avatar Sep 17 '26 11:09 petrbaloun

Owner: @reachjalil — most commits since 2026-04-01 on the files below (Jalil 11, Omar 5)

What was reported

  • OpenWork Desktop 0.18.42, opencode sidecar 1.18.18, Windows 11 Pro (10.0.26200). Custom DeepSeek provider using the reporter's own API key. Example model deepseek/deepseek-v4-flash.
  • A new upstream model (DeepSeek V4.1-Flash, deepseek-flash, released 2026-09-10, accepts images) is missing from the picker, and deepseek-v4-flash is treated as text-only.
  • The reporter's workaround: hand-written provider.deepseek.models overrides in opencode.jsonc that set attachment: true and modalities.input: ["text","image"].
  • The reporter says the catalog is a cached snapshot (models-<hash>.json in the opencode cache dir) with an unclear refresh trigger.
  • A comment shows models.dev api.json (2026-09-10) listing deepseek-v4-flash as text-only and not listing deepseek-flash. A second commenter asks whether anyone is keeping the model lineup up to date.
  • The reporter asks for live per-provider model lists (models.dev plus the provider's /models), a "Refresh models" action, and refresh on connect and on startup.

Where this lives in the code (dev @ e7d03dd43)

  • apps/server/src/opencode-models-url.ts:4 / :17: in production the engine catalog URL is https://models.openworklabs.com/, not models.dev directly. It is passed to the engine as OPENCODE_MODELS_URL (apps/server/src/cli.ts:158, apps/server/src/embedded.ts:228).
  • ee/apps/gateway/scripts/build-models.mjs:30: the served api.json is built from the committed snapshot ee/apps/gateway/src/models/base.json plus openwork-models.json.
  • .github/workflows/update-models.yml:8 / :26: base.json is regenerated from https://models.dev/api.json. The workflow has only a workflow_dispatch (manual) trigger. The latest bot snapshot commit is 2026-09-29 (#5464).
  • ee/apps/gateway/src/models/base.json at e7d03dd43 has both deepseek-flash and deepseek-v4-flash with attachment: true and input ["text","image"]. So the current snapshot contains what the reporter added by hand.
  • apps/server/src/engine-pool.ts:401-408: the engine config fingerprint hashes the runtime config file and the OPENCODE_MODELS_URL string. It does not hash the catalog contents.
  • No desktop code queries a bring-your-own-key provider's /models endpoint. The only provider model listing found is Ollama /api/tags (apps/app/src/react-app/domains/settings/ollama-config.tsx:86).
  • apps/app/src/react-app/domains/connections/provider-auth/managed-models-recovery.ts:89: the existing "Refresh organization models" action (en.ts:1466) re-runs the cloud provider sync only. It does not refresh the public catalog.

How it fits

  • Product area: desktop model catalog / provider picker.
  • PR #5185 ("refresh the model catalog without editing opencode.jsonc") was closed unmerged on 2026-09-22. On that PR, @OmarMcAdam commented that the provider list is refreshed manually from time to time and that the cache is part of OpenCode/OpenWork.
  • Clusters: provider settings hand-edited in config (#4788, #4960, #5539, #5540); model capability data not live (#4788, #5474, #5540).
  • Related issues the reporter cites: #4035, #3553, #4166 (open status not re-checked here).

Not yet confirmed

  • When the engine revalidates its on-disk catalog cache. That logic is in the OpenCode engine, not this repo. The PR #5185 description says the cache is not revalidated across restarts.
  • Whether a desktop on 0.18.42 picks up the current base.json entries without clearing the local cache.

benjaminshafii avatar Oct 07 '26 05:10 benjaminshafii