Skip to content

feat: add per-provider free_models_only setting for OpenAI-compatible providers - #36

Merged
arrrrny merged 2 commits into
masterfrom
008-free-models-only
Aug 31, 2026
Merged

feat: add per-provider free_models_only setting for OpenAI-compatible providers#36
arrrrny merged 2 commits into
masterfrom
008-free-models-only

Conversation

@arrrrny

@arrrrny arrrrny commented Aug 31, 2026

Copy link
Copy Markdown
Owner

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_only to the provider config, at the same level as proxy_url. When set to true on an OpenAI-compatible provider, the on-demand /refresh-catalog flow keeps only models whose id contains free (case-insensitive — :free on OpenRouter/kilo, -free on 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 to false, so existing configs are unchanged.

  • packages/agent-core/src/config/schema.tsProviderConfigSchema.free_models_only?: boolean
  • packages/oauth/src/refreshProviderModels.ts — read the flag into ProviderView and filter before enrichment
  • Tests in packages/oauth/test/openai-compatible.test.ts and packages/agent-core/test/config/schema.test.ts

Checklist

  • I have read the CONTRIBUTING document.
  • I have added tests that prove my feature works (oauth 355 passed, agent-core config 177 passed; TDD audit PASS_WITH_GAPS).
  • Ran gen-changesets skill — .changeset/free-models-only-provider-config.md added.
  • Ran gen-docs skill, or this PR needs no doc update (config-only, consistent with proxy_url).

… 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
arrrrny merged commit 90f5b03 into master Aug 31, 2026
7 of 14 checks passed
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.
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