agentsclimarketplace

Estimate llm cost

Skill ContextJet-ai/awesome-llm-observability/skills/estimate-llm-cost

Use this to estimate what an LLM call or feature will cost, and to compare models on price, before or after shipping. Trigger on "how much will this cost", "estimate my OpenAI/Anthropic bill", "is a cheaper model worth it", "cost of this prompt", "project my LLM spend". Ships a runnable, tested calculator so the numbers are real, not hand-waved.From its SKILL.md

Install
npx -y skills add ContextJet-ai/awesome-llm-observability --skill estimate-llm-cost

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

What its file declares

Copied from the file, not written here

The file declares its own license as CC0-1.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

2.2 KB, 464 tokens by cl100k_base, as published. Nobody here has run it

Estimate LLM cost

Cost surprises come from not doing the arithmetic. This skill ships a small, dependency-free calculator so you can price a call, project a monthly bill, and compare models with actual numbers.

Use the bundled script

scripts/llm_cost.py is pure Python, no install needed:

from llm_cost import estimate_cost, project_monthly

estimate_cost(1500, 300, model="gpt-4o")                       # one call, USD
project_monthly(1500, 300, calls_per_day=5000, model="gpt-4o") # monthly projection
estimate_cost(2000, 200, model="gpt-4o", cached_input_tokens=1800)  # with prompt caching

Run it directly to see a worked example: python scripts/llm_cost.py.

Prices in the PRICES table are approximate and change often, so pass input_price/output_price explicitly when you need exact figures, or edit the table. The arithmetic (not the price table) is what the tests pin down.

How to apply it

  1. Price the call with realistic token counts (measure them from a trace, see instrument-llm-observability).
  2. Project the bill with your real call volume. A cheap call at 10k/day beats an expensive one at 10/day.
  3. Compare models by running the same tokens through two model ids. Pick the cheapest that still passes your evals (see compare-llm-models).
  4. Feed it into cost cutting (see reduce-llm-cost).

Validation

Run the tests: pytest skills/estimate-llm-cost/tests/. They check the math is exact for explicit prices, that model lookups match the table, that prompt-cache discounting is correct, and that monthly projection scales linearly.

Anti-patterns

  • Trusting the built-in price table as current (verify against provider pricing).
  • Pricing one call and forgetting to multiply by real volume.
  • Comparing models on price without checking quality holds on your eval set.

What ships with it: 2 files

3.9 KB alongside SKILL.md, 2 of them executable

scripts/

tests/

Keep looking

Skills are one crate of 326,512. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.