Cost of Energy
Optimise against the tariff you are actually billed on
The full cost stack for one meter, hour by hour: grid fees, energy tax, transfer charges, peak power fees and subscriptions. One API, every DSO we cover, and every intermediate step in the answer.
The problem
The spot price is the easy part
The spot price is a small part of your customer’s bill. Grid fees, taxes, transfer charges and a peak power fee set by a few hours a month make up the rest, and those are what a battery can actually move.
Every DSO writes those rules its own way and changes them every year. Building them one by one is how a team ends up with hundreds of special cases and no way to explain a number.
The cost stack
Everything on the bill
Five kinds of charge, modelled the same way for every DSO we cover.
Grid fees
What the DSO charges to move the energy, including time-of-use bands and seasonal rates.
Energy tax
The statutory rate that applied in the hour you are calculating, including reduced rates where they apply.
Transfer charges
Per kilowatt hour charges for energy taken from the grid, and for energy fed into it.
Peak power fees
Charges based on measured peaks, with the DSO's own definition of what a peak is and how many of them count.
Subscriptions
Fixed monthly and annual charges, including the ones that step with fuse size or connection capacity.

How it works
Every charge is a pipeline you can read
A charge is a small graph of operations: multiply, add, constant, aggregate, select. Call calculate and every step comes back with the total.
Transparent
No black boxes
Every intermediate value comes back with the result. Anything you can bill, you can explain.
Portable
Implement once
A handful of operations covers every tariff we publish. Support them once.
Stable
Rate changes land in the tariff definition
When a DSO changes its rates, the definition changes. Your integration keeps running.


Calculate or optimise
Price what happened. Plan what happens next.
Give it measured consumption and it tells you what it cost. Give it a plan instead and it tells you what that plan would cost, on the same tariff rules the invoice uses. Your optimiser plans against the real bill, not an estimate of it.
Plan a battery
Charge and discharge against peak power fees as the DSO actually measures them.
Size a connection
Compare what each fuse or capacity option would have cost against a year of measured consumption.
Price a tariff change
Put a number on what a different tariff does to a customer's bill before anyone signs anything.
Python SDK
The tariff, inside your solver
engratepy is our Python library for Cost of Energy. It prices a tariff against your own time series, or writes the tariff into your solver model.
Calculate from your own series
Pass the consumption you hold and read the cost back per tariff component.
Ask what a tariff needs
It lists the input datasets a tariff needs before you calculate anything.
Put the tariff in your solver
One call extends a HiGHS or Gurobi model in place, and cost comes back per component.
costs_per_tariff_component = await engrate.add_to_highs_model(
tariff_id=tariff_id,
start_time=...,
end_time=...,
data={dataset: {timestamp: value, ...}},
variables={dataset: {timestamp: variable, ...}},
model=model,
)
Build on it
One call returns the cost and the steps behind it
Find the DSO, read its tariff, then post the meter's consumption. The response breaks the cost down per component, and asking for the intermediate series returns every step that produced it.
curl --request POST \
--url "https://api.engrate.io/cost-of-energy/v1/calculate" \
--header "authorization: $API_KEY" \
--header "content-type: application/json" \
--data '{
"tariff_id": "0199c317-25ec-7cf7-94cc-32a39f068433",
"start_time": "2026-01-01T00:00:00+01:00",
"end_time": "2026-01-01T00:30:00+01:00",
"time_series": [
{
"name": "quarter-hourly-energy-offtake",
"values": [1.5, 1.2]
}
]
}'Or point a coding agent at our MCP server and let it do the reading: find a DSO, open a tariff, calculate a month. It works in Claude, Cursor and VS Code.
Questions
Common questions
Which markets is Cost of Energy live in?
Sweden. The model was built for every European market. Tell us which one you need and we will tell you what it takes.
Do we need to understand tariffs to use it?
No. Give it a tariff and the meter's consumption and it returns the cost per component, with every intermediate step if you ask for it.
What data do we provide?
The tariff and the meter's consumption or production in quarter-hourly values. Everything about the tariff itself is on our side and kept current as rates change.
Which DSOs are covered?
Every DSO with published tariffs in the markets we cover. A new DSO is new data on our side.
Can we use it in an optimisation model?
Yes. The Python SDK, engratepy, adds a tariff's cost terms to a HiGHS model, so a scheduler optimises against the tariff you are billed on.
Get a real number for a real meter
Bring one meter and one month. We will calculate it with you and show you every step.
Coverage
Live in Sweden
Every DSO with published tariffs, kept current as the rates change. We maintain the tariff data, so a new DSO is new data on our side.
The model was built for every European market. Tell us which one you need and we will tell you what it takes.