What you will be able to do
- Choose between pay-per-token and provisioned throughput by weighing traffic shape against a fixed capacity bill
- Configure Unity Gateway budget thresholds with alert and block actions, and explain why a budget is not a hard spending cap
- Contrast a rate limit, which caps spend rate, with a budget, which acts after a threshold, and predict which rate limit a caller hits
- Attribute LLM spend to users, teams and projects with system.billing.usage, system.ai_gateway.external_model_spend, and service or request tags
Key concept
Unity Gateway budget — A monthly spend threshold on traffic that flows through Unity Gateway. When the near-real-time spend estimate crosses it, the budget sends an alert, blocks further requests, or both. Because enforcement runs on an estimate, it limits spend approximately and is not a guaranteed cap on the final bill.
1.Choosing a capacity mode by its cost shape
The first cost decision for an LLM workload is how its capacity is bought, and that decision is made before any budget or tag. The Foundation Model API serving modes are pay-per-token, which bills each token against a shared pool, and provisioned throughput, which bills for dedicated capacity. Each one produces a different kind of bill. With pay-per-token, the bill moves with token volume. With provisioned throughput, you pay for the capacity you hold, which is measured in model units.
Dedicated capacity also changes how the endpoint performs. Shared pay-per-token capacity competes with everyone else's traffic. Provisioned throughput endpoints offer predictable performance because dedicated resources keep latency consistent. Databricks positions provisioned throughput for workloads that require performance guarantees and recommends it for production.
Reserved provisioned throughput pushes the trade-off further. A reservation is a prepaid grant of model units for a term of 1 or 3 months, and the longer term carries a lower per-unit rate. You pay for the reserved units whether or not traffic uses them, so a reservation only pays off when steady traffic keeps those units busy. Databricks recommends reservations when you are scaling to high or sustained volumes of predictable traffic. For exploratory or low-volume traffic it points to pay-per-token. Traffic above the reserved capacity is rate-limited by default. One common pattern is to reserve a baseline for everyday traffic and configure a fallback so that bursts run on pay-per-token.
Sizing a provisioned throughput endpoint means setting a minimum and maximum tokens-per-second range that matches the expected traffic. Current models express that capacity in model units instead, and only the legacy model families still use tokens-per-second ranges set at endpoint creation.
| Consideration | Pay-per-token | Provisioned throughput |
|---|---|---|
| Capacity | Shared pool | Dedicated, reserved capacity |
| Billing | Per token, so the bill follows volume | Based on provisioned model units |
| Latency under load | Competes with other tenants' traffic | Predictable, from dedicated resources |
| Best fit | Exploratory or low-volume traffic | High or sustained volumes of predictable traffic |
Checkpoint 1 of 9· Check yourself
A support chatbot gets steady traffic around the clock and must meet a strict latency SLA. Finance also wants a monthly LLM bill they can plan for. What should the team do?
Provisioned throughput bills for the capacity you hold, not for token volume, and its dedicated resources keep latency predictable. Pay-per-token capacity is shared with other traffic, and a budget only limits spend roughly because it enforces on a near-real-time estimate, so it is not a cap on the final bill.
“Do not use this feature as a way to ensure an absolute spend cap on final billed amounts.”Source: docs.databricks.com
Checkpoint 2 of 9· Exam question
A generative AI engineer is serving a foundation model that receives a steady, predictable volume of production traffic 24/7, and the application's latency SLA requires consistently low and stable response times that cannot tolerate the variability of shared, on-demand capacity. Leadership also wants the ability to plan a fixed monthly cost for this workload rather than a variable bill tied to token volume. Which Databricks Foundation Model APIs deployment option best fits this scenario?
Correct answer: A — Provisioned throughput endpoint, with a minimum and maximum tokens-per-second range set for the expected traffic.
- A. Provisioned throughput reserves dedicated serving capacity, configured as a tokens-per-second range. That gives the stable, low latency that constant production traffic needs. It also bills for the reserved capacity instead of per token, so the monthly cost can be planned.
- B. Pay-per-token endpoints run on shared capacity, so latency depends on other tenants' load. Client-side retries and queuing only hide that variability and do not remove it. The bill still follows token volume, so a fixed monthly cost is not possible.
- C. Scheduled batch inference suits offline bulk processing of known inputs. It cannot answer live, unpredictable user requests within a latency SLA, because responses are computed before the requests exist. It also does not reserve any capacity for the serving path.
- D. An external model endpoint only proxies calls to the third party's on-demand API. Latency then depends on that provider's shared capacity, and usage is billed by the provider rather than as reserved Databricks capacity. It meets neither the stable-latency nor the fixed-cost requirement.
2.Attributing spend with billing tables and tags
Before you can control spend, you need to know who and what is generating it. For Databricks-hosted models, cost attribution starts in system.billing.usage. Unity Gateway adds service metadata to the MODEL_SERVING records in that table, for both real-time and batch requests routed through it. Each record can then be grouped by the model service that received the request, the destination model that handled it, the principal that issued it, and the service's tags.
| Field | Answers |
|---|---|
| usage_metadata.ai_gateway.endpoint_name | Which model service received the request |
| usage_metadata.ai_gateway.destination_model | Which model handled it |
| identity_metadata.run_by | Which user or service principal issued it |
| custom_tags | Service tags such as team or cost_center |
SELECT
identity_metadata.run_by AS run_by,
SUM(usage_quantity) AS dbus
FROM system.billing.usage
WHERE billing_origin_product = 'MODEL_SERVING'
AND usage_metadata.ai_gateway.endpoint_name IS NOT NULL
AND identity_metadata.run_by IS NOT NULL
AND usage_unit = 'DBU'
AND usage_date >= current_date() - INTERVAL 30 DAYS
GROUP BY run_by
ORDER BY dbus DESC;The query returns DBUs. To turn them into dollars, join system.billing.list_prices at the price that was in effect for each record. The result is a list-price figure: it leaves out negotiated discounts and billing credits, so it works for attribution and trend analysis, but reconciliation still uses the billing statement. Requests to external models go to a different table, system.ai_gateway.external_model_spend. It records estimated USD spend, aggregated hourly, computed from token usage and the provider's published prices. For the request-level view, the usage tables (token counts and endpoint metadata) show which callers consumed the tokens behind a cost.
Knowing the user tells you who spent the money, but not which team or project to charge it to. Tags fill that gap, and there are two kinds. A service tag is set once on a model service, and every request through that service inherits it, so service tags fit when each team owns its own service. A request tag is set by the caller on each request through a header, so request tags fit when many teams share one service.
Databricks-Ai-Gateway-Request-Tags: {"project": "chatbot", "team": "ml-platform"}| Tag type | Set by | system.billing.usage (Databricks-hosted models) | system.ai_gateway.external_model_spend |
|---|---|---|---|
| Service tag | Admin, once per model service | Yes, in custom_tags | Yes |
| Request tag | Caller, per request | No | Yes |
Checkpoint 3 of 9· Fill the gap
This query ranks users and service principals by the DBUs they used on Unity Gateway model services that serve Databricks-hosted models. Which table belongs in the FROM clause?
SELECT
identity_metadata.run_by AS run_by,
SUM(usage_quantity) AS dbus
FROM ?
WHERE billing_origin_product = 'MODEL_SERVING'
AND usage_metadata.ai_gateway.endpoint_name IS NOT NULL
AND identity_metadata.run_by IS NOT NULL
AND usage_unit = 'DBU'
AND usage_date >= current_date() - INTERVAL 30 DAYS
GROUP BY run_by
ORDER BY dbus DESC;For Databricks-hosted models, cost attribution starts in system.billing.usage. Unity Gateway adds endpoint_name and run_by to the MODEL_SERVING records there, and those records are measured in DBUs. external_model_spend holds estimated USD for external models only. list_prices is only joined in to turn DBUs into dollars.
Source: docs.databricks.comCheckpoint 4 of 9· Check yourself
Finance wants a dollar figure for each team's use of a Databricks-hosted model, taken from system.billing.usage. Which setup gives them that?
For Databricks-hosted models, only service tags reach custom_tags in system.billing.usage. Request tags never land in that table, so a per-team figure there needs a separate service for each team, each with its own service tag. external_model_spend covers only external models.
“Databricks-provided models: use service tags. Only service tags propagate to system.billing.usage.”Source: docs.databricks.com
3.Budgets: thresholds that alert or block
Attribution tells you where money went after it was spent. A budget acts while it is being spent. A Unity Gateway budget tracks monthly spend through filters on billing records. You can scope it to the Unity Gateway product alone, or include Unity Gateway in an account-wide budget. For budgets scoped to Unity Gateway, alerts and blocking take effect within moments of crossing a threshold.
A budget only sees spend that flows through Unity Gateway. Inside its reach:
- pay-per-token usage
ai_query- Genie
- external model providers, if you select Include external model usage
Two kinds of spend fall outside every budget: provisioned throughput, and traffic sent directly to standalone Model Serving endpoints without passing through Unity Gateway. If a workload moves to provisioned throughput for the reasons in the first section, its budget stops seeing it.
Thresholds come in three shapes. A shared threshold is one collective limit for everyone in the budget's scope. A per-user threshold is a monthly limit applied to each user individually. A per-user override gives specific users or groups a higher limit than the default per-user threshold, and a user who belongs to several override groups gets the highest one. Each budget supports up to four shared thresholds and 20 per-user overrides, and an account can hold up to 1,000 budgets.
Each shared or per-user threshold can carry one or both of two actions. Send alert emails the configured addresses, and users keep their access. Block usage stops the user from making further requests through Unity Gateway and shows a message that their budget is exhausted. Access returns when the budget resets or an admin raises the threshold.
Budget tag filters match model service tags. To give each cost center its own budget, put the cost-center identifier on the model service as a service tag. Request tags appear in the external model spend table but have no effect on budget matching.
Checkpoint 5 of 9· Match them up
Match each Unity Gateway budget threshold type and action to its effect.
Tap a term, then the definition that fits it.
A shared threshold limits the whole scope as one group. A per-user threshold limits each person separately, and an override raises that limit for specific users or groups. Send alert only sends a notification. Block usage cuts off further requests until the budget resets or an admin raises the threshold.
“Per-user overrides: Grant specific users or groups a higher spending limit than the default per-user threshold.”Source: docs.databricks.com
Checkpoint 6 of 9· Exam question
A platform team supports five separate agent applications, each tagged with its own cost-center identifier, all routed through a shared Unity Catalog AI Gateway endpoint. Finance wants an email alert the moment any one cost center's monthly spend on that endpoint crosses $2,000, and they want the option to automatically block further requests from that cost center once the threshold is hit. Which Databricks feature should the team configure?
Correct answer: A — Create a budget filtered on the cost-center tag with a monthly dollar threshold, and enable usage blocking at that limit.
- A. A Databricks budget can be filtered on custom tags such as cost-center identifiers. It tracks spend against a monthly dollar threshold and sends alerts when the threshold is reached. Its optional usage-blocking setting then stops further requests, so it covers both the per-cost-center alert and the automatic block.
- B. A tokens-per-minute rate limit controls request throughput, not cumulative dollar spend over a month. Sizing it from expected volume would only approximate cost. It sends no email when a cost center crosses $2,000, and it does not track spend per cost-center tag. It therefore meets neither the alerting requirement nor the spend-based blocking requirement.
- C. Billing usage data carries custom tags, so a scheduled SQL alert can email finance about per-tag spend. But the alert only runs on its schedule, so it cannot fire the moment the threshold is crossed. It is also notification-only and cannot stop further requests. That fails the requirement for an option to block the cost center automatically.
- D. Endpoint permissions such as CAN QUERY control which principals may call the endpoint. They measure no spend and raise no alert. The cost-center tags identify applications and are not the principals the permissions are granted to. Revoking access only after finance reports an overspend is a manual response, not an alert at the moment spend crosses $2,000 or an automatic block.
Sources7
4.Why a budget is not a hard spending cap
Budgets make decisions from a near-real-time estimate of cost, so blocking happens only approximately. That has three practical effects. A user can be blocked before their actual spend reaches the threshold. Some spend can pass the threshold before enforcement kicks in. And requests already running when the threshold is crossed finish, so a long generation that started at $4,999 completes. Databricks states plainly that a budget should not be used to guarantee an absolute cap on final billed amounts, and it may later adjust budget estimates to match actual costs.
The billed figures come from elsewhere. system.billing.usage is the source of truth for Databricks-billed usage, and for external models the provider's invoice is the source of truth. Budget enforcement does not wait for either: it runs on its own near-real-time tracking, independent of when the system tables refresh.
Not necessarily. Each source updates at its own rate. The alert email shows spend at the moment it fired, the budget details page refreshes often, system.billing.usage updates every few hours, and system.ai_gateway.external_model_spend updates hourly. Querying the system tables soon after an alert can return a lower figure, and that is expected.
Checkpoint 7 of 9· Check yourself
An admin sets a shared threshold of $10,000 with Block usage on a Unity Gateway budget for pay-per-token traffic. Which end-of-month result is consistent with how that budget enforces the limit?
Block usage acts on a near-real-time estimate, so some spend can go past the threshold before enforcement takes effect, and requests already in progress are not interrupted. That is why Databricks says a budget is not a guaranteed cap. Enforcement also does not wait for system.billing.usage to refresh.
“Active requests in progress when the threshold is reached are not interrupted.”Source: docs.databricks.com
Sources7
5.Rate limits: capping the rate of spend
A budget reacts once a monthly total is crossed. A rate limit works earlier, on how fast spend can accumulate. Gateway rate limits per endpoint, user and group cap requests per minute (QPM) or tokens per minute (TPM) on a model service, so they bound throughput and therefore the rate at which tokens can be billed. No threshold has to be crossed first. A caller over the limit gets HTTP 429 and should retry with exponential backoff. No rate limits exist until you configure them.
Knowing which limit applies tells you who gets throttled. The service limit is a global ceiling on all traffic: once it is exceeded, every request to the service is blocked, whatever the user or group limits say. Below that ceiling, each caller is held to their own limit. Custom limits override the User (Default) limit, and a limit set on an individual user or service principal takes priority over a group limit. So a user with a low custom limit gets 429s while the service as a whole is far below its ceiling, and other users are unaffected. When a principal has both a QPM and a TPM limit, the more restrictive one applies.
| Aspect | Budget | Rate limit |
|---|---|---|
| What it limits | Monthly spend total | Requests or tokens per minute |
| When it acts | After a threshold is crossed | On every minute of traffic |
| Action | Alert email, block usage, or both | HTTP 429 to the excess requests |
| Granularity | Shared, per-user, per-user overrides | Service, user default, custom user or group |
The two controls answer different requests from finance. "Email us and stop this cost center at $2,000 a month" is a budget, since a TPM limit has no idea what the month has cost so far. "No single caller may burn tokens faster than X" is a rate limit, since a budget does nothing until a total is reached.
Checkpoint 8 of 9· Check yourself
On one model service, the rate limits are a 50,000 TPM service limit, a 10,000 TPM User (Default) limit and a 20,000 TPM limit for the analysts group. The service principal etl-bot belongs to analysts and also has its own custom limit of 2,000 TPM. Total traffic on the service is 15,000 TPM, and etl-bot is sending 5,000 TPM of it. What happens?
The service limit is only a global ceiling. Below it, each caller is held to their own limit, and a limit set on an individual user or service principal takes priority over a group limit. So etl-bot is throttled at 2,000 TPM while the rest of the service is unaffected.
“If a user belongs to both a user-specific limit and a group-specific limit, the user-specific limit is enforced.”Source: docs.databricks.com
Checkpoint 9 of 9· Exam question
An engineer configures a rate limit on a Unity Catalog AI Gateway model serving endpoint and sets both a service-level limit and a lower custom limit for one specific user. During testing, that user's requests are throttled with HTTP 429 responses well before the service-level limit is reached, while other users are not. Why does this occur?
Correct answer: A — The per-user rule set for that caller overrides the endpoint-wide cap, so their requests are counted against the smaller number and rejected sooner.
- A. AI Gateway rate limits are layered, and a limit configured for a specific user takes precedence over the endpoint-wide limit for that user. That user is therefore throttled with 429s once they reach their own lower threshold. Other callers are governed only by the service-level limit, so they are unaffected.
- B. A pooled user-group limit would throttle the other members of the group at the same moment, but only one user is throttled. A limit was also configured for that specific user, so it is that individual limit being enforced, not a shared group budget.
- C. An upstream provider quota applies to the endpoint's shared credentials, so every caller would see 429s at the same time, not just one user. The throttling also matches the custom per-user limit the engineer configured, which the gateway itself enforces before any provider quota is reached.
- D. Serving capacity is shared by all callers of the endpoint, so exhausting it would slow or reject other users' requests as well, yet they are unaffected. The rejections are also tied to the user-specific rate limit that was configured, not to autoscaling behaviour.
Sources8
Sources
(8)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Provisioned throughput provides endpoints with optimized inference for foundation model workloads that require performance guarantees.”
↩︎ Choosing a capacity mode by its cost shape - 2.
“Predictable performance: Dedicated resources ensure consistent latency”
↩︎ Choosing a capacity mode by its cost shape - 3.https://docs.databricks.com/aws/en/machine-learning/foundation-model-apis/reserved-provisioned-throughputOfficial docs
“A longer term carries a lower per-unit rate.”
↩︎ Choosing a capacity mode by its cost shape“If your traffic is exploratory or low-volume, see pay-per-token or priority pay-per-token.”
↩︎ Choosing a capacity mode by its cost shape“Traffic above your reserved capacity is rate-limited, not served automatically on pay-per-token.”
↩︎ Choosing a capacity mode by its cost shape - 4.
“provision inference capacity based on tokens per second ranges configured during endpoint creation”
↩︎ Choosing a capacity mode by its cost shape - 5.
“Unity Gateway provides cost attribution through the billable usage system table (system.billing.usage).”
↩︎ Attributing spend with billing tables and tags - 6.
“Dollar estimates in this tutorial are based on list price. They exclude negotiated discounts and billing credits.”
↩︎ Attributing spend with billing tables and tags“Databricks-provided models: use service tags. Only service tags propagate to system.billing.usage.”
↩︎ Attributing spend with billing tables and tags“Databricks-provided models: use service tags. Only service tags propagate to system.billing.usage.”
↩︎ Exam trap 3 - 7.
“Send alert: Sends an email notification to configured addresses. Users retain access to Unity Gateway.”
↩︎ Budgets: thresholds that alert or block“Block usage: Prevents the user from making further requests through Unity Gateway.”
↩︎ Budgets: thresholds that alert or block“Budget tag filters apply to model service tags.”
↩︎ Budgets: thresholds that alert or block“Active requests in progress when the threshold is reached are not interrupted.”
↩︎ Why a budget is not a hard spending cap“system.billing.usage: Updates every few hours.”
↩︎ Why a budget is not a hard spending cap“Budgets help you monitor and control monthly Unity Gateway spend using filters applied to billing records.”
↩︎ Key concept“Do not use this feature as a way to ensure an absolute spend cap on final billed amounts.”
↩︎ Exam trap 1“Provisioned throughput inference is not currently tracked.”
↩︎ Exam trap 2“Do not use this feature as a way to ensure an absolute spend cap on final billed amounts.”
↩︎ Checkpoint“Provisioned throughput inference is not currently tracked.”
↩︎ Prediction“Per-user overrides: Grant specific users or groups a higher spending limit than the default per-user threshold.”
↩︎ Checkpoint - 8.
“Rate limits let you enforce consumption limits on a model service or MCP service to manage capacity and costs.”
↩︎ Rate limits: capping the rate of spend“The service rate limit is a global maximum.”
↩︎ Rate limits: capping the rate of spend“Individual users or service principals: These take priority over user group custom rate limits.”
↩︎ Rate limits: capping the rate of spend“Individual users or service principals: These take priority over user group custom rate limits.”
↩︎ Exam trap 4“If a user belongs to both a user-specific limit and a group-specific limit, the user-specific limit is enforced.”
↩︎ Checkpoint