# Cloud cost

Bring daily spend from AWS, Google Cloud, Cloudflare, Vercel, PlanetScale, GitHub, OpenRouter, Anthropic, OpenAI and Morph into Maple, break it down by service, provider, region, resource and account, and set budgets that open alert incidents.

**Cloud cost** reads what your providers bill you each day and puts it next to your telemetry. Open it from **Cloud cost → Spend** in the sidebar (`/cost`). It is in beta and open to every organization.

## Who can do what

| Action                               | Permission                                                      |
| ------------------------------------ | --------------------------------------------------------------- |
| Open the Cost and Budgets pages      | Read telemetry                                                  |
| Add, replace or remove a cost source | Manage integrations                                             |
| Create, edit or delete a budget      | Manage SLOs and budgets                                         |

See [Roles and permissions](/docs/reference/roles) for which roles hold them.

## Add a source

1. Open **Cloud cost → Spend**.
2. Click **Add a cost source** (or **Add source** in the header once you have one).
3. Pick a provider. The list is split into **Cloud and platforms** and **AI**.
4. Follow the provider's step: paste a credential, pick a connected account, or turn on a module on an existing integration. Each provider is described below.

Maple checks every pasted credential with the provider before saving it, and stores it encrypted. Maple only reads cost with it.

Vercel, PlanetScale, Cloudflare, OpenRouter, Anthropic, OpenAI and Morph allow one source per organization. AWS, GitHub and Google Cloud can have several.

If your provider is missing, click **Don't see your provider? Request it** in the picker.

## Sources

| Provider     | What Maple needs                                                  | Split by                                    | History on add     |
| ------------ | ----------------------------------------------------------------- | ------------------------------------------- | ------------------ |
| AWS          | The **Cost** module on an [AWS connection](/docs/integrations/aws) | Service, region, usage type                 | 13 months          |
| Google Cloud | A [Google Cloud connection](/docs/integrations/gcp) and a BigQuery billing export | Project, service, SKU, region, resource | 13 months, as far as the export goes |
| Cloudflare   | An API token with only **Billing: Read**                          | Product, plus plan fees                     | 11 months          |
| Vercel       | The [Vercel connection](/docs/integrations/vercel)                | Product, project, region, plan fees         | 11 months          |
| PlanetScale  | The [PlanetScale connection](/docs/integrations/planetscale), with invoice access | Database and branch          | 12 months          |
| GitHub       | The [GitHub App](/docs/integrations/github), with organization **Administration: Read** | Product, SKU, repository | 3 months           |
| OpenRouter   | A management key                                                  | Model and serving provider                  | 28 days            |
| Anthropic    | An Admin API key                                                  | Model and workspace                         | 3 months           |
| OpenAI       | An Admin API key                                                  | Model and project                           | 3 months           |
| Morph        | An API key                                                        | Model                                       | 3 months           |

"History on add" is how far back Maple reads when you add the source: back to the first day of the month that many months ago (OpenRouter: days). Maple reads this month and the last first, then fills older months in the background.

