The sessions table's model column uses COALESCE(model, ?) —
first-writer-wins, so it records only the first model and never
updates on a /model switch. Cumulative counters (input_tokens,
output_tokens, etc.) keep summing across all models, but there is
no per-model breakdown anywhere in the database — no column, no
table, no per-message model attribution.
After a mid-session model switch, /usage and /insights attribute
all tokens and cost to the single locked-in model.
The
sessionstable'smodelcolumn usesCOALESCE(model, ?)—first-writer-wins, so it records only the first model and never
updates on a
/modelswitch. Cumulative counters (input_tokens,output_tokens, etc.) keep summing across all models, but there isno per-model breakdown anywhere in the database — no column, no
table, no per-message model attribution.
After a mid-session model switch,
/usageand/insightsattributeall tokens and cost to the single locked-in model.