Share via


Monitor usage for AI Gateway endpoints

Important

This feature is in Beta. Account admins can control access to this feature from the Previews page.

This page describes how to monitor usage for AI Gateway (Beta) endpoints using the usage tracking system table.

The usage tracking table automatically captures request and response details for an endpoint, logging essential metrics like token usage and latency. You can use the data in this table to monitor usage, track costs, and gain insights into endpoint performance and consumption.

Requirements

Query the usage table

AI Gateway logs usage data to the system.ai_gateway.usage system table. You can view the table in the UI, or query the table from Databricks SQL or a notebook.

Note

Only account admins have permission to view or query the system.ai_gateway.usage table.

To view the table in the UI, click the usage tracking table link on the endpoint page to open the table in Catalog Explorer.

To query the table from Databricks SQL or a notebook:

SELECT * FROM system.ai_gateway.usage;

Built-in usage dashboard

Databricks provides a built-in AI Gateway usage dashboard to monitor usage, track costs, and gain insights into endpoint performance and consumption.

To access the dashboard, click View Dashboard from the AI Gateway page.

View dashboard button

AI Gateway usage dashboard

Usage table schema

The system.ai_gateway.usage table has the following schema:

Column name Type Description Example
account_id STRING The account ID. 11d77e21-5e05-4196-af72-423257f74974
workspace_id STRING The workspace ID. 1653573648247579
request_id STRING A unique identifier for the request. b4a47a30-0e18-4ae3-9a7f-29bcb07e0f00
schema_version INTEGER The schema version of the usage record. 1
endpoint_id STRING The unique ID of the AI Gateway endpoint. 43addf89-d802-3ca2-bd54-fe4d2a60d58a
endpoint_name STRING The name of the AI Gateway endpoint. databricks-gpt-5-2
endpoint_tags MAP Tags associated with the endpoint. {"team": "engineering"}
endpoint_metadata STRUCT Endpoint metadata including creator, creation_time, last_updated_time, destinations, inference_table, and fallbacks. {"creator": "user.name@email.com", "creation_time": "2026-01-06T12:00:00.000Z", ...}
event_time TIMESTAMP The timestamp when the request was received. 2026-01-20T19:48:08.000+00:00
latency_ms LONG The total latency in milliseconds. 300
time_to_first_byte_ms LONG The time to first byte in milliseconds. 300
destination_type STRING The type of destination (for example, external model or foundation model). PAY_PER_TOKEN_FOUNDATION_MODEL
destination_name STRING The name of the destination model or provider. databricks-gpt-5-2
destination_id STRING The unique ID of the destination. 507e7456151b3cc89e05ff48161efb87
destination_model STRING The specific model used for the request. GPT-5.2
requester STRING The ID of the user or service principal that made the request. user.name@email.com
requester_type STRING The type of requester (user, service principal, or user group). USER
ip_address STRING The IP address of the requester. 1.2.3.4
url STRING The URL of the request. https://<ai-gateway-url>/mlflow/v1/chat/completions
user_agent STRING The user agent of the requester. OpenAI/Python 2.13.0
api_type STRING The type of API call (for example, chat, completions, or embeddings). mlflow/v1/chat/completions
request_tags MAP Tags associated with the request. {"team": "engineering"}
input_tokens LONG The number of input tokens. 100
output_tokens LONG The number of output tokens. 100
total_tokens LONG The total number of tokens (input + output). 200
token_details STRUCT Detailed token breakdown including cache_read_input_tokens, cache_creation_input_tokens, and output_reasoning_tokens. {"cache_read_input_tokens": 100, ...}
response_content_type STRING The content type of the response. application/json
status_code INT The HTTP status code of the response. 200
routing_information STRUCT Routing details for fallback attempts. Contains an attempts array with priority, action, destination, destination_id, status_code, error_code, latency_ms, start_time, and end_time for each model tried during the request. {"attempts": [{"priority": "1", ...}]}

Next steps