Skip to content

feat(providers): formalize model discovery modes - #4

Closed
Lxr-max wants to merge 1 commit into
mainfrom
cursor/provider-model-discovery-modes-2c48
Closed

Lxr-max wants to merge 1 commit into
mainfrom
cursor/provider-model-discovery-modes-2c48

Conversation

@Lxr-max

@Lxr-max Lxr-max commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Summary

Provider model discovery still mostly assumed a listing endpoint, even though real providers split into GET /models, a static catalog, manual IDs, inference-only gateways, and imports with a single known default. This adds a formal modelDiscoveryMode and drives listing, Settings pickers, import defaults, connection tests, and diagnostics from it so “no /models” is no longer a uniform hard failure.

Fixes OpenCoworkAI#210

Mode enum: models | static-hint | manual | infer-only

Mode models:v1:list-for-provider Settings picker Connection test
models GET /models remote select probe /models; 404 + working inference stays degraded
static-hint local modelsHint + defaultModel local select skip /models (ChatGPT Codex OAuth still uses its existing token check)
manual [defaultModel] locally text input skip /models, probe inference → compatible
infer-only same as manual text input skip /models; missing listing is expected, not degraded

Built-in / import defaults:

  • Anthropic, OpenAI, OpenRouter, Ollama → models
  • ChatGPT Codex OAuth → static-hint
  • Claude Code official api.anthropic.com → models; custom/proxy base → infer-only
  • Gemini CLI / OpenCode official maps → models
  • Codex config import → infer-only
  • Custom add form: discovered list → models; listing failed → infer-only; user chose manual → manual

Independent of sibling PRs OpenCoworkAI#419 / OpenCoworkAI#420 / OpenCoworkAI#421; additive types only.

Type of change

  • New feature

Linked issue

Fixes OpenCoworkAI#210

Checklist

  • I checked the linked issue / relevant context before starting
  • pnpm lint && pnpm typecheck && pnpm test passes locally
  • Added/updated tests for the change
  • Added a changeset (pnpm changeset) if user-visible
  • Updated i18n strings for Settings picker + diagnostics copy

Principles 5b

  • Compatible: existing supportsModelsEndpoint / modelsHint still work; modelDiscoveryMode is optional on disk and older configs derive a mode
  • Upgradeable: schemaVersion unchanged; Zod accepts the new optional capability field and locksteps it with listing
  • Lean: no new dependencies; one shared helper module consumed by IPC, Settings, imports, and diagnostics
  • Elegant: listing, picker UX, connection tests, and 404 wording all key off the same mode instead of per-provider fallbacks

Tests

Cover mode helpers, list-for-provider plans, infer-only/manual connection tests (skip /models, success is compatible), Settings picker state, parser payloads, builtin/import stamps, and diagnostics that treat listing 404 as info when the mode does not expect /models.

Screenshots / recordings (UI changes)

Settings picker and custom-provider test copy changed. This environment cannot drive the Electron Settings UI, so those flows were verified with unit tests rather than a live click-through.

Open in Web Open in Cursor 

Declare modelDiscoveryMode on provider capabilities so listing, Settings
pickers, imports, and diagnostics stop treating GET /models as universal.

Fixes OpenCoworkAI#210
@Lxr-max Lxr-max closed this Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: 正式建模模型发现模式 / Formalize provider model discovery modes

1 participant