Show HN: LangSpend – Track LLM costs by feature and customer (OpenAI/Anthropic)

langspend.com

2 points by aihunter21 17 hours ago

We're two developers who got hit twice by LLM cost problems and built LangSpend to fix it.

First: We couldn't figure out which features in our SaaS were expensive to run or which customers were costing us the most. Made it impossible to price properly or spot runaway costs.

Second: We burned 80% of our $1,000 AWS credits on Claude 4 (AWS Bedrock) in just 2 months while building prototypes of our idea but we had zero visibility into which experiments were eating the budget.

So we built LangSpend — a simple SDK that wraps your LLM calls and tracks costs per customer and per feature.

How it works: - Wrap your LLM calls and tag them with customer/feature metadata. - Dashboard shows you who's costing what in real-time - Currently supports Node.js and Python SDKs

Still early days but solving our problem. Try it out and let me know if it helps you too.

- https://langspend.com - Docs: https://langspend.com/docs - Discord: https://discord.gg/Kh9RJ5td

westurner 3 hours ago

Additional useful metrics:

TOPS/Whr: Tensor ops per watt-hour

Tokens/Whr: LLM ingress|egress tokens per watt-hour

% green energy. If 100% offset by PPAs is 100% green, is 100% directly-sourced clean energy 100% or "200% green"?

CO2 cost

/carbon.txt: https://www.thegreenwebfoundation.org/tools/carbon-txt/ :

> carbon.txt is a single, discoverable location on any domain – /carbon.txt – for public, machine‑readable sustainability data.

thegreenwebfoundation/co2.js: https://github.com/thegreenwebfoundation/co2.js .. https://www.thegreenwebfoundation.org/co2-js/

Firefox Devtools Profiler uses CO2.js to estimate carbon cost: https://www.thegreenwebfoundation.org/news/carbon-emissions-...

TCS: Tech Carbon Standard > impact categories > upstream > Foundation Models,: https://www.techcarbonstandard.org/impact-categories/upstrea... :

> In addition to the carbon footprint of AI data centres, it is essential to mention their extensive water footprint, therefore a careful examination of data centre WUE_source is indispensable.

TCS Glossary: https://www.techcarbonstandard.org/resources/glossary#water-... :

> WUE_source: Water Usage Effectiveness Source:

> A metric used to measure how efficiently data centres use water for cooling and operations. WUE is quantified in cubic meters per megawatt hour of energy (m3/MWh), representing the amount of water consumed per unit of IT equipment output or computing work. To better understand the true water cost of data centres, source (offsite) and site-based (onsite) WUE metrics must be accounted for. The Green Grid distinguishes them as WUE and (WUE_source).

"WATER USAGE EFFECTIVENESS (WUE): A GREEN GRID DATA CENTER SUSTAINABILITY METRIC" The-Green-Grid-White-Paper-35-WUE-Usage-Guidelines.pdf https://airatwork.com/wp-content/uploads/The-Green-Grid-Whit... :

> WUE_source = ( Annual Source Energy Water Usage + Annual Site Water Usage ) / IT Equipment Energy *

> WUE = ( Annual Site Water Usage ) / IT Equipment Energy

[...]

Electricitymap has average carbon costs by region, but not yet water costs IIRC

"Ask HN: Are you paying electricity bills for your service?" (2024) https://news.ycombinator.com/item?id=42454547 re: Zero Water datacenters

From https://news.ycombinator.com/item?id=45363593 (2025) : microfluidics, Graphene based CPU coolers, graphene thermal pads,

What about model routing and could split testing or multi-armed bandit identify where cost can be reduced for acceptable loss in accuracy?

Do you already log inputs and outputs?

From https://news.ycombinator.com/item?id=45267271 :

> API facades like OpenLLM and model routers like OpenRouter have standard interfaces for many or most LLM inputs and outputs. Tools like Promptfoo, ChainForge, and LocalAI also all have abstractions over many models.

> What are the open standards for representing LLM inputs, and outputs?

> W3C PROV has prov:Entity, prov:Activity, and prov:Agent for modeling AI provenance: who or what did what when.