Skip to content

Add Models-page sort options to the API pricing page - #366

Draft
sabrinaaquino wants to merge 3 commits into
mainfrom
cursor/add-pricing-page-sorting-d128
Draft

Add Models-page sort options to the API pricing page#366
sabrinaaquino wants to merge 3 commits into
mainfrom
cursor/add-pricing-page-sorting-d128

Conversation

@sabrinaaquino

@sabrinaaquino sabrinaaquino commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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:

Section Columns
Chat Name, Input, Output, Cache Read, Context, Newest
Embeddings Name, Input, Newest
Image, Audio, Music, Video Name, Price, Newest

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.js
    • PRICING_SORT_FIELDS maps each sortable column to its accessor and default direction; PRICING_SECTION_FIELDS picks which columns each section offers.
    • comparePricingField() is a null-safe comparator that pushes missing values to the end.
    • sortModelList() now accepts field:direction from 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

  • Sorting and filtering are purely client-side. The static Markdown tables in pricing.mdx (what agents and no-JS clients read) are unchanged, and scripts/generate-pricing-static.js still reports the page as up to date.
  • The Web Search & Scraping section has no model list, so it keeps no controls.
  • main has been merged in, including the #387 refactor that moved the model snapshot out of model-search.js into data/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:

  • Chat exposes the six columns it displays; Image exposes the generic Price column and not the token columns.
  • Output sorts ascending, and clicking again flips to descending — a column the previous dropdown could not reach at all.
  • Input sorts independently of Output, and exactly one chip is ever active.
  • Filtering gemini narrows 107 rows to 5, every remaining row matches, the count reads "5 matches", the active sort survives, and the input keeps focus.
  • No page errors.

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.

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>
@mintlify

mintlify Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
veniceai 🟢 Ready View Preview Jul 28, 2026, 6:07 AM

@mintlify

mintlify Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
veniceai 🟡 Building Jul 28, 2026, 6:06 AM

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.
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.

2 participants