Add Models-page sort options to the API pricing page - #366
Draft
sabrinaaquino wants to merge 3 commits into
Draft
Conversation
Adds a Sort dropdown (Recommended, Newest, Oldest, Name A-Z, Price Low->High, Price High->Low) to each pricing section (Chat, Embeddings, Image, Audio, Music, Video), reusing the model browser's dropdown component, options, and i18n. Sorting is client-side; the static markdown fallback that agents read is unchanged. Co-authored-by: Sabrina Aquino <sabrinaaquino@users.noreply.github.com>
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
The per-section Sort dropdown offered a single generic "Price" option, which resolved to input price for chat models and silently ignored output cost -- usually the larger half of a bill -- with nothing in the UI naming the column being sorted. Output price, cache read and context were visible on every row but not sortable at all. Replace the dropdown with one chip per column the table actually shows: Name, Input, Output, Cache Read, Context and Newest for chat, and Name, Price and Newest for the sections priced as a single figure. Clicking a chip sorts by it and shows the direction, clicking the active chip flips it. Models missing a value now sink to the bottom rather than sorting as zero, which had parked them above the cheapest models in a price sort. Each section also gets a filter box with a live match count, since the chat table runs to over a hundred models and sorting alone still left a long scroll. Sorting and filtering remain client-side; the static Markdown tables that agents and no-JS clients read are unchanged.
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
The API pricing page (
overview/pricing.mdx) rendered each model table in a fixed order with no way to reorder it, which came up in #proj-docs-redesign. This adds per-column sorting and a filter box to every pricing section.Both the pricing page and the Models page are rendered client-side by
model-search.js, so the sort logic is shared between them.Sorting by the columns you can see
Every row already displays Input Price, Output Price, Cache Read and Context. The first pass at this PR exposed a single generic Price option, which resolved to input price for chat models and silently ignored output cost — usually the larger half of a bill — with nothing in the UI naming the column being sorted.
That's now one chip per column the table actually displays:
Clicking a chip sorts by it and shows the direction with an arrow; clicking the active chip flips it. Prices start cheapest-first and Context starts largest-first. Recommended restores the original per-table ordering (Chat = API order, Image = non-beta then price high→low, Video/Music = alphabetical).
Models missing a value now sink to the bottom instead of being treated as zero, which previously parked them above the cheapest models in a price sort.
Filtering
Each section gets a filter box matching on model name and ID, with a live match count. The chat table runs to over a hundred models, so sorting alone still left a long scroll. Filtering preserves the active sort, and the input keeps focus and caret position as you type.
What changed
model-search.jsPRICING_SORT_FIELDSmaps each sortable column to its accessor and default direction;PRICING_SECTION_FIELDSpicks which columns each section offers.comparePricingField()is a null-safe comparator that pushes missing values to the end.sortModelList()now acceptsfield:directionfrom the pricing page alongside the preset values the Models browser passes, so both share one code path.filterModelsByText()narrows a section's models by name or ID.mountPricingSection()owns the sort bar, per-section state, and repaint. Chips are updated in place rather than re-rendered so the filter input doesn't lose focus.style.css— styling for.vpt-sort-bar, the chips and the filter input, using the existing Venice action colour and control tokens, with a mobile breakpoint that gives the filter its own row.Notes
pricing.mdx(what agents and no-JS clients read) are unchanged, andscripts/generate-pricing-static.jsstill reports the page as up to date.mainhas been merged in, including the #387 refactor that moved the model snapshot out ofmodel-search.jsintodata/static-models.json.Testing
Verified in a headless Chrome harness that serves the repo and mounts the real pricing placeholders against the built
model-search.js— 12 checks, all passing:gemininarrows 107 rows to 5, every remaining row matches, the count reads "5 matches", the active sort survives, and the input keeps focus.Also smoke-tested the Models browser, since
sortModelList()is shared: it renders and its Price: Low to High preset still works, with no console errors.