Every source reports **billed** amounts: the money the provider says it charged, not usage multiplied by a list price. The newest days are marked as not final until the provider stops revising them (see [How fresh the numbers are](#how-fresh-the-numbers-are)).

Only AWS charges for the requests Maple makes. Google Cloud has no request price, but each sync runs one BigQuery query that Google bills to your project. Every other provider's requests are free.

### AWS

AWS cost comes through an existing [AWS connection](/docs/integrations/aws). Turn on the **Cost** module under **What Maple collects** on the AWS source's Connection tab, then deploy the stack again so the role gets the module's policy. Once the role can read cost, the account shows up on the Cost page on its own. Choosing AWS in the picker opens the connect flow if you have no AWS connection yet.

The Cost module's policy allows read-only Cost Explorer and cost-optimization calls, including `ce:GetCostAndUsage`, `ce:GetCostAndUsageWithResources`, `ce:GetCostForecast`, `ce:GetDimensionValues`, `ce:GetTags` and the Savings Plans and reservation coverage, utilization and recommendation reads. Maple reads daily cost by service, region and usage type.

AWS bills USD 0.01 for each Cost Explorer request Maple makes, usually a few dollars a month per account. To bound it, each source has a monthly request budget: after 500 requests in a month Maple stops reading older history until the next month, and at 1,500 it stops reading until the next month. That keeps the charge to about USD 15 a month per AWS source. The Sources panel shows the requests made this month.

### Google Cloud

Google has no cost API, so Maple reads your [Cloud Billing export to BigQuery](https://cloud.google.com/billing/docs/how-to/export-data-bigquery-setup). The standard export works; the detailed export also names each resource.

1. Connect the project through the [Google Cloud integration](/docs/integrations/gcp) with **Metrics and resources** on. Maple reads the export as that connection's read-only service account, which exists only while Metrics and resources is on.
2. Choose **Google Cloud** in the picker and pick the connection.
3. Enter the **Billing export table** ID, as `project.dataset.table` or `project:dataset.table`.
4. Run the commands Maple shows once in Cloud Shell. They enable the BigQuery API on the connection's project, grant the read-only account `roles/bigquery.jobUser` on that project, and `roles/bigquery.dataViewer` on the export table only:

```bash
gcloud services enable bigquery.googleapis.com --project=HOST_PROJECT
gcloud projects add-iam-policy-binding HOST_PROJECT \
  --member=serviceAccount:READER_ACCOUNT \
  --role=roles/bigquery.jobUser --condition=None
bq add-iam-policy-binding --table=true \
  --member=serviceAccount:READER_ACCOUNT \
  --role=roles/bigquery.dataViewer \
  BILLING_PROJECT:DATASET.TABLE
```

Maple fills in the project, the account and the table for you. Each sync runs one query, billed to the connection's project, usually a fraction of a cent. Credits are kept apart from charges. Removing the source leaves the export, its grants and the connection in place.

### Cloudflare

Cloudflare cost uses an API token of its own, not the Cloudflare integration's OAuth connection.

1. In the picker, choose **Cloudflare** and follow **Create a token with only Billing: Read**. It opens Cloudflare's token page with the name filled in and the one permission, **Account → Billing → Read**, ticked.
2. Under **Account Resources**, pick the one account. Set an expiry if you want one.
3. Create the token and paste it into **API token**.

Maple refuses a token it finds can read account members, Workers scripts, audit logs or zones. It does not check for other permissions, so give the token **Billing: Read** only. It reads daily charges by product, plus plan fees. Cloudflare's newest day trails today by one day.

### Vercel

Vercel cost reads through your [Vercel connection](/docs/integrations/vercel); nothing is pasted. The connection's token needs one of these roles on the team: Owner, Member, Developer, Security, Billing or Enterprise Viewer. Maple reads what Vercel bills the team each day by product, project and region, plan fees included.

If Vercel rejects the team's token, the source stops syncing. Replace the token on the Vercel connection to resume.

### PlanetScale

PlanetScale cost reads through your [PlanetScale connection](/docs/integrations/planetscale). The connection's authorization must include the organization `read_invoices` scope. If it was authorized without it, the picker asks you to **Reconnect PlanetScale** first.

PlanetScale bills by the month, so Maple spreads each invoice line evenly over the days its branch ran. The days of an open month can change until the invoice closes. Maple re-reads the whole open month on each sync.

### GitHub

GitHub cost reads an organization's billing usage report through the GitHub App you already installed; no key is needed. Choose **GitHub** in the picker and add the organizations you want.

- The organization must accept the App's organization **Administration: Read** permission. If it hasn't, the add is refused with a link to the GitHub App settings.
- Only organization accounts have a billing report; personal accounts can't be added.
- The organization must be on GitHub's enhanced billing platform.

Maple reads daily billed usage by product, SKU and repository. Usage a plan allowance or a public repository made free counts as zero billed.

### OpenRouter

Create a key under [Management keys](https://openrouter.ai/settings/management-keys) in OpenRouter and paste it into **Management key**. A regular API key can't read spend. Maple reads daily spend by model and serving provider. OpenRouter keeps only the last 30 days, so a new source starts 28 days back, and its newest day trails today by one day.

### Anthropic

Create a key under [Admin keys](https://platform.claude.com/settings/admin-keys) in the Claude Console and paste it into **Admin API key**. Anthropic has no read-only admin key, so this key can also manage your organization. Maple only reads the cost report and the organization name with it. Make a key just for Maple so you can revoke it on its own. Maple reads daily API spend by model and workspace.

### OpenAI

Create a key under [Admin keys](https://platform.openai.com/settings/organization/admin-keys) in OpenAI and paste it into **Admin API key**. A project API key can't read spend, and OpenAI has no read-only admin key, so this key can also manage your organization. Maple only reads costs with it. Make a key just for Maple. Maple reads daily API spend by model and project.

### Morph

Create a key under [API keys](https://www.morphllm.com/dashboard/api-keys) in Morph and paste it into **API key**. An organization key reads the organization's spend, a personal key your own. Morph has no read-only key, so this key can also run models; Maple only reads spend with it. Maple reads daily spend by model. A replacement key must belong to the same Morph account.

## How fresh the numbers are

Cost is per UTC day. A new source shows its first days within minutes. After that, each source syncs on this schedule:

- **Daily.** About once a day, Maple re-reads the last four days, because providers keep revising them.
- **Weekly.** About once a week, Maple re-reads the open months whole, to pick up what the provider restated. Through the 10th of a month, the previous month counts as open.
- **History.** Older months fill in one at a time until the source reaches its history limit, then the source reads **History complete**.

Days that can still change are drawn lighter in the chart, and the totals say how many of the last days are not final yet.

A failed sync is retried after 15 minutes, with the wait doubling on each failure up to a day. A source that needs you to change something (a rejected key, a missing permission) waits at least 6 hours between tries, and one the provider is throttling waits at least an hour.

### Sources panel

The **Sources** panel under the chart lists each source with its status, the day it is synced through, how far back its history goes and when it last synced. AWS rows also show the requests made this month and what they cost.

| Status                 | Meaning                                                                                  |
| ---------------------- | ---------------------------------------------------------------------------------------- |
| Synced                 | Up to date                                                                               |
| Syncing history        | Older months are still filling in                                                        |
| Waiting for first sync | Added, not read yet                                                                      |
| On hold                | Waiting on something that isn't a failure, such as AWS's monthly request budget          |
| Paused                 | The connection no longer supplies cost (for example its Cost module is off). Its history stays |
| Sync failing           | The last sync failed. The row shows the provider's error and what to do                  |

From the panel you can replace a pasted key or token (the source and its history stay), open the connection a source reads through, or remove the source. Removing a source takes its cost off the page. For sources that read through an integration, the integration itself stays connected.

Daily cost is kept for 760 days.

## Break spend down

The Cost page has a daily chart, a row of totals and a breakdown table for the time range in the header. The range runs from one day up to a year, in whole days, and defaults to the last 30 days.

**Totals.** **Cost** over the range, **Change** against the same number of days before it, and **Average per day**. Change is left blank while the previous period is still syncing or starts before the history Maple has.

**Group by.** Split the chart and table by one of:

| Group by          | What it is                                                                         |
| ----------------- | ---------------------------------------------------------------------------------- |
| Service           | The provider's own service or product (the default)                                |
| Provider          | AWS, Vercel, OpenAI and so on                                                      |
| Category          | The provider's category for the charge                                             |
| Region            | Where the provider says the charge ran                                             |
| Resource          | What a charge is billed for, where the provider names it (a Vercel project, for example). Cost without one reads **No resource** |
| Connected account | The account the source reads. A management account includes its member accounts' cost |

**Table.** Each row shows its **Cost**, **Share**, **Previous period** and **Change**. Sort by cost or by change. Select a row to drill into it: the page narrows to that row and splits by the next dimension (a service splits by region next, for example). Filters a drill-down adds show as chips beside **Group by**.

**Filters.** The filter rail lists each dimension's values with their cost. Tick values to narrow the page, or narrow a dimension to a single value. Values of one dimension add up; different dimensions narrow each other.

**Currency.** Maple sums one currency at a time. When the range has cost in more than one currency, the totals name the others, which are not added in.

The filters and grouping live in the URL, so you can share a view by its link.

## Budgets

A budget is an amount per calendar month, quarter or year over all spend or a slice of it. It opens an alert incident when the spend, or its forecast for the period, reaches a percent of the amount. Budgets are listed under **Cloud cost → Budgets** (`/cost/budgets`).

### Set a budget

1. Click **New budget** on the Budgets page, or **Set budget** on the Cost page. With filters on, the button reads **Set budget for this view** and the form starts with those filters.
2. **Name**: incidents carry it.
3. **Covers**: add filters by provider, service, category, region, resource or account. Leave it empty to cover all spend. Values of one kind add up; different kinds narrow each other.
4. **Amount**: the amount, its currency and the period (**Monthly**, **Quarterly** or **Yearly**). Periods are calendar periods in UTC, and each starts at zero. Pick a currency your providers bill in, or the budget measures nothing.
5. Set up the two alerts (see below).
6. Leave **Enabled** on and click **Create budget**.

An organization can have up to 50 budgets.

### Alerts

Each budget has up to two alerts, one per severity:

| Alert    | Default                                       |
| -------- | --------------------------------------------- |
| Warning  | Opens at 100% of the amount, on the forecast  |
| Critical | Opens at 100% of the amount, on spend so far  |

For each one, turn **Open a warning incident** or **Open a critical incident** on or off, set the percent (1% to 1,000%), and choose what it watches:

- **Spend so far**: the period's spend to date.
- **Forecast**: the spend so far at its daily rate, projected to the end of the period. No forecast is made until 3 days of the period have passed.

Pick the [notification destinations](/docs/alerting/notification-destinations) each alert notifies, up to 20. With none, the incident still opens and nobody is told.

Maple checks each enabled budget every hour. Spend follows the cost sync, so a budget catches a period trending over, not a spike within the hour. A reached alert opens an [incident](/docs/alerting/incidents) and reminds once a day while it stays open. A forecast alert clears only once the forecast falls a little under its percent, so a run rate moving day to day doesn't open and close it repeatedly. A new period clears what the last one opened. Webhook payloads for budget incidents carry the signal type `cost_budget` (see [Webhooks](/docs/reference/webhooks)).

The Budgets page shows each budget's spend this period, its forecast, its alerts and its state. Turn a budget off with its switch, or edit or delete it from its row. Deleting a budget also deletes the incidents it opened.
