AI-assisted developmentThe Cost of Energy API is designed to work with AI tools. Two ways to get started:
MCP Integration
Connect Claude, Cursor, or VS Code directly to the API
llms.txt
Give your AI tool full API context in one file
Prerequisites
You need an API key. Sign up at console.engrate.io and generate one.Find a system operator
Look up Swedish DSOs (system operators) using the Core API. Here we search by name:Copy the
id — you’ll use it to find tariffs in the next step.List tariffs for the operator
Fetch tariffs offered by that system operator:Each tariff has a
name, summary, eligibility criteria, and a list of tariff_components. Copy the id of the tariff you want to inspect.Fetch the full tariff
Get the complete tariff with all its calculation pipelines:This is the full tariff with its tariff components — the individual cost items like energy tax, subscription fees, or transfer charges. Each component includes a machine-readable calculation pipeline that describes exactly how to compute the cost.Notice the
datasets field on each component — these are the inputs the pipeline needs. The Energiskatt component requires quarter-hourly-energy-offtake (consumption data in kWh), while Abonnemangsavgift requires no input data at all (it’s a fixed monthly fee).Calculate costs
Call the Calculate endpoint with the tariff ID and the required dataset(s). Here we calculate for a 30-minute window with two quarter-hourly consumption readings:The response breaks down the cost per component. Each component returns its intermediate and final datasets, so you can see exactly how the numbers were derived:
- Energiskatt: 1.5 kWh × 0.36 SEK/kWh = 0.54 SEK, and 1.2 kWh × 0.36 SEK/kWh = 0.432 SEK
- Abonnemangsavgift: Fixed 187.50 SEK/month
What’s next
Calculation Pipelines
Understand the expression engine that powers all cost calculations
API Reference
Full reference for tariffs, components, functions, and endpoints
MCP Integration
Connect your AI tools directly to the Cost of Energy API
Authentication
API key management and security best practices