Repository navigation
Token estimates
Necessary request context is the baseline. Whole-file sizes are not a universal substitute.
---
config:
theme: base
themeVariables:
primaryColor: "#CCE4F7"
primaryTextColor: "#1A1A1A"
primaryBorderColor: "#2D7FD3"
lineColor: "#0067C0"
secondaryColor: "#FAFAFA"
tertiaryColor: "#F3F3F3"
---
flowchart TD
task["Alternative task context known?"] -->|No| unknown["Cannot estimate"]
task -->|Yes| seen["Already in cloud context?"]
seen -->|Yes| zero["No source-reading credit"]
seen -->|No| credit["Credit only declared necessary context"]
zero --> cost["Subtract complete response and request overhead"]
credit --> cost
cost --> result["Conditional saving or additional tokens"]
For an explicit text scenario: S - V - 2R, where S is necessary unseen source context,
V the complete visible response and R the request. Local generation is not automatically
credited as avoided cloud generation. Unknown provenance or an unknown baseline remains unknown.
For log triage with a custom question, the comparison baseline is UNKNOWN; the entire
log is not credited as avoided context. In compiler-log triage, the model-generated answer
to that question is reported separately from the strictly verified diagnostic inventory.
Example: a 100,000-token file, a 4,000-token task
If the task needs 4,000 source tokens, the returned response is 600 and the request is 100,
the illustrative comparison is 4,000 - 600 - 200 = 3,200, not 99,200.
If the source was already read, its credit becomes zero and the same call adds 800 tokens.
This example is not a measured result or an account charge.
Try the illustrative calculator · Full methodology and limits.
Source: dedd223a9af7. Changes via pull request.
MIT · Source · Privacy · Code signing policy