AI-assisted engineering/System design with AI parts

Price store search with a reranker billed per search

System design with AI partsMedium35 min

Some models bill by the token and some by the call. A search bill has both.

Your task

Declare the search pipeline, then write the function that prices it per month.

  • declare PIPELINE: one entry per step, with an eval and a fallback on every model step
  • write monthly_cost(pipeline, prices, items_per_day, days) and get the arithmetic right
  • "in" and "out" are dollars per MILLION tokens; "per_1k_runs" is dollars per THOUSAND runs of a step
  • a price a model does not list is zero; a model that lists token prices and per_1k_runs pays both
  • the cache discount applies to INPUT tokens only; a step may leave out cached_in_frac and cache_discount, and then nothing is cached
  • runs_per_item is fan-out, and it applies to per-run prices too: a step on 60 percent of requests is 0.6

design.md and cost_math.md are read by the critique, not by the suite.