Skip to content
Back to skills

Estimate Llm Cost

ASecurity

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.

  • 40 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added August 31, 2026
ai-agentspythonrust

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned August 31, 2026

npx -y skills add ContextJet-ai/awesome-llm-observability --skill estimate-llm-cost --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Estimate Llm Cost?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Estimate Llm Cost
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/contextjet-ai-estimate-llm-cost/badge)](https://www.skillsdirectory.com/skills/contextjet-ai-estimate-llm-cost)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: estimate-llm-cost
description: 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.
license: CC0-1.0
---

# 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`](scripts/llm_cost.py) is pure Python, no install needed:

```python
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.

Files in this skill

  • SKILL.md2.2 KB
  • scripts/llm_cost.py2.5 KB
  • tests/test_llm_cost.py1.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.