Skip to content

Port Franklin's free-models module; drop hard-coded dead free ids - #27

Merged
VickyXAI merged 1 commit into
mainfrom
feat/free-models-port
Oct 20, 2026
Merged

VickyXAI merged 1 commit into
mainfrom
feat/free-models-port

Conversation

@VickyXAI

Copy link
Copy Markdown
Contributor

What changed

This ports Franklin's src/free-models.ts and src/free-models.constants.ts and removes the free model ids this fork still had hard-coded across about 15 call sites. Those ids left the gateway catalog: nemotron-nano-9b-v2, nemotron-nano-12b-v2-vl and mistral-nemotron in the 2026-08-30 pool rotation, and qwen3-coder-480b and llama-4-maverick earlier. The gateway answered for them with a substitute, so these calls never got the model they named.

  • New module: FREE_DEFAULT_MODEL, FREE_PREFERENCE_ORDER, freeChain, isFreeModelId, freeVisionModel and FREE_POOL_CONTEXT_FLOOR, matching Franklin. isFreeModelId reads the live gateway cache plus the static lists, because this fork has no @blockrun/model-catalog dependency.
  • Literals replaced with the shared default or chain: subagent, moa, evaluator, verification, turn-analyzer, compact, llm static fallback, media-router, brain/extract, learnings/extractor, telegram, proxy fallback, plugin-sdk workflow tiers, and the picker. The picker re-exports FREE_DEFAULT_MODEL for existing importers.
  • Router:
    • The free profile, getFallbackChain('free') and pickFreeFallback now use the live free chain, filtered by the runtime kill-switch. The chain no longer differs by category.
    • The quarantine list comes from free-models.
    • The tier classifier now uses FREE_DEFAULT_MODEL with a token budget a reasoning model can finish in, and parses the last tier word on the last line.
  • Vision:
    • No free model is treated as vision-capable by default. nano-12b-v2-vl is gone, and the gateway refuses images for nano-omni on /v1/messages.
    • A free model is never swapped to a paid vision model, in either the agent loop or the proxy. A free-profile vision turn tells the user it is answering from text only.
    • A free proxy request never falls back to a paid model.
  • Free checks: isFreeModelId replaces the startsWith('nvidia/') check in the subagent spend gate, the /model paid warning, compaction and isWeakModel.
  • Timeouts and token budgets: the turn-analyzer moves to 1024 tokens / 8s, matching Franklin. The media-router moves to 2048 tokens / 10s. That one is my own sizing, not Franklin's, because Franklin removed media-router. It replaces maverick's 384 / 3.5s, which would cut a reasoning model off mid-answer.
  • tokens.ts: live free ids are sized to FREE_POOL_CONTEXT_FLOOR, as in Franklin.
  • Dead DeepSeek ids: nvidia/deepseek-v4-flash and nvidia/deepseek-v4-pro are in no free set or routing order, and a test pins this.
  • Tests: free routing pins are updated, and a new guard fails if any runtime default in src/ names a retired free id.

Checks

npm test: 393/393 pass. npx tsc --noEmit clean, node dist/index.js --help OK, brand-numbers check up to date.

No version bump, no release.

… ids

Franklin-Trading still hard-coded free ids that left the gateway catalog
in the 2026-08-30 pool rotation (nemotron-nano-9b-v2, nemotron-nano-12b-v2-vl,
mistral-nemotron) and earlier (qwen3-coder-480b, llama-4-maverick) across
~15 call sites. The gateway answered for them with a substitute, so the
fork never got the model it named.

- Add src/free-models.ts + free-models.constants.ts from Franklin
  (FREE_DEFAULT_MODEL, FREE_PREFERENCE_ORDER, freeChain, isFreeModelId,
  freeVisionModel, FREE_POOL_CONTEXT_FLOOR). isFreeModelId reads the live
  gateway cache plus the static sets; the fork has no model-catalog dep.
- Replace the literals in subagent, moa, evaluator, verification,
  turn-analyzer, compact, llm, media-router, brain/extract,
  learnings/extractor, telegram, proxy fallback, plugin-sdk workflow and
  the picker with the shared default / chain.
- router: free profile, getFallbackChain and pickFreeFallback use the
  live free chain; quarantine list comes from free-models; the tier
  classifier follows FREE_DEFAULT_MODEL with a budget a reasoning model can
  answer inside, and reads the last tier word.
- vision: no free id is promised vision by default (nano-12b-v2-vl left
  the catalog; nano-omni is refused images on /v1/messages). A free model
  is never swapped to a paid vision sibling in the loop or the proxy, and
  a free proxy request never falls back to a paid rung.
- isFreeModelId replaces the startsWith('nvidia/') heuristic in the
  subagent spend gate, /model paid warning and compaction picker.
- The analyzer and media-router budgets are raised for reasoning models.
- nvidia/deepseek-v4-flash and nvidia/deepseek-v4-pro are not in any free
  set or routing order (both 400 at the gateway).
- tests: free routing pins updated; new guards that no runtime default
  names a retired free id.
@VickyXAI
VickyXAI merged commit d8050b2 into main Oct 20, 2026
2 checks passed
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