/token-cost:token-costfrom token-cost
Use when the user invokes /token-cost or asks for the floor / bedrock / self-cost / "real" price of LLM tokens on a self-hosted server — the physical lower bound from electricity plus hardware amortization, NOT the market API price. The skill measures power draw and generation speed ON the server (nvidia-smi, streaming benchmark) and asks for electricity tariff, hardware cost and amortization period, then prints cost per 1M input/output tokens. Triggers: "сколько на самом деле стоит токен", "цена самохоста", capacity and break-even planning.
Ships in token-cost. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Estimate the lower bound of a self-hosted token: electricity plus hardware amortization. This is the bedrock below which a token physically cannot cost; it is NOT the market price (training, salaries, rent, margin are ignored on purpose). Method from the article "Почём нынче токен для народа?" (@evilfreelancer).
C_1M = ((P_kW * T_kWh + S / H_life) * 1e6) / (R_tok_s * 3600)
P_kW real power draw under load (kW) - T_kWh tariff (RUB/kWh)S hardware cost (RUB) - H_life lifetime hours = years36524R_tok_s speed (decode for output, prefill for input)Compute input and output separately: prefill is many times faster than decode, so the input token is that many times cheaper. Electricity is the absolute floor; amortization is the realistic one and is usually the bigger number.
| Input | How to get it |
|---|---|
P_kW power | Measure while the model is generating: token_cost.py measure-power --overhead-w 150 (overhead = CPU + board + PSU loss, since nvidia-smi only sees GPUs; raise to 200–300 W on heavy Xeon/EPYC). Falls back to --power-kw only when nvidia-smi is unreachable. |
R_tok_s decode + prefill | Measure against the running endpoint: bench_speed.py. Or read tok/s from the serving engine logs (vLLM/llama.cpp). Else ask the user. Always two numbers, never one. |
T_kWh tariff | Ask the user (regional, e.g. ~6.97 RUB/kWh for Saint Petersburg). |
S hardware cost | Ask the user. Omit for an electricity-only floor. |
H_life years | Ask; default 5. |
| utilization | Ask; default 1.0. If the GPU is idle part of the time, amortization per useful token rises (50% busy ⇒ doubles). |
Do not invent missing numbers. If you cannot measure P_kW or R_tok_s and the user has not provided them, STOP and tell the user the exact command from this skill to run. Nameplate TDP, guessed tok/s, and "typical" decode rates are not acceptable substitutes — substituting them produces a number that looks like a floor but isn't.
--overhead-w for the
non-GPU draw (CPU, board, PSU loss); nvidia-smi only sees the GPUs.bench_speed.py against the endpoint for decode and prefill tok/s.# Measure real power while the model generates (sum of GPUs + overhead) -> kW
python3 scripts/token_cost.py measure-power --overhead-w 150
# Measure decode + prefill speed against an OpenAI-compatible endpoint
python3 scripts/bench_speed.py --base-url http://localhost:8000 --model gpt-oss-120b
# Full estimate (measuring power live), with amortization
python3 scripts/token_cost.py compute \
--measure-power --overhead-w 150 \
--tariff 6.97 --decode-tok-s 90 --prefill-tok-s 1440 \
--hw-cost 700000 --life-years 5 --utilization 1.0
# Pure math, electricity-only (no hardware), power given
python3 scripts/token_cost.py compute --power-kw 0.5 --tariff 6.97 --decode-tok-s 90
Run any script with --help for all flags.
From the source article, 2×RTX 4090 48 GB running GPT-OSS-120B, Saint Petersburg tariff ≈ 6.97 RUB/kWh, hardware ≈ 700 000 RUB, 5-year amortization, utilization 1.0:
Use this only as a sanity check against the user's own measurements — never as a substitute for them, and never present it as the user's actual cost.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
token-cost@rpa-skills is listed by evilfreelancer/rpa-skills — review the source before installing
npx claudepluginhub evilfreelancer/rpa-skills --plugin token-cost