1# Chapter 25: record-gates/src, a price list and a till 2 3Two files, split by whether money moves. 4 5`main.rs` is the price list. It parses the arguments, builds every gate's 6requests (the label tree's first round through postjevsql-core's search, the 7rest from jev-protocol directly), estimates their tokens with the fallback 8ratio, and prints each gate's worst case. Its header describes each run's 9shape in more detail than chapter 24 does, and it is the place to read 10before changing one. 11 12`send.rs` is the till, and runs only under `--send`. Layout parity and the 13unsure band go out as `main.rs` built them, each distinct request once, 14through jev-mock's `forward::Forward` directly, which adds the key and 15keeps the exchange. The label-tree and ranking runs start a 16throwaway Postgres from `tests/support`, serving the built extension, whose 17endpoint is a jev-mock that forwards every request to the real endpoint with 18the key and records the exchange. The label tree runs its whole search 19there, not only the round priced. Each fixture is written only if it does 20not already exist, so two runs at once cannot both write one. 21 22> **Try it.** `buck2 run //tools/record-gates:record-gates -- --model 23> jev-latest` refuses at once: the gates are recorded against a pinned 24> version, and an alias is not one. 25 26## For the people who maintain it 27 28| File | What | 29| --- | --- | 30| [main.rs](main.rs) | Arguments (`--model`, `--price-per-mtok`, `--repeats`, `--send`, `--api-key-file`, `--max-cost`, `--out-dir`, `--rerecord`), each gate's requests, and the price. | 31| [send.rs](send.rs) | `--send`: the forwarder, the throwaway Postgres for the extension's runs, and the fixtures. | 32 33← Previous: [Chapter 24, record-gates/](../) · Up: [record-gates](../) · Next: [Chapter 26, toolchains/](../../../toolchains/) →