Schema:

ACCOUNT_USAGE

CORTEX_REST_API_USAGE_HISTORY view

Query the CORTEX_REST_API_USAGE_HISTORY view to see the history of Cortex REST API calls.

The information in the view includes the number of tokens processed and credits consumed for each REST API request. The view also includes relevant metadata, such as the request ID, model name, user ID, and inference region. For more information on Cortex billing, see Cost considerations.

Columns

Column NameData TypeDescription
START_TIMETIMESTAMP_LTZThe beginning of the time range for the usage history.
END_TIMETIMESTAMP_LTZThe end of the time range for the usage history.
REQUEST_IDTEXTThe unique identifier for the REST API request.
MODEL_NAMETEXTName of the model used in the REST API call.
TOKENSNUMBERNumber of tokens processed for the REST API request.
TOKENS_GRANULAROBJECTA SQL object that provides a breakdown of tokens processed by token type (input or output) for the REST API request.
USER_IDTEXT

The internal ID of the user who invoked the REST API.

For more information about authenticating, see Authenticating to the server.

INFERENCE_REGIONTEXTThe region in which the inference was performed.

Usage notes

  • The view provides up-to-date usage information for an account within the last 365 days (1 year).
  • Credit usage is based on the number of tokens processed, as outlined in the Snowflake Service Consumption Table.