---
title: Monitor model serving costs
description: Learn how to use billing system tables to monitor the cost of Model Serving endpoints in your account.
canonical_url: https://docs.databricks.com/aws/en/admin/system-tables/model-serving-cost
---

# Monitor model serving costs

This article provides examples of how to use [system tables](https://docs.databricks.com/aws/en/admin/system-tables/index.md) to monitor the cost of Model Serving endpoints in your Databricks account.

## Requirements

* To access system tables, your workspace must be enabled for Unity Catalog. For more information, see [Enable system tables](https://docs.databricks.com/aws/en/admin/system-tables/index.md#enable).

## Billing usage system table SKU

You can track model serving costs in Databricks using the [billable usage system table](https://docs.databricks.com/aws/en/admin/system-tables/billing.md). After the billing usage system table is enabled, the table automatically populates with the latest usage in your Databricks account. Costs appear in the `system.billing.usage` table with column `sku_name` as one of the following:

| `sku_name`                                              | Description                                                                                                                                                                                     |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `<tier>_SERVERLESS_REAL_TIME_INFERENCE_LAUNCH_<region>` | This SKU includes all DBUs accrued when an endpoint starts after scaling to zero.                                                                                                               |
| `<tier>_SERVERLESS_REAL_TIME_INFERENCE_<region>`        | All other model serving costs are grouped under this SKU. Where `tier` corresponds to your Databricks platform tier and `region` corresponds to the cloud region of your Databricks deployment. |

## Query and visualize usage

You can query the `system.billing.usage` table to aggregate all DBUs (Databricks Units) associated with Model Serving. The following is an example query that aggregates model serving DBUs per day for the last 30 days using SQL:

```sql

SELECT SUM(usage_quantity) AS model_serving_dbus,
usage_date
FROM system.billing.usage
WHERE sku_name LIKE '%SERVERLESS_REAL_TIME_INFERENCE%'
GROUP BY(usage_date)
ORDER BY usage_date DESC

LIMIT 30
```

### Batch inference workloads usage

You can query the `system.billing.usage` table to isolate DBUs (Databricks Units) that have been used for batch inference workloads.

```sql

SELECT *
FROM system.billing.usage u
WHERE u.workspace_id = <workspace_id>
  AND u.billing_origin_product = "MODEL_SERVING"
  AND u.product_features.model_serving.offering_type = "BATCH_INFERENCE"

```

For a list of all model serving endpoints that have batch inference workloads, use the following:

```sql

SELECT DISTINCT(usage_metadata.endpoint_name)
FROM system.billing.usage
WHERE u.workspace_id = <workspace_id>
  AND u.billing_origin_product = "MODEL_SERVING"
  AND u.product_features.model_serving.offering_type = "BATCH_INFERENCE";

```

See [ View costs for batch inference workloads](https://docs.databricks.com/aws/en/large-language-models/ai-functions.md#batch-cost) for additional examples.

## Cost observability dashboard

To help you get started monitoring your model serving costs, download the example cost attribution dashboard from GitHub. See [Model Serving cost attribution dashboard](https://github.com/databricks-demos/dbdemos-notebooks/blob/141d6f9addeae3a39898b0f810d50b7370d5090c/product_demos/Unity-Catalog/uc-04-system-tables/_resources/dashboards/model-serving-cost.lvdash.json).

After you download the JSON file, import the dashboard into your workspace. For instructions on importing dashboards, see [Import a dashboard file](https://docs.databricks.com/aws/en/dashboards/automate/import-export.md#import).

## How to use this dashboard

This dashboard is powered by [AI/BI](https://docs.databricks.com/aws/en/ai-bi/index.md) and you need to have access to the system tables. It provides insights of your serving endpoint costs and usage at the workspace-level.

The following steps get you started:

1. Enter the workspace ID.
2. Select the start date and end date.
3. Filter the dashboard by selecting the specific endpoint name in the dropdown list (if you are interested in a particular endpoint).
4. Separately, enter the tag key if you use any custom tags for your endpoint.

You can also use [budgets](https://docs.databricks.com/aws/en/admin/account-settings/budgets.md) to manage alerts.

> [!NOTE]
>
> Model Serving enforces default limits on the workspace to ensure that there is no runaway spend. See [Model Serving limits and regions](https://docs.databricks.com/aws/en/machine-learning/model-serving/model-serving-limits.md).

### Charts you can use

The following charts are included in this dashboard. These are meant to be starting point for you to build your own customized version of the model serving cost attribution dashboard.

* Last 7 Days Top Endpoint Consumption
* Daily Total $DBU Usage
* Model Serving Costs by Endpoint Type
  * Pay-Per-Token
  * CPU/GPU
  * Foundation Model
* Daily Consumption Per Model Serving Type
* Top 10 Most Costly Serving Endpoints
* Top 10 Most Costly Pay-Per-Token Endpoints
* LLM Fine tuning Last 7 days Spend
* LLM Fine tuning Spend Per Email

### Use tags to monitor costs

Initially, aggregated costs might be sufficient for observing overall model serving costs. However, as the number of endpoints increases you might want to break out costs based on use case, business unit, or other custom identifiers. Model serving supports creating custom tags that can be applied to your model serving endpoints.

All custom tags applied to model serving endpoints propagate to the `system.billing.usage` table under the `custom_tags` column and can be used to aggregate and visualize costs. Databricks recommends adding descriptive tags to each endpoint for precise cost tracking.

## Example queries

Top endpoints by cost:

```sql

SELECT
  usage_metadata.endpoint_name AS endpoint_name,
  SUM(usage_quantity) AS model_serving_dbus
FROM
  system.billing.usage
WHERE
  sku_name LIKE '%SERVERLESS_REAL_TIME_INFERENCE%'
  AND usage_metadata.endpoint_name IS NOT NULL
GROUP BY endpoint_name
ORDER BY model_serving_dbus DESC
LIMIT 30;
```

Cost with tags (“business\_unit”: “data science”) over time:

```sql

SELECT
  SUM(usage_quantity) AS model_serving_dbus,
  usage_date
FROM
  system.billing.usage
WHERE sku_name LIKE '%SERVERLESS_REAL_TIME_INFERENCE%'
  AND custom_tags['business_unit'] = 'data science'
GROUP BY usage_date
ORDER BY usage_date DESC

LIMIT 30
```

## Additional resources

For examples on how to monitor the cost of jobs in your account, see [Monitor job costs & performance with system tables](https://docs.databricks.com/aws/en/admin/system-tables/jobs-cost.md).
