Snowflake Gen AI Governance · Topic 12 of 15
Tracking Model Usage, Usage Quotas and Tags for AI Cost Attribution
Track Cortex model usage with ACCOUNT_USAGE views, enforce per-user quotas, use budgets and tags or QUERY_TAG to attribute AI costs to teams and projects.
- 4 min
- Quotas: per user, can block, evaluated in minutes; budgets: per object, monthly, up to hours of delay.
- Cortex Search: resource budgets, not quotas. Analyst: not a quota domain.
- QUERY_TAG and user tags attribute cost.
What it is
You cannot govern what you cannot see. Tracking model usage means finding out who used which model, how many tokens and credits it cost, and which team to charge. Snowflake gives you three layers: usage views that record what happened, quotas and budgets that limit what may happen, and tags that group spend by team, project or cost center.
How it works
Tracking usage
The primary views live in SNOWFLAKE.ACCOUNT_USAGE. One view per feature is the pattern, and each is covered in detail on the next page.
| Feature | Primary view |
|---|---|
| AI functions called from SQL | CORTEX_AI_FUNCTIONS_USAGE_HISTORY |
| Cortex REST API | CORTEX_REST_API_USAGE_HISTORY |
| Cortex Analyst | CORTEX_ANALYST_USAGE_HISTORY |
| Cortex Search | CORTEX_SEARCH_DAILY_USAGE_HISTORY |
| Cortex Agents | CORTEX_AGENT_USAGE_HISTORY |
| Provisioned throughput | CORTEX_PROVISIONED_THROUGHPUT_USAGE_HISTORY |
| Guardrails | CORTEX_AI_GUARDRAILS_USAGE_HISTORY |
Total credits per service come from METERING_HISTORY and METERING_DAILY_HISTORY. Search embedding tokens may appear in both the Search and the AI functions views, so check before summing them.
The AI functions view CORTEX_AI_FUNCTIONS_USAGE_HISTORY has a documented latency of up to five minutes. Its rows carry USER_ID, QUERY_ID, QUERY_TAG, MODEL_NAME and FUNCTION_NAME. Long-running queries are split into hourly rows, so group by QUERY_ID for a per-query total.
SELECT DATE_TRUNC('day', START_TIME) AS day, FUNCTION_NAME, MODEL_NAME, SUM(CREDITS) AS credits
FROM SNOWFLAKE.ACCOUNT_USAGE.CORTEX_AI_FUNCTIONS_USAGE_HISTORY
WHERE START_TIME >= DATEADD('day', -30, CURRENT_TIMESTAMP())
GROUP BY ALL
ORDER BY credits DESC;
Requests made through the REST API have no per-call row in the AI functions view; use CORTEX_REST_API_USAGE_HISTORY for them. Total cost of an operation adds warehouse time, so join query_id, warehouse_id and user_id across views.
Usage quotas
A per-user quota sets a credit limit for each user individually. Quotas cover warehouse compute and several AI domains: AI functions, Cortex Agents, Cortex Code, AI Gateway and Snowflake Intelligence.
- Limits are per user and are never pooled: a 100-credit quota across 10 users permits up to 1,000 credits in total.
- Cycles can be monthly, weekly or daily, in UTC.
- Evaluation happens within minutes, and with block enforcement on, Snowflake denies further AI requests for users at their limit. Blocks lift when the cycle resets.
- Usage can overshoot slightly before the block applies.
- Quotas have built-in block enforcement; budgets act through your procedures.
| Control | Blocks usage | Scope | Delay to act |
|---|---|---|---|
| Per-user quota | Yes, when enabled | Each user | Minutes |
| Resource budget | No, runs your stored procedure | One object | Up to about 8 hours (2 with low latency option) |
| Shared resource budget | Via your procedure, for example revoking a role | Users grouped by tag | Same as budgets |
Support differs by feature. Cortex Agents, Snowflake Intelligence and Cortex AI functions take quotas. Cortex Search uses resource budgets and is not a quota domain. Cortex Analyst and fine-tuning are not quota domains either.
A budget watches spend and calls your procedure at a threshold. It does not stop usage by itself. Use a quota when the requirement is to block.
Tagging and attribution
Three tools attribute cost:
- Tags on users for shared resource budgets. Create a tag such as
cost_center, set it on each user, and link the tag to the budget. One shared feature can then be split across several budgets. - Tag-based cost attribution on a tagged Cortex Agent for resource budgets.
QUERY_TAGsession parameter. Snowflake recommends teams set it so AI function cost can be attributed by project or team in the usage view.
CREATE TAG cost_mgmt_db.tags.cost_center ALLOWED_VALUES 'finance_dept', 'marketing_dept';
ALTER USER IF EXISTS "user_1" SET TAG cost_mgmt_db.tags.cost_center = 'finance_dept';
ALTER SESSION SET QUERY_TAG = 'project_churn_model';
Tag changes can take up to about eight hours to apply to a budget.
Common mistakes
Pooling quotas. A quota is per user, not shared.
Expecting a budget to block. Budgets act through procedures, with delay.
Putting the tag on the agent for a shared budget. The tag goes on users.
Counting Search embeddings twice in two views.
Reading the AI functions view per row for long queries. Group by QUERY_ID.
What to remember for the exam
- Quotas: per user, can block, evaluated in minutes; budgets: per object, monthly, up to hours of delay.
- Cortex Search: resource budgets, not quotas. Analyst: not a quota domain.
- QUERY_TAG and user tags attribute cost.
- The AI functions view is
CORTEX_AI_FUNCTIONS_USAGE_HISTORY.
Check yourself
Which control actually blocks a user who reached the limit?
A per-user quota with block enforcement enabled.
How do you attribute AI function cost to a project?
Set the QUERY_TAG session parameter and group the AI functions usage view by QUERY_TAG.
Where do you put the tag for a shared resource budget?
On the users whose consumption should count, not on the agent.
Topic 12 of 15 in Snowflake Gen AI Governance
Test yourself on Snowflake Gen AI Governance
The full Snowflake GES-C02 question bank has 585 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Snowflake. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.