Vertex Data

Snowflake Cortex Cost: Model It Before You Scale

Your Cortex bill spiked or you’re about to roll it out. Here’s the fastest diagnostic and a practical cost model—tokens, serverless services, and warehouse compute—plus guardrails.

Eric Provencio, Principal Analytics Engineer at Vertex Data Consulting
Eric Provencio
5 min read

Your system is noisy or expensive and you need the Snowflake Cortex cost under control. Start with a 10-minute diagnosis: list serverless services credits tied to Cortex, attribute warehouse compute from AI-generated queries, and tag what you can for separation. Then model cost from your own call volume and token profile, choose smaller models where quality holds, and stand up usage monitoring before more users pile in. The commands below are the ones we run in production when a Cortex rollout gets hot.

1) Run this diagnosis: what’s burning credits right now

First, find serverless ai services credits that look like Cortex. Then check warehouse compute. Finally, surface queries likely invoking cortex functions.

-- Serverless services by day (last 7 days)
SELECT usage_date, service_type, SUM(credits_used) AS credits
FROM SNOWFLAKE.ACCOUNT_USAGE.SERVICE_USAGE
WHERE usage_date >= CURRENT_DATE - 7
  AND service_type ILIKE '%CORTEX%' OR service_type ILIKE '%AI%'
GROUP BY 1,2
ORDER BY 1,2;

-- Warehouse compute by day (last 7 days)
SELECT DATE_TRUNC('day', start_time) AS day, warehouse_name, 
       SUM(credits_used) AS credits
FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
WHERE start_time >= DATEADD('day', -7, CURRENT_TIMESTAMP())
GROUP BY 1,2
ORDER BY 1,2;

-- Likely AI usage: find queries calling AI/Cortex features
SELECT query_id, start_time, warehouse_name, user_name, query_text
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE start_time >= DATEADD('day', -7, CURRENT_TIMESTAMP())
  AND (query_text ILIKE '%AI_%(' OR query_text ILIKE '%CORTEX%')
ORDER BY start_time DESC
LIMIT 100;

If you’re not sure which SERVICE_TYPE label maps to your account’s Cortex features, list them and inspect:

SELECT DISTINCT service_type
FROM SNOWFLAKE.ACCOUNT_USAGE.SERVICE_USAGE
WHERE service_type ILIKE '%CORTEX%' OR service_type ILIKE '%AI%'
ORDER BY 1;

Note: serverless services cost won’t show up in warehouse metering. Both views are required for a full picture.

2) Cost drivers by Cortex product (and where to see them)

Each product has different billing units. Use this as your cost breakdown checklist and verify the labels in your account-usage.

Product Primary billing unit Where it shows up Also bills warehouse?
Cortex AI functions (LLM, summarize, classify, embeddings) Tokens (credits per million tokens) SNOWFLAKE.ACCOUNT_USAGE.SERVICE_USAGE (service_type contains Cortex/AI) No
Cortex AI SQL Tokens to generate SQL SERVERLESS in SERVICE_USAGE + executed SQL in WAREHOUSE_METERING_HISTORY Yes
Cortex Analyst Messages/tokens per interaction SERVERLESS in SERVICE_USAGE + any warehouse queries it runs Yes
Cortex Search Service Indexing and serving (serverless credits) SERVERLESS in SERVICE_USAGE (search-related service_type) No

Pricing is published in the Snowflake documentation. Model the units from your own traffic; never guess. For an excellent overview of where warehouse credits go, see our Snowflake Cost Optimization.

3) Estimate token-based spend from your own volume

For LLM-style calls (summarize, classify, generate), the dominant driver is token count. Get your call volume, input size, and output size, then translate to “million tokens”. If your account exposes token metrics for AI functions in ACCOUNT_USAGE, use those. If not, log prompt and response lengths and calibrate on a sample.

-- Example: log prompts/responses to estimate tokens
CREATE OR REPLACE TABLE ops.cortex_call_log (
  ts TIMESTAMP, model STRING, op STRING, prompt_chars NUMBER, 
  response_chars NUMBER, user_name STRING
);

-- After a test run, estimate tokens (roughly 3-4 chars/token; calibrate with samples)
WITH base AS (
  SELECT *, prompt_chars/4.0 AS est_in_tokens, response_chars/4.0 AS est_out_tokens
  FROM ops.cortex_call_log
)
SELECT DATE_TRUNC('day', ts) AS day,
       model, op,
       SUM(est_in_tokens + est_out_tokens) / 1e6 AS million_tokens
