Snowflake AI Cost Optimization: Where the Spend Comes From, How to Detect It, and How to Control It Snowflake AI workloads, including Cortex AI Inference and Search, create credit-intensive costs that traditional warehouse dashboards miss because a single application request can bundle LLM inference, document fetches, multiple SQL queries and model evaluations. The article recommends a FinOps architecture that separates anomaly detection from remediation and provides Snowflake Account Usage queries against METERING_DAILY_HISTORY, CORTEX_AI_FUNCTIONS_USAGE_HISTORY and CORTEX_SEARCH_DAILY_USAGE_HISTORY to attribute AI credits by function, model, query and database. It warns that the service-name filter in the metering query is a discovery tool rather than complete billing reconciliation and that combining AI Functions and Cortex Search views risks double-counting embedding credits. Understanding and controlling costs of Snowflake AI from Cortex AI Inference & Search, through to experimental development, retries and out-of-control workloads. Snowflake AI brings a new complexity to managing costs. Snowflake has traditionally been optimized around warehouse sizes, query performance, auto suspend, storage and pipeline costs. With AI workloads there are some new complexities. An application request could contain many elements including, LLM inference, document fetch, multiple SQL queries and multiple model evaluations. During experimentation a developer could make many AI requests, often without knowing they have created dozens of AI requests. The main issue with Snowflake AI is that it is a credit intensive process and can be a bit of a stealth cost. This makes it hard to track with traditional dashboards. In this article I will discuss: Depending on the feature, deployment type and pricing, there can be a number of costs associated with your AI workloads. Not all AI costs will be warehouse related. There may be multiple costing elements including AI service usage, warehouse compute and additional service costs. Before you start calculating any costs, please check your current pricing documentation for your region, cloud and contract. The credit rate and metering will depend on the feature. A good FinOps architecture for AI will allow you to understand where costs are being used, who is using them project/developer , identify anomalies and allow for the correct remediation. Reference Architecture for AI Consumption Monitoring, Attribution, Anomaly Detection and Remediation. It is important to ensure that your detection and remediation are separated. When you identify an anomaly you should investigate. If you want to automatically cancel production AI workloads you need a higher level of protection. The queries below utilizeSnowflake Account Usage views. They are a good starting point for building your operational cost monitoring tool. SELECT USAGE DATE, SERVICE TYPE, SUM CREDITS USED AS CREDITS USEDFROM SNOWFLAKE.ACCOUNT USAGE.METERING DAILY HISTORYWHERE USAGE DATE = DATEADD DAY, -30, CURRENT DATE AND SERVICE TYPE ILIKE '%AI%' OR SERVICE TYPE ILIKE '%CORTEX%' OR SERVICE TYPE ILIKE '%COCO%' GROUP BY 1, 2ORDER BY USAGE DATE DESC, CREDITS USED DESC; This provides a high-level breakdown of metered AI-related services. Treat the service-name filter as a discovery query, not a complete billing reconciliation: confirm the service types in your account against Snowflake’s current metering documentation. SELECT FUNCTION NAME, MODEL NAME, COUNT DISTINCT QUERY ID AS QUERY COUNT, ROUND SUM CREDITS , 4 AS AI CREDITSFROM SNOWFLAKE.ACCOUNT USAGE.CORTEX AI FUNCTIONS USAGE HISTORYWHERE START TIME = DATEADD DAY, -7, CURRENT TIMESTAMP GROUP BY 1, 2ORDER BY AI CREDITS DESC; This helps identify which functions and models consume the most AI credits. The view records AI-function credits separately from warehouse credits, and long-running queries can have multiple hourly records. SELECT QUERY ID, MODEL NAME, FUNCTION NAME, MIN START TIME AS FIRST SEEN, MAX END TIME AS LAST SEEN, SUM CREDITS AS AI CREDITSFROM SNOWFLAKE.ACCOUNT USAGE.CORTEX AI FUNCTIONS USAGE HISTORYWHERE START TIME = DATEADD DAY, -7, CURRENT TIMESTAMP GROUP BY 1, 2, 3ORDER BY AI CREDITS DESCLIMIT 25; This is particularly useful for finding bulk AI processing queries that invoke a model across many records. SELECT DATABASE NAME, SCHEMA NAME, SERVICE NAME, CONSUMPTION TYPE, ROUND SUM CREDITS , 4 AS CREDITSFROM SNOWFLAKE.ACCOUNT USAGE.CORTEX SEARCH DAILY USAGE HISTORYWHERE USAGE DATE = DATEADD DAY, -30, CURRENT DATE GROUP BY 1, 2, 3, 4ORDER BY CREDITS DESC; The consumption categories distinguish serving, embedding, and batch usage. When combining this view with AI Functions usage, avoid double-counting embedding credits. First, assign meaningful query tags in your development sessions: ALTER SESSION SET QUERY TAG = 'project=ai cost monitor;env=dev;team=data engineering'; Then investigate the most expensive AI queries alongside query history: WITH AI COST AS SELECT QUERY ID, SUM CREDITS AS AI CREDITS FROM SNOWFLAKE.ACCOUNT USAGE.CORTEX AI FUNCTIONS USAGE HISTORY WHERE START TIME = DATEADD DAY, -7, CURRENT TIMESTAMP GROUP BY QUERY ID SELECT Q.USER NAME, Q.QUERY TAG, COUNT AS QUERY COUNT, ROUND SUM A.AI CREDITS , 4 AS AI CREDITSFROM AI COST AJOIN SNOWFLAKE.ACCOUNT USAGE.QUERY HISTORY Q ON A.QUERY ID = Q.QUERY IDGROUP BY 1, 2ORDER BY AI CREDITS DESC; This attributes AI-function spending to the SQL user and query tag where query-history records are available. It does not necessarily identify the end user behind a shared service account. An effective monitoring system should distinguish a normal increase in usage from an abnormal one. For example, suppose your development environment usually consumes 10 AI credits daily, but suddenly consumes 80. Illustrative AI credit consumption Friday’s eightfold increase deserves investigation, but is not automatically evidence of waste. A simple first step is to compare today’s usage with the previous seven days. WITH DAILY AS SELECT USAGE DATE, SUM CREDITS USED AS CREDITS FROM SNOWFLAKE.ACCOUNT USAGE.METERING DAILY HISTORY WHERE SERVICE TYPE = 'AI FUNCTIONS' AND USAGE DATE = DATEADD DAY, -8, CURRENT DATE GROUP BY 1 ,BASELINE AS SELECT AVG CREDITS AS AVG CREDITS FROM DAILY WHERE USAGE DATE BETWEEN DATEADD DAY, -7, CURRENT DATE AND DATEADD DAY, -1, CURRENT DATE SELECT D.USAGE DATE, D.CREDITS, B.AVG CREDITS, ROUND D.CREDITS / NULLIF B.AVG CREDITS, 0 , 2 AS BASELINE MULTIPLIERFROM DAILY DCROSS JOIN BASELINE BWHERE D.USAGE DATE = CURRENT DATE ; This example monitors the AI FUNCTIONS service type. For a complete AI budget, reconcile all applicable AI service types rather than relying on a single category. Daily metering may also be delayed, so use the appropriate feature-specific views for more timely detection. Development is one of the easiest places to accumulate AI spending without noticing it. Consider a developer building a product-review classification pipeline. The initial experiment processes 100 customer reviews. Everything works, so the developer runs the same logic against 100,000 records. But the SQL query invokes an AI function once per row. The result is potentially 100,000 model evaluations from a single SQL statement. Here are common development scenarios that create unexpected costs. SELECT REVIEW ID, AI SENTIMENT REVIEW TEXT AS SENTIMENTFROM CUSTOMER REVIEWS; This is straightforward SQL, but processing a large table can generate substantial AI usage. A safer development approach: SELECT REVIEW ID, AI SENTIMENT REVIEW TEXT AS SENTIMENTFROM CUSTOMER REVIEWSWHERE REVIEW TEXT IS NOT NULLORDER BY REVIEW IDLIMIT 100; The second query limits the input to 100 records. It is useful for controlled experimentation, although you should not assume that adding LIMIT to every SQL shape guarantees a corresponding reduction in AI evaluations. For expensive workloads, explicitly materialize the sample before invoking AI. CREATE OR REPLACE TEMP TABLE REVIEW SAMPLE ASSELECT REVIEW ID, REVIEW TEXTFROM CUSTOMER REVIEWSWHERE REVIEW TEXT IS NOT NULLORDER BY REVIEW IDLIMIT 100; SELECT REVIEW ID, AI SENTIMENT REVIEW TEXT AS SENTIMENTFROM REVIEW SAMPLE; This creates a bounded input dataset before inference begins. I recommend a five-layer approach. Snowflake now documents AI-specific resource and shared budgets, as well as per-user quotas for supported features. Budget actions are periodic rather than instantaneous; quotas can block additional requests more quickly. For an organization introducing Snowflake AI, I would start with these policies: These controls should be applied based on workload criticality. A research experiment and a customer-facing production application should not have identical enforcement rules. One of the most useful metrics is not simply total credits. It is cost per successful business outcome. For example, suppose a document classification application consumes 120 credits to process 40,000 documents, of which 36,000 are successfully classified. These are illustrative calculations, not observed Snowflake performance. An optimization that reduces total credits but significantly increases classification errors may actually worsen business economics. Track inference cost alongside accuracy, latency, retries, and successful outcomes. A practical Snowflake AI FinOps rollout can be organized into four phases. As Snowflake AI adoption grows, cost optimization must extend beyond warehouse sizing and query tuning. AI workloads introduce new consumption patterns: token processing, document extraction, search serving, multi-step agent execution, and repeated development experimentation. The most effective approach is to establish visibility first, identify which workloads drive spending, then introduce controls that preserve useful AI capabilities without allowing uncontrolled consumption. The objective is not to minimize every AI credit. It is to ensure that every AI workload delivers measurable value at a predictable cost. The question data engineering teams should ask is no longer just, “How much did Snowflake cost?” It is, “Which AI workloads created that cost, why did they consume those resources, and what value did we receive?” Snowflake AI Cost Optimization: Where the Spend Comes From, How to Detect It, and How to Control It https://pub.towardsai.net/snowflake-ai-cost-optimization-where-the-spend-comes-from-how-to-detect-it-and-how-to-control-it-a31acff1a8de was originally published in Towards AI https://pub.towardsai.net on Medium, where people are continuing the conversation by highlighting and responding to this story.