pub fn message_bytes(messages: &[Message]) -> usizeExpand description
Size of a message list, for the purpose of tracking how it changes.
Image payloads are deliberately excluded. Base64 is enormous per token — llama-server tiles an image to a fixed count regardless of its size, and a 5.7 MB screenshot and its 179 KB re-encoding both priced at 294 tokens — so counting those bytes would say a turn grew by megabytes when it grew by a few hundred tokens. The cost is real and it is already in the anchor, which is a measurement of the whole request; what this walk has to track is the part that grows every turn, which is text.