FROM base
GROUP BY 1,2,3
ORDER BY 1,2;

Then apply your account’s credits per million tokens from the pricing model. Use smaller models where quality permits; the delta per million tokens is material. Keep separate logs per model so you can A/B cost and quality.

4) Control costs for Cortex AI SQL and Analyst without killing UX

Two meters tick here: token generation and warehouse compute to run the result. Put guardrails on both.

-- Isolate compute for AI SQL / Analyst on a tiny warehouse
CREATE OR REPLACE WAREHOUSE wh_ai_xs
  WAREHOUSE_SIZE = 'XSMALL'
  AUTO_SUSPEND = 10
  AUTO_RESUME = TRUE
  INITIALLY_SUSPENDED = TRUE;

-- Cap credits with a resource monitor (warehouse only)
CREATE OR REPLACE RESOURCE MONITOR rm_ai_daily
  WITH CREDIT_QUOTA = 50
  TRIGGERS ON 80 PERCENT DO NOTIFY, ON 100 PERCENT DO SUSPEND;
ALTER WAREHOUSE wh_ai_xs SET RESOURCE_MONITOR = rm_ai_daily;

-- Require a query tag for all AI-generated SQL
ALTER SESSION SET QUERY_TAG = 'ai_sql_v1';

Operational tips:

  • Smaller model first. If the UI/API lets you pick, start small and graduate selectively.
  • Preview then run. Require users to view generated SQL and confirm before execution.
  • Set statement timeouts in the app session for AI runs: ALTER SESSION SET STATEMENT_TIMEOUT_IN_SECONDS=60;
  • Restrict schemas the analyst can query; reduce blast radius and scan sizes.

How expensive is Cortex?

Answer it with your numbers: tokens per message and the warehouse scans those messages trigger. The queries in sections 1 and 3 produce that view without guesswork.

5) Isolate workloads: warehouses, tags, and logs you’ll actually use

Don’t interleave AI runs with your core ETL. Isolation gives you clean attribution and a kill switch.

-- Dedicated AI warehouse and schema for logs
CREATE OR REPLACE WAREHOUSE wh_cortex_xs WAREHOUSE_SIZE='XSMALL' AUTO_SUSPEND=10 AUTO_RESUME=TRUE;
CREATE OR REPLACE SCHEMA ops.ai_usage;

-- App-side session tagging (Python connector example)
# pip install snowflake-connector-python
import snowflake.connector as sf
ctx = sf.connect(...)
cs = ctx.cursor()
cs.execute("ALTER SESSION SET QUERY_TAG='app=cortex-agent env=prod'")

# Write minimal call logs you can aggregate later
cs.execute("INSERT INTO ops.ai_usage.call_log(ts, user_name, op) VALUES(CURRENT_TIMESTAMP(), CURRENT_USER(), %s)", ("ai_sql_generate",))

Why this bites in week two: without QUERY_TAG and a separate virtual warehouse, finance sees a blended bill with no handle to dial down. Isolation also lets you suspend only the AI surface without touching core data engineering pipelines. If you’re building agentic experiences in Slack, wire this into your bot; we can help with Slack AI Agents or a broader Internal AI Platform.

6) Monitoring that sticks: usage views, alerts, and a small dashboard

Stand up daily rollups and a throttle alert. You can do this entirely in Snowflake.

-- Daily serverless services rollup (Cortex + AI labels)
CREATE OR REPLACE VIEW ops.ai_usage.v_service_daily AS
SELECT usage_date, service_type, SUM(credits_used) AS credits
FROM SNOWFLAKE.ACCOUNT_USAGE.SERVICE_USAGE
WHERE service_type ILIKE '%CORTEX%' OR service_type ILIKE '%AI%'
GROUP BY 1,2;

-- Daily warehouse cost for AI-tagged queries
CREATE OR REPLACE VIEW ops.ai_usage.v_wh_daily AS
SELECT DATE_TRUNC('day', q.start_time) AS day,
       q.warehouse_name,
       SUM(m.credits_used) AS credits
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY q
JOIN SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY m
  ON q.warehouse_name = m.warehouse_name
 AND DATE_TRUNC('hour', q.start_time) = DATE_TRUNC('hour', m.start_time)
WHERE q.query_tag ILIKE '%cortex%'
GROUP BY 1,2;

