# Cortex Code Cost Control

## Overview

Cortex Code Cost Control gives you full visibility into **Snowflake Cortex Code spend** and lets you **set daily credit budgets** to keep AI usage within planned limits — at both the **account default** and **individual user** level.

The page separates limits by usage channel (**Snowsight** vs **CLI**), so you can apply different policies depending on how users access Cortex Code.

***

## What Problem It Solves

Snowflake Cortex Code (code-generation AI) can generate significant and unpredictable compute spend. Without guardrails:

* Individual users may consume disproportionate credits without realizing it.
* There is no easy way to enforce different policies for interactive (Snowsight) vs programmatic (CLI) usage.
* Cost spikes are discovered only after the fact, in the monthly bill.

Cortex Code Cost Control addresses all three by providing **real-time cost monitoring** and **enforceable daily budgets**.

***

## Key Capabilities

### Cost Monitoring

* **Cost trend chart** — view Cortex Code spend over time with configurable date range and granularity (day / week / month).
* **Cost by user** — pie chart breaking down total Cortex Code cost per user for the selected period.
* **Per-user metrics** — total cost, average daily cost, and projected annual cost for every Snowflake user.

### Budget Controls

* **Account default daily budget** — set a single daily credit cap that applies to all users by default, separately for Snowsight and CLI.
* **Per-user overrides** — override the account default for specific users with one of four modes:
  * **Default** — inherit the account-level budget.
  * **Blocked** — prevent the user from using Cortex Code on the selected channel.
  * **Unlimited** — remove any credit cap for the user.
  * **Limited** — set a custom daily credit amount (displayed in USD when pricing data is available).

<figure><img src="https://3620459840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnSbIoBjUxWTGNWa9gGw7%2Fuploads%2Fgit-blob-a3c580959466f2be8aa24ab28246211f10364e7d%2Fmain-page.png?alt=media" alt=""><figcaption><p>Cortex Code Cost Control — users table with daily credit budget controls</p></figcaption></figure>

***

## Prerequisites

Cortex Code Cost Control relies on **Seemore helper procedures** deployed in your Snowflake account. If they are not present, the page will show a setup prompt with a link to the installation guide.

Make sure you have completed the steps in [Create Snowflake User and Privileges](https://docs.seemoredata.io/external-docs/fundamentals/getting-set-up/setting-integrations/snowflake/create-snowflake-user-and-privileges) and that the Seemore database objects are deployed for the relevant Snowflake integration.

{% hint style="info" %}
Only users with the **Editor** role in Seemore can modify limits. Viewers can browse costs and limits but cannot change them.
{% endhint %}

***

## How to Use

{% stepper %}
{% step %}

#### Select a Snowflake Integration

Open **Cortex Code Cost Control** from the sidebar. If you have multiple Snowflake integrations, choose the one you want to manage from the integration dropdown.
{% endstep %}

{% step %}

#### Choose the Usage Channel

Use the **Snowsight / CLI** toggle to switch between the two channels. Limits and cost data update independently for each channel.
{% endstep %}

{% step %}

#### Review Cost Trends

Adjust the date range and granularity to see overall Cortex Code spend and per-user breakdown in the trend and pie charts.
{% endstep %}

{% step %}

#### Set the Account Default Budget

In the users table toolbar, set the **Account default daily user budget**. This value applies to every user who does not have an explicit override.
{% endstep %}

{% step %}

#### Configure Per-User Overrides

For any user in the table, change their **Daily credit budget** to Default, Blocked, Unlimited, or Limited with a custom amount.
{% endstep %}
{% endstepper %}

***

## How Limits Work

| Limit value                 | Meaning                                                                                                                                                |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Default** (user only)     | Inherits the account-level daily budget for the active channel.                                                                                        |
| **Blocked** (`0` credits)   | The user cannot consume Cortex Code credits on the selected channel.                                                                                   |
| **Unlimited** (`-1`)        | No daily cap — the user can use Cortex Code without restriction.                                                                                       |
| **Limited** (custom amount) | A specific number of credits per day. When pricing data is available, you can enter the limit in USD and Seemore converts it to credits automatically. |

Limits are enforced via two Snowflake parameters:

* `CORTEX_CODE_SNOWSIGHT_DAILY_EST_CREDIT_LIMIT_PER_USER`
* `CORTEX_CODE_CLI_DAILY_EST_CREDIT_LIMIT_PER_USER`

***

## FAQ

* **Does changing a limit take effect immediately?**\
  Yes. Limit changes are applied optimistically in the UI and persisted to your Snowflake account within seconds.
* **Can I set different limits for Snowsight and CLI?**\
  Yes. Switch the channel toggle and configure each independently.
* **What happens if the Seemore helper procedures are missing?**\
  The page displays an empty state with a link to the setup guide. No cost data or limit controls are available until the procedures are deployed.
* **Who can change limits?**\
  Only Seemore users with the **Editor** role. Viewers can see costs and current limits but cannot modify them.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.seemoredata.io/external-docs/fundamentals/our-features/cortex-code-cost-control.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
