refactor(byok): share models.dev catalog across sync fetchers#2970
Merged
chrarnoldus merged 1 commit intomainfrom May 1, 2026
Merged
refactor(byok): share models.dev catalog across sync fetchers#2970chrarnoldus merged 1 commit intomainfrom
chrarnoldus merged 1 commit intomainfrom
Conversation
- Extract modelsDevFetcher so any number of providers can pull from the shared models.dev catalog; rewrite the existing zai-coding fetcher to use it. - Fetch the models.dev catalog at most once per syncDirectByokModels run via a lazy getModelsDevCatalog() on a shared SyncContext. - Rename stripVendorPrefix to modelIdToDisplayName and also strip any ':suffix' tag (e.g. ':cloud', ':latest') so tagged ids render cleanly when models.dev doesn't provide an explicit name.
Contributor
Author
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 files)
Reviewed by gpt-5.5-2026-04-23 · 130,075 tokens |
jrf0110
approved these changes
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
modelsDevFetcherso multiple direct-BYOK providers can source their model list from the shared models.dev catalog; the existingzai-codingfetcher is rewritten on top of it.SyncContextwith a lazygetModelsDevCatalog()memoized inside a singlesyncDirectByokModelsrun, so the models.dev JSON is fetched at most once per sync regardless of how many providers consume it.stripVendorPrefixtomodelIdToDisplayNameand also strips any:suffixtag (e.g.:cloud,:latest) so tagged ids render cleanly when models.dev does not provide an explicit name.Preparatory refactor extracted from #2819 so the Ollama Cloud provider can land on top of a clean base.
Verification
syncDirectByokModelsand confirmed models.dev is hit exactly once even with multiple models.dev-backed providers registered.zai-codingoutput is unchanged (same model list serialized to Redis).Visual Changes
N/A — internal refactor.
Reviewer Notes
namefrom upstream still wins; the colon stripping only affects the fallback path.SyncContextis intentionally minimal; future models.dev-backed providers just callmodelsDevFetcher(providerId, catalogKey).