{
  "id": 1858218,
  "title": "A 2-Token Prompt and a 39,966-Token Bill: Measuring What My Agent Actually Costs",
  "url": "https://urgent.news/2026/08/19/a-2-token-prompt-and-a-39-966-token-bill-measuring-what-my-agent",
  "topic": "ai",
  "section": "AI",
  "published": "2026-08-19T03:38:03.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/enjoy_kumawat/a-2-token-prompt-and-a-39966-token-bill-measuring-what-my-agent-actually-costs-445b"
  },
  "original_language": "en",
  "account": "A recent trend of posts has arisen, focusing on the evaluation of LLM invoices and the discrepancies found within cost calculators. The author was preparing to check their own invoice, only to encounter a significant issue first. The git_commit.py script, which converts git diffs into Conventional Commit messages, utilizes the Claude CLI without a dedicated API key. This design choice meant that there was no per-key usage dashboard, making it impossible to audit costs directly. The script, however, had been sending a model call for each commit, without any insight into the associated costs.\n\nThe author discovered that the default output format of the Claude CLI call discarded crucial details, such as the number of tokens used in the process. As a result, the cost calculations were inaccurate, as they only considered the length of the prompt and not the extensive cached data generated by the model. To rectify this, the author added the --output-format json flag, which allowed them to parse the response and extract the total cost in USD.\n\nBefore implementing the change, the author ran a test to assess the impact of the modification. By providing a simple prompt, they observed that the input tokens were 2, while the billed input tokens were a massive 39,966. This stark contrast highlighted the significant discrepancy between the prompt's length and the actual input tokens processed by the model. Even after addressing the initial issue, the author noticed that the output tokens increased from 4 to 313 when the flag was omitted, demonstrating how context injected into the model call affected the overall output.",
  "summary": "There is a small cluster of posts going around right now about auditing your LLM invoice, and about how cost calculators get the numbers wrong. I went to check mine and hit a problem before I got to the arithmetic: my pipeline doesn't produce an invoice, and the plumbing I built two months ago is the reason why. This project has a script, git_commit.py , that turns a staged git diff into a…",
  "key_points": [
    "Author discovered Claude CLI's token discrepancy in gitcommit.py script",
    "Default output format omitted crucial token details, leading to inaccurate cost calculations",
    "Adding --output-format json flag revealed 39,966 billed input tokens vs. 2 prompt tokens"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}