Cost controls for Cortex Code¶
Account administrators can set daily estimated credit usage limits for Cortex Code on a per-user basis. These limits help organizations control Cortex Code consumption by blocking access when a user’s estimated credit usage in a rolling 24-hour window exceeds the configured threshold.
There are separate parameters for each Cortex Code surface:
Parameter |
Controls |
|---|---|
|
Cortex Code CLI usage |
|
Cortex Code in Snowsight usage |
How credit limits work¶
Each parameter tracks the corresponding user’s estimated credit usage over a rolling 24-hour window. When a user’s estimated usage reaches the configured limit for a given surface, access is blocked for that surface until usage drops below the threshold.
Both parameters share the same behavior:
Value |
Behavior |
|---|---|
|
No limit. The user has unlimited access. |
|
Access is blocked entirely for the user. |
Positive number |
Access is blocked when the user’s estimated credit usage in the past 24 hours exceeds this value. |
Each parameter can be set at the account level (applies to all users) or at the user level (applies to a specific user). A user-level setting overrides the account-level setting for that user.
Note
Only users with the ACCOUNTADMIN role (or a role with sufficient privileges to modify the account or user object)
can set these parameters.
Cortex Code CLI limits¶
The CORTEX_CODE_CLI_DAILY_EST_CREDIT_LIMIT_PER_USER parameter controls the daily credit limit for
Cortex Code CLI usage.
Account level¶
To set a daily credit limit for all users in the account:
To remove the account-level limit and restore the default (unlimited):
User level¶
To set a daily credit limit for a specific user, overriding the account-level setting:
To remove the user-level limit, so the account-level setting applies instead:
Cortex Code in Snowsight limits¶
The CORTEX_CODE_SNOWSIGHT_DAILY_EST_CREDIT_LIMIT_PER_USER parameter controls the daily credit limit for
Cortex Code usage within the Snowsight web interface.
Account level¶
To set a daily credit limit for all users in the account:
To remove the account-level limit and restore the default (unlimited):
User level¶
To set a daily credit limit for a specific user, overriding the account-level setting:
To remove the user-level limit, so the account-level setting applies instead:
When a limit is reached¶
When a user’s estimated credit usage exceeds the configured limit for a surface, that surface returns an error indicating that the daily credit limit has been reached. The user cannot use that surface until sufficient time has passed for the rolling 24-hour usage to drop below the limit. Other surfaces with separate limits are not affected.
Administrators can adjust or remove the limit at any time to restore access.
Listing users with custom limits¶
The following SQL script lists all users who have a per-user credit limit override for the CLI parameter. This is useful for administrators who want to audit which users have custom limits set at the user level.
This script iterates over all users in the account, checks whether a user-level override is set for
CORTEX_CODE_CLI_DAILY_EST_CREDIT_LIMIT_PER_USER, and returns a table of users with their override values.
You can modify the parameter name in the SHOW PARAMETERS LIKE clause to check the Snowsight parameter instead.
Example: Configuring limits for your organization¶
The following example sets default limits for all users in the account across both surfaces, then assigns a higher limit to a power user for CLI usage:
Note
When both an account-level and a user-level value are set for the same parameter, the user-level value takes precedence for that user. All other users in the account continue to use the account-level value.