Skip to content

Course · Pi · Models & config

Models & config

The course so far has been about the window: watch a single turn happen before trusting it with anything real (you can’t budget work you’ve never seen run once); open the box (four tools and one short system prompt, the whole fixed cost, readable end to end); admit the box fills up anyway (the session outlives the window, and something gets dropped whether you chose it or not).

This module moves off the window and onto the bill. It’s not about what’s in the context anymore. It’s about what you’re charged for spending it - the cost principle’s home chapter: the same tokens cost different amounts depending on which model reads them and how hard it thinks first, and both of those are dials you control, not defaults you inherit.

Here’s the claim this module spends its three lessons proving: route the same four-row slice of the backlog (small enough to check by hand, standing in for the few hundred) through the wrong dial settings and you’ll pay roughly fifteen times more for identical output - not because the work changed, but because you were billed to think about work that needed no thinking. That number isn’t a teaser. You’ll rederive it by hand in the routing lesson, from the same two multipliers the module keeps reusing.

Here’s where it starts. Your .pi/APPEND_SYSTEM.md means you’ve stopped re-explaining stash’s conventions every session - that problem stays solved. But the parse fixes from the start of the week left residue in stash.db (the feed-reader project’s database): entries saved during the broken-parse window, when parse_date was dropping offsets and fetch_feed couldn’t see the Atom namespace, sit there with a missing published, an empty link, or a blank summary - and a few feeds synced to nothing at all before the fix landed. That’s the re-extraction backlog.

The sweep through it is mechanical: row by row, fetch the feed, parse it with the now-fixed code, upsert the result. A few hundred rounds of the same three steps, nothing to think about - and safe to run now that the context chapter’s duplicate-rows fix (a unique index on articles.link plus an insert that skips conflicting links) means a re-sync no longer doubles what’s already stored. Pi runs it on whatever model you’ve been using for everything else, at whatever reasoning depth you left the dial.

If that’s the same frontier model you want reasoning carefully about how fetch_feed should treat a malformed feed, you just paid careful-reasoning prices for a few hundred rounds of fetch, parse, upsert. Multiply that by every mechanical chore stash generates and the bill stops looking like rounding error.

  • Find the files first. Before you can route anything you need to know which config actually wins when you’ve got both a global setup and a project one. Two files, one merge walks ~/.pi/agent/settings.json against .pi/settings.json, plus the sibling files - models.json, auth.json, trust.json - that config splits across.
  • Turn the dials on purpose. Pi actually gives you two independent levers - which model answers, and how hard it thinks before it does - and stash’s lumpy workload is exactly what makes misusing them expensive. Route the cheap work to the cheap model sets both, per task, on the same shared toy sweep, and hand-traces the bill each way.
  • Take a model off the meter entirely. Not every stash chore needs a hosted model at all. Run a model on your own machine traces that same sweep through a local model, then puts all three options in one table so you know which to reach for.

None of this is exotic. It’s the same instinct the last three modules kept returning to - spend on purpose, not by habit - aimed at the two things that actually cost money in Pi’s config surface: which model picks up the work, and how long it’s allowed to think about it. (Pricing itself, and how the six coding tools this site covers compare on it, is the Foundations model-selection chapter’s job; this course is where you turn Pi’s version of that dial by hand.)

The dial was always there. Most sessions just never touch it.

Start with the config files.