-- Simple alert when serverless AI credits exceed a threshold today
CREATE OR REPLACE ALERT ops.ai_usage.a_cortex_spike
  WAREHOUSE = wh_cortex_xs
  SCHEDULE = 'USING CRON 0 * * * * UTC'  -- hourly
  IF (SELECT COALESCE(SUM(credits),0)
      FROM ops.ai_usage.v_service_daily
      WHERE usage_date = CURRENT_DATE) > 20
  THEN CALL SYSTEM$SEND_EMAIL('ops-notify', 'Cortex spike', 'Investigate SERVICE_USAGE');

Point your BI dashboard at these two views for a live picture. If you prefer a turnkey path, our Business Health Reporting service ships a consumption table and visuals in under a week. For query tuning that trims scan sizes behind AI SQL, see SQL Query Optimization.

7) Understanding cost for Cortex Search: measure, model, limit

Cortex Search blends indexing and serving in a serverless ">pay by use" model. Treat it separately from LLM usage. Start with measurement, then model the traffic you expect.

-- Identify search-related serverless usage labels in your account
SELECT DISTINCT service_type
FROM SNOWFLAKE.ACCOUNT_USAGE.SERVICE_USAGE
WHERE service_type ILIKE '%SEARCH%'
ORDER BY 1;

-- Trend credits by day for those labels
SELECT usage_date, service_type, SUM(credits_used) AS credits
FROM SNOWFLAKE.ACCOUNT_USAGE.SERVICE_USAGE
WHERE service_type ILIKE '%SEARCH%'
GROUP BY 1,2
ORDER BY 1,2;

Modeling tips:

  • Separate indexing vs serving. Bulk backfills spike indexing; steady Q&A drives serving.
  • Scope the corpus. Limit to columns truly needed for semantic matches.
  • Right-size chunks and embeddings dimensionality in your pipeline feeding the vector space.
  • Cache frequent prompts in your app layer; avoid duplicate lookups.

See Snowflake’s “Understanding cost for Cortex Search Services” for details, and verify your services cost labels in the snowflake service consumption table. If you plan to use Cortex for information retrieval, test with a traffic replay first.

8) Rollout checklist and guardrails teams actually follow

Here’s the playbook we use so innovation doesn’t torpedo the bill.

  • Choose smallest viable model. Document default model per feature. Switch up only where quality gaps are proven.
  • Isolate everything: dedicated virtual warehouse, schema for logs, and QUERY_TAG for the app.
  • Implement request caps: per-user and per-app. One natural language query should map to one message, not an agent loop.
  • Build monitoring first: the two daily views above, plus an alert. That’s cost monitoring with teeth.
  • Review the Snowflake AI pricing quarterly; the pricing model evolves.
  • For AI SQL trust, see Enterprise Text‑to‑SQL. For agent orchestration, our Internal AI Platform Architecture covers cortex agents patterns.

FAQ quick hits

  • What is the difference between Snowflake and Snowflake Cortex? Snowflake is the data platform; Cortex is a set of ai services (LLM functions, Analyst, AI SQL, search) that run on top.
  • How much does a Snowflake model cost? It’s per tokens; see “credits per million tokens” in docs and multiply by your measured volume.
  • Can Snowflake Cortex AI be monitored with native tools? Yes—account usage SERVICE_USAGE + WAREHOUSE_METERING_HISTORY + QUERY_HISTORY.
  • How does Cortex AI SQL pricing work? Tokens for generation + warehouse credits for the executed SQL.
  • How does Cortex Analyst pricing work? Per message/tokens; any generated queries also spend warehouse credits.

Need a fast, safe rollout and a sober view of your cortex ai cost? We tune this for teams weekly. Start with a 60‑minute working session—contact Vertex.

About the author

Eric Provencio Analytics engineer who has built and run production data platforms for Disney, Hulu, Nike, Peloton, Gopuff, and Kaplan. Founded Vertex Data Consulting to do the deep work most data teams never find time for: dbt Cloud migrations, repo performance, Airflow reliability, and AI agents that actually touch the stack.

Keep reading

Start a conversation

Tell us what's slowing your data team down.

We maintain a small client roster on purpose. If we're the wrong fit, we'll say so — and usually we know somebody who isn't.

  • Replies within 2 business days
  • NDA before specifics
  • Fixed-scope first engagement, retainer if it works
What do you want help with? *

We reply within 2 business days if there's a fit. No newsletters, ever.