{
  "claim": "A semantic grep is O(lines) model calls, and the bill scales with the corpus on every query, not once per index. One pass over this site's own prose costs about eleven cents and cannot finish faster than 83 seconds at the published rate limit.",
  "method": "The first two rows are printed by jev-semgrep itself (it reports `N/M lines (K sent), R requests, T input tokens` to stderr when interactive) and are quoted from its README. The rest are computed from a token model fitted to those rows: tokens = chars/T + 4·lines (the JSON key per line in `state`) + 25.5·lines·meanings (the per-question cost, whose marginal 24.0 tokens/line/meaning is the difference between the README's 1-meaning and 3-meaning totals over the same 51-line file, divided by two). T is the corpus's chars-per-token; solving the 51-line row gives T = 1.73 for that Japanese-heavy fixture, and T = 4 is used for the English rows. Requests are ceil(lines / 30) at the default --chunk. Wall clock is requests ÷ 1,200 per minute, the documented rate limit — a floor, not a measurement, and it ignores the 20,000-character chunk cap, which none of these corpora reach.",
  "source": "github.com/uehaj/jev-semgrep README.md and semgrep.mjs (v0.2.1); docs.typesafe.ai/models for $0.042/Mtok input and 1,200 requests/minute on jev-1.13.0; content/**/*.mdx in this repository measured at 49,490 non-blank lines and 4,956,205 characters",
  "captured": "2026-09-19",
  "note": "Output tokens are metered free, so input is the whole bill. The last row is the one to read twice: BM25 over the same corpus is the ranking function this site already runs at /api/search, with no model call, no key, and no per-query cost at all.",
  "columns": [
    { "key": "what", "label": "corpus and query", "align": "left" },
    { "key": "lines", "label": "lines sent", "align": "right", "mono": true },
    { "key": "requests", "label": "requests", "align": "right", "mono": true },
    { "key": "tokens", "label": "input tokens", "align": "right", "mono": true },
    { "key": "cost", "label": "cost", "align": "right", "mono": true },
    { "key": "floor", "label": "≥ wall clock", "align": "right", "mono": true },
    { "key": "basis", "label": "basis", "align": "left" }
  ],
  "rows": [
    {
      "what": "tests/corpus.txt, 1 meaning",
      "lines": "51",
      "requests": "2",
      "tokens": "3,225",
      "cost": "$0.00014",
      "floor": "0.1 s",
      "basis": "measured (README)"
    },
    {
      "what": "tests/corpus.txt, 3 meanings",
      "lines": "51",
      "requests": "2",
      "tokens": "5,673",
      "cost": "$0.00024",
      "floor": "0.1 s",
      "basis": "measured (README)"
    },
    {
      "what": "this site's content/, 1 meaning",
      "lines": "49,490",
      "requests": "1,650",
      "tokens": "~2,700,000",
      "cost": "$0.11",
      "floor": "83 s",
      "basis": "computed"
    },
    {
      "what": "this site's content/, 3 meanings",
      "lines": "49,490",
      "requests": "1,650",
      "tokens": "~5,220,000",
      "cost": "$0.22",
      "floor": "83 s",
      "basis": "computed"
    },
    {
      "what": "1,000,000 English lines, 1 meaning",
      "lines": "1,000,000",
      "requests": "33,334",
      "tokens": "~54,500,000",
      "cost": "$2.29",
      "floor": "28 min",
      "basis": "computed"
    },
    {
      "what": "this site's content/, BM25 (what /api/search runs today)",
      "lines": "49,490",
      "requests": "0",
      "tokens": "0",
      "cost": "$0.00",
      "floor": "in-memory",
      "basis": "the existing route"
    }
  ]
}
