Back to feed
Dev.to
Dev.to
7/22/2026
The original title is "I Couldn’t Fix My LLM Costs Until I Measured Tokens Per Feature"

The original title is "I Couldn’t Fix My LLM Costs Until I Measured Tokens Per Feature"

Original: I Couldn’t Fix My LLM Costs Until I Measured Tokens Per Feature

Short summary

Token costs can't be optimized without knowing which feature generates them. The author tags every LLM call with feature, operation, and customer tier metadata, then logs token usage per request to a JSONL file. This lets teams pinpoint whether cost growth comes from chat traffic, bloated prompts, retries, or wrong model selection—each requiring a different fix.

  • Provider dashboards group usage by model, not by feature—useless for product cost decisions
  • Tag every LLM call with feature, operation, and tier metadata in your own usage records
  • A minimal Node.js client implementation logs per-request token usage to JSONL for analysis

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more