public static estimateMessage(message as LLMThreadMessage, imageTokens as Int = 1024, includeAttachments as Boolean = true) as Int
Estimates text at four characters per token, with message framing. Images use a configurable heuristic, not their Base64 byte length. Actual image tokenization depends on the model and must be reconciled with usage. This method never reads an image file.
| Parameter | Description |
|---|---|
imageTokens | Estimated budget per image; default 1024, not a hard bound. |
includeAttachments | Whether local attachment names are part of the wire message. |
tokens = LLMContextUsage.estimateMessage(message, 2048)