> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Prices and costs

> Read prices for a device or a location, and calculate costs from the meter records you submit.

| You want | Call |
| :- | :- |
| Prices for a window | [Retrieve a device price](/docs/energy-api/reference/prices/retrieve-device.md) or a [location price](/docs/energy-api/reference/prices/retrieve-location.md) |
| The best times to run a device | See [Optimizations](/docs/energy-api/guides/tariffs/optimizations.md) |
| The cost of a window or a session | [Retrieve a device cost](/docs/energy-api/reference/costs/retrieve-device.md) or a [location cost](/docs/energy-api/reference/costs/retrieve-location.md) |

## Prices

Prices are a time series in which each row has a `start_time`, an `end_time` and a `price`. Intervals vary in length, and values are in major currency units with up to 5 decimal places.

`confidence` says how firm each price is.

| `confidence` | Meaning |
| :- | :- |
| `1` | Confirmed |
| Between `0` and `1` | Estimated from the tariff and the latest market prices. Replaced when the confirmed price arrives |
| `0` | No published market price |

`price.update` fires when prices at a location change, so re-fetch prices when it does. Request only as far ahead as you need: prices far ahead are for planning. For time handling, see [Timezones](/docs/energy-api/guides/platform/timezones.md).

## Costs

Flatpeak calculates cost, or export value, from the [meter records](/docs/energy-api/guides/tariffs/meter-records.md) you submit.

| Cost of | Pass |
| :- | :- |
| A window | `start_time` and `end_time`. `aggregate_by` `DAY` or `MONTH` splits the result |
| A session, such as an EV charge | The `session_reference_id` you set on the session's meter records |

A device cost uses the device's records. A location cost uses the records submitted under the location, for the whole property, and excludes energy priced under a [device tariff](/docs/energy-api/guides/key-concepts.md#device-tariffs).

Costs split grid energy from PV energy and report `pv_savings` at the prices in force when the energy was generated. Submit PV generation as meter records with `source` `PV`; without them, Flatpeak assumes zero generation and overstates grid import.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.