# Datadog API Cost Calculation

Finout offers a structured breakdown of Datadog costs by Datadog products and additional tags using an [estimated cost summary API](https://docs.datadoghq.com/account_management/plan_and_usage/cost_details/) for a detailed product cost breakdown. Each day, the API reports the total cost accumulated so far in the month. For example, on the 3rd of the month, the data reflects the total for the 1st, 2nd, and 3rd days combined. To isolate the cost for just the 3rd, we subtract the cumulative cost up to the 2nd from that of the 3rd. This difference gives us the specific cost for the 2nd day.

## On-Demand vs. Commitment Costs <a href="#h_8176c02208" id="h_8176c02208"></a>

### Datadog on-demand costs <a href="#h_55c5daa7d9" id="h_55c5daa7d9"></a>

These represent pay-as-you-go expenses, accruing and displaying on the relevant days when on-demand usage occurs.

### Datadog commitment costs <a href="#h_50bc444216" id="h_50bc444216"></a>

Commitment costs are usually displayed on the 1st of every month, while on-demand costs will be presented on the day they occur.

Commitment costs can be categorized into different models:

* Usage-based- In this model, your commitment costs are based on a predetermined “bank” of usage. Once you run out of your usage, on-demand charges kick in.
* Host/ Hourly commitment- An hourly commitment is set, beyond which on-demand rates are applicable.

## Finout’s Model for Commitment Costs Across the Month <a href="#h_7d8867512a" id="h_7d8867512a"></a>

### API Cost (“Unblended Costs”) <a href="#h_6952293c32" id="h_6952293c32"></a>

Unblended costs represent the expenses as received from Datadog. In the case of commitments, these are shown on the 1st of the month, while on-demand costs are displayed on the relevant day of usage.

### “Amortized” Costs <a href="#h_81276fc4cf" id="h_81276fc4cf"></a>

Finout uses the [usage API](https://docs.datadoghq.com/api/latest/usage-metering/) to divide these costs across all days of the month to spread out the commitment cost throughout the month.

* Usage-based- Finout’s algorithm calculates daily costs based on usage, adapting the rate based on historical and current monthly data. Since the discounted rate isn't reflected in the API and may vary, Finout's dynamic adjustment, leveraging the data received through the APIs, ensures the most current and precise cost representation.

  <div align="left"><figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FrPdHFNjV5tYejNtaQEpi%2Fimage.png?alt=media&#x26;token=053916de-79db-4860-9e9e-81d44119516e" alt=""><figcaption></figcaption></figure></div>

  <figure><img src="https://finout.intercom-attachments.eu/i/o/8842538/5d19bfb85a5a0c59970ba3dc/kcKxZvaIgI-pmNvUEKj2qOf2V3xFwL2yOttKbwLHhu4C8BSGE3L7f8wiL4oXyvKU0J6LCMIgGdL1eRHJAqLVzp24OuaeT_GRAPbJ0bKmwh8OUfIgYOwUGnaquTFKDprOg2Wc7hL-OayFVKCqZrLGiNY?expires=1725881400&#x26;signature=2f6d4403d7364ad5720a46a4985de8506fcf750841e78f79f3326b0d317e7f9c&#x26;req=2N1rx135pHsp0xr0v9tnpHEk%2FjXpfFNH2mYtmAfyulv5m5dcFhAycG5cbTkw%0A" alt=""><figcaption></figcaption></figure>
* Host- The commitment is evenly divided across the month's total hours, ensuring a consistent and understandable cost breakdown.

  <div align="left"><figure><img src="https://3858159242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWqjB2puKXPDR7L86FX2e%2Fuploads%2FEIRDbbnkOakoXsX810un%2Fimage.png?alt=media&#x26;token=50a6578e-4b9b-4250-b2a8-9b886795d762" alt=""><figcaption></figcaption></figure></div>

  <figure><img src="https://finout.intercom-attachments.eu/i/o/8842539/f0f368172111ed69facf3cfd/gKTiIjDyGo2G2Hgt3haNaGtiWALkgYccYnrCesT7Dgt28bntXyCTxKzglNQO8DBWNwRodSoMax9Edt1_iuPbprZAJBLfvxnO1Zzo89XOcjWflP-TsuKg7b2WENRSbDVU01Eh9QC4WJy4ch-40kAJqiE?expires=1725881400&#x26;signature=46574ec48cfaca9f812044e030a183715c4b822796a56fd88b9d5254a720a607&#x26;req=2N1rx135pXsp0xr0v9tnpJVfn0n47yZXGOze0fp5Zq7jEF6ZQg5UUx9ZVqrh%0A" alt=""><figcaption></figcaption></figure>

### Reasoning for Infra host, APM hosts, and Timeseries cost spikes on the 1st of the month <a href="#h_a45345ee32" id="h_a45345ee32"></a>

1. Infra host, APM host products-[ The monthly cost is updated daily based on the top 99th](https://docs.datadoghq.com/account_management/plan_and_usage/cost_details/) percentile of usage, with the final cost confirmed on the last day of the month.

   Datadog tracks hourly host counts for Infrastructure and APM [billing](https://docs.datadoghq.com/account_management/billing/), with end-of-month billing based on the 99th percentile usage. The billable host count is calculated using the highest count in the lower 99% of usage hours, excluding the top 1%, to mitigate the impact of usage spikes.
2. Timeseries (custom metrics)- The billable count for custom metrics is determined by averaging the number of custom metric hours over the month. Your monthly billable count for custom metrics (reflected on the Usage page) is calculated by taking the total of all distinct custom metrics recorded each hour throughout the month and dividing this month’s cumulative hours to receive a monthly average value.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.finout.io/billing-integrations/observability-platforms/connect-to-datadog/datadog-api-cost-calculation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
