ac4af582301a4e8a29245dbba767eba31334ddf9
1
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
47b7ba3030 |
models: a model its provider lists at $0 says free in the pickers and Routing (jiangguochao666 on X)
jiangguochao666 asked for each provider's free models to show in Routing and the model settings, to route to them. The green free tag was shown only for a plan's free model or a model with "free" in its name. provider.PricedFree says a model is free only when its price for that provider is known to be $0: - A price the user set comes first (provider/model, provider/*, then the model's own key). A $0 one makes it free, and any other price, a paid tier included, makes it paid. - Otherwise the provider's own catalogs decide. A $0 from a plan's catalog (-plan, membership catalogs) is the plan's per-token price, not free. A $0 from only the model's maker is not free either: a relay serving Zhipu's free glm-4.7-flash may charge for it. - No known price means not free. FreeModel (Free first, Cheapest first routing) is unchanged. From the local models.dev cache this tags: - every model of NVIDIA NIM and ModelScope; - the :free / -free models of OpenRouter, OpenCode Zen and Go, Kilo, AIHubMix, ZenMux, Vercel, Requesty and other relays; - Zhipu's and Z.ai's glm-4.x-flash. No coding or token plan is tagged. Where it shows, with the hover "free: listed at $0 on this provider": - an agent's model picker (agent.Option.Zero); - the provider editor's model chips, and its Free only button (modelJSON.Zero); - Routing's Add a model and classifier pickers (modelRef.Zero). The word is new in en, zh, zh-TW, ja and de. Tests, each red on the old code: - TestPricedFreeIsTheProvidersOwnZero: own, plan, maker-only, unpriced and user prices. - TestPickerSaysAZeroPricedModelIsFree: Option.Zero, cleared at once by a price the user saves. - TestZeroPricedModelsSayFree: the editor's and Routing's JSON. - zero-priced-free.test.cjs: the three surfaces, in Chromium and WebKit, at 1100 and 420px, in all 5 languages. It checks the tag's text, hover and fit, that the paid model has no tag, that a plan's free model keeps its own hover, no sideways scroll and no page errors. Broken by hand (each restored, diff checked): - The source check ignored (maker and plan $0 count): the provider test goes red on the plan model and the relay's glm-4.7-flash. - PricedFree always false: the provider, agent and gui tests go red. - The user's price ignored: the provider and agent tests go red. - The badge's o.zero / m.zero and Routing's zero dropped in app.js and routing/client.js: zero-priced-free goes red, "the $0 model has no free tag in the agent's picker". Run at this commit's tree (base |