- Schema:
CORTEX_CODE_CLI_USAGE_HISTORY view¶
The CORTEX_CODE_CLI_USAGE_HISTORY view can be used to query the usage history of Cortex Code CLI.
The information in the view includes the number of credits consumed each time a user interacts with Cortex Code CLI. Each row in the view represents a single request and provides detail about the aggregated tokens and credits as well as a granular breakdown by model. The view also includes relevant metadata, such as the user ID and request ID.
Note
This view does not include requests originating from Cortex Code in Snowsight. Requests originating from Cortex Code in Snowsight are recorded in the CORTEX_CODE_SNOWSIGHT_USAGE_HISTORY view.
Columns¶
Column Name |
Data Type |
Description |
|---|---|---|
USER_ID |
NUMBER |
The unique identifier of the user who made the request. |
USER_TAGS |
ARRAY |
Tags associated with the user. Each object in the array contains the following value pairs:
|
REQUEST_ID |
VARCHAR |
The unique identifier for the request. |
PARENT_REQUEST_ID |
VARCHAR |
The identifier of the parent request, if applicable. |
USAGE_TIME |
TIMESTAMP_TZ |
The timestamp when the usage was recorded. |
TOKEN_CREDITS |
NUMBER |
The number of token credits used for the request. |
TOKENS |
NUMBER |
The total number of tokens used for the request. |
TOKENS_GRANULAR |
OBJECT |
Granular breakdown of token usage by model. Each key is a model name, and each value is an object containing the following fields:
|
CREDITS_GRANULAR |
OBJECT |
Granular breakdown of credit usage by model. Each key is a model name, and each value is an object containing the following fields:
|
Usage notes¶
The view provides up-to-date credit usage for an account within the last 365 days (1 year).
Credit rate usage is based on the number of tokens processed, as outlined in the Snowflake Service Consumption Table.
Examples¶
Retrieve Cortex Code CLI usage history:
Retrieve total credits consumed per user in the last 30 days: