- Schema:
SNOWFLAKE_ COCO_ USAGE_ HISTORY view¶
The SNOWFLAKE_COCO_USAGE_HISTORY view can be used to query the usage history of CoCo across all interfaces: CLI, Desktop, and Snowsight.
The information in the view includes the number of credits consumed each time a user interacts with CoCo. 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, request ID, and the interface that originated the request.
Note
Interface-specific usage history is also available in the following views:
- CORTEX_CODE_CLI_USAGE_HISTORY for CoCo CLI
- CORTEX_CODE_DESKTOP_USAGE_HISTORY for CoCo Desktop
- CORTEX_CODE_SNOWSIGHT_USAGE_HISTORY for CoCo in Snowsight
Tip
In Cortex Code, including the CLI, Desktop, and Snowsight interfaces, you can use the cost-intelligence bundled skill to answer questions about the usage data in this view. Invoke the skill with /cost-intelligence, or describe your question in plain language and Cortex Code selects the skill automatically.
Columns¶
| Column name | Data type | Description |
|---|---|---|
| USER_ID | NUMBER | The unique identifier of the user who made the request. |
| USER_NAME | VARCHAR | The login name 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. |
| INTERFACE | VARCHAR | The CoCo interface that originated the request. Possible values are:
|
| 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:
|
| METADATA | OBJECT | Additional metadata, including:
|
Usage notes¶
- Latency for the view may be up to 1 hour.
- 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.
- The
USER_TAGScolumn returns an empty array for usage records that predate the introduction of user tag support.
Examples¶
Retrieve CoCo usage history across all interfaces:
Retrieve total credits consumed per interface in the last 30 days:
Retrieve total credits consumed per user in the last 30 days: