feat: add per-provider free_models_only setting for OpenAI-compatible providers - #36
Merged
Conversation
… providers Set free_models_only = true in a provider's [providers.<id>] section so that /refresh-catalog keeps only free models (ids containing "free"), reusing the existing models.dev enrichment with :free/-free suffix fallback. Defaults to false, so existing configs are unchanged.
arrrrny
added a commit
that referenced
this pull request
Sep 9, 2026
packages/agent-core (the legacy v1 engine) was removed upstream in MoonshotAI#3542 and the fork followed in the 2026-09-07 sync; this test/config/schema.test.ts was the only tracked file left behind. It imports ../../src/config/schema, which no longer exists, so it never runs. The fork feature it covered (free_models_only, PR #36) is ported and tested in the v2 tree: the field lives in node-sdk's config schema and agent-core-v2's provider config, and the filter behavior is covered by packages/oauth/test/free-models-only.integration.test.ts and openai-compatible.test.ts. Also remove the untracked leftovers (node_modules residue) of the deleted packages/agent-core and packages/protocol directories.
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.
Related Issue
Feature developed via the spec-whole pipeline for
specs/008-free-models-only(no separate GitHub issue; internal feature).Problem
On OpenAI-compatible providers (OpenRouter, kilo, opencode, z.ai) that serve both paid and free models, the model picker is cluttered with paid models the user never wants to see. There was no per-provider way to restrict the catalog to free models only.
What changed
Added an opt-in per-provider boolean
free_models_onlyto the provider config, at the same level asproxy_url. When set totrueon an OpenAI-compatible provider, the on-demand/refresh-catalogflow keeps only models whose id containsfree(case-insensitive —:freeon OpenRouter/kilo,-freeon opencode), and enriches only those from models.dev. The existing:free/-free→ base-id fallback is reused, so a free model absent from models.dev is kept (never dropped) using its provider-reported name or id. Defaults tofalse, so existing configs are unchanged.packages/agent-core/src/config/schema.ts—ProviderConfigSchema.free_models_only?: booleanpackages/oauth/src/refreshProviderModels.ts— read the flag intoProviderViewand filter before enrichmentpackages/oauth/test/openai-compatible.test.tsandpackages/agent-core/test/config/schema.test.tsChecklist
gen-changesetsskill —.changeset/free-models-only-provider-config.mdadded.gen-docsskill, or this PR needs no doc update (config-only, consistent withproxy_url).