Skip to content

feat: fetch provider models from the UI and one-click add to the composer picker - #446

Open
Lambda-zhou wants to merge 2 commits into
andrewyng:mainfrom
Lambda-zhou:pr/model-fetch
Open

feat: fetch provider models from the UI and one-click add to the composer picker#446
Lambda-zhou wants to merge 2 commits into
andrewyng:mainfrom
Lambda-zhou:pr/model-fetch

Conversation

@Lambda-zhou

@Lambda-zhou Lambda-zhou commented Aug 5, 2026

Copy link
Copy Markdown

reason why I did this:

openworker的总体是很棒的,多日的使用下来感觉比较便利就是没有中文版本难推广给我的朋友们使用,本来要做一个中文版本的pull request的发现有人做了,就尝试在设定这块下功夫。
起因:很多时候人们(比如我)并不会去买官方的订阅而是去找一些免费的,不知名的平台获取订阅,因为这样带来的成本较低,这就会带来没办法用官方的url的问题,而openworker也解决了这个问题能够提供自己的订阅url,在导入的时候我在想为什么我们不进一步直接通过接口获取models,这样能够减免很多不必要的选择模型然后输入模型的时间。此外也在一定程度上降低了人们使用的门槛,部分人可能只是知道这个平台的模型不错,但是并不知道具体的模型型号或者编号是多少,所以我就做了这个,希望openworker能够适合更多的人。Anyway,我希望openworker能够变得越来越好,我也在等待openworker的zh-cn版本,这样我就可以推广给身边的人,让他们也享受到ai带来的便利。

Summary

This PR adds two features that make it much faster to wire up a provider with a custom model list:

  1. Fetch models from the UI — a Fetch models button on the provider setup panel that queries the provider's real model list instead of relying on the bundled matrix. The model-candidate URL generation is ported from cc-switch's model_fetch.rs, so it handles the same edge cases: known compatibility suffixes, version segments, and custom endpoints.

  2. One-click add to the composer picker — each fetched model row gains a + Add button that adds the model straight into the composer's picker (no manual typing). It mirrors the existing ModelChecklist prefix rule: OpenAI ids stay bare, everyone else gets provider: prefixed.

What's included

  • coworker/providers/_models_candidates.py: candidate-URL builder (ported from cc-switch).
  • coworker/providers/registry.py: fetch_provider_models() per-provider model listing (Bedrock via boto3, Vertex via Google AI API, Anthropic/Gemini/Ollama/OpenAI via HTTP candidate iteration).
  • coworker/server/manager.py + coworker/server/app.py: POST /v1/providers/{name}/models endpoint (read-only, does not persist).
  • surfaces/gui/src/api.ts: fetchProviderModels() + ProviderModelInfo type.
  • surfaces/gui/src/providers/ProviderSetup.tsx + ProviderSetup.test.tsx: the Fetch button, model-list UI (loading / error / empty states), and the + Add per-row action with tests.

Notes

  • The endpoint is read-only — it fetches and returns the model list but does not persist anything.
  • A manual CI change is intentionally not included here so the PR stays focused on the feature (the upstream release workflow is untouched).
image

- New _models_candidates.py: ported from cc-switch model_fetch.rs, generates candidate
  URLs with compat suffix / version segment / full-URL handling
- registry.py: fetch_provider_models() listing models per provider (Bedrock via boto3,
  Vertex via Google AI API, Anthropic/Gemini/Ollama/OpenAI via HTTP candidate iteration)
- manager.py: fetch_models() merging stored/form/env field values
- app.py: POST /v1/providers/{name}/models endpoint (read-only, does not persist)
- api.ts: fetchProviderModels() + ProviderModelInfo type
- ProviderSetup.tsx: "Fetch models" button + model list UI (loading/error/empty states)
- ProviderSetup.test.tsx: makePs() gains the new state fields
Lambda-zhou added a commit to Lambda-zhou/openworker that referenced this pull request Aug 7, 2026
…wyng#440)

- Merge PR#446: add fetch models functionality (provider model discovery)
- Merge PR#440: complete Chinese localization across all GUI surfaces
- ProviderSetup.tsx: 3-way merge (base=01b6f83, ours=andrewyng#446, theirs=i18n-zh)
- 53 i18n files applied to surfaces/gui/src/
- Windows build: release.yml supports .exe/.msi via Tauri + PyInstaller
- Trigger Windows build: Actions > Release > Run workflow (workflow_dispatch)
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.

1 participant