SYS.ORGANIZATION.MODEL_USAGE
The sys.organization.model_usage table contains metadata for AI model usage through Dremio Cloud's managed AI service. This table tracks usage of AI features such as Text-to-SQL, label generation, and wiki generation.
SELECT * FROM sys.organization.model_usage
Example Output
| id | user_id | project_id | model_provider_name | model_name | input_tokens | output_tokens | duration_ms | interaction_id | created_at | num_model_calls | interaction_type |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 000286ac-3162-4dcd-8d28-59dfa71aeae5 | 408670d3-7d91-42ab-bd1e-908a5cd676e4 | 0c6e634e-0546-4da8-8e81-6b7b9f15530c | OpenAI | gpt-4o | 1250 | 85 | 1850 | cceec24c-a201-494d-87f6-34081cea8759 | 2025-08-01 04:48:55.061 | 1 | TEXT_TO_SQL |
| 000286ac-3162-4dcd-8d28-59dfa71aeae6 | 408670d3-7d91-42ab-bd1e-908a5cd676e4 | 0c6e634e-0546-4da8-8e81-6b7b9f15530c | AWS Bedrock | claude-3-sonnet | 980 | 120 | 2100 | ddeec24c-a201-494d-87f6-34081cea8760 | 2025-08-01 05:15:22.145 | 1 | LABEL_GENERATION |
| 000286ac-3162-4dcd-8d28-59dfa71aeae7 | 408670d3-7d91-42ab-bd1e-908a5cd676e4 | 0c6e634e-0546-4da8-8e81-6b7b9f15530c | Azure OpenAI | gpt-4o | 1100 | 95 | 1750 | eeeec24c-a201-494d-87f6-34081cea8761 | 2025-08-01 06:22:18.892 | 1 | WIKI_GENERATION |
Columns
| Column | Data Type | Description |
|---|---|---|
| id | varchar | The UUID of the usage record. |
| user_id | varchar | The ID of the user who made the request. |
| project_id | varchar | The ID of the project where the request was made. |
| model_provider_name | varchar | The name of the AI model provider. Dremio Cloud supports multiple managed providers: "OpenAI", "AWS Bedrock", and "Azure OpenAI". |
| model_name | varchar | The name of the AI model used during the interaction (e.g., "gpt-4o"). |
| input_tokens | float | The number of input tokens consumed, excluding cached tokens. |
| cached_read_input_tokens | float | The number of cached read input tokens consumed. |
| cached_write_input_tokens | float | The number of cached write input tokens consumed. |
| output_tokens | float | The number of output tokens consumed. |
| duration_ms | float | The request execution time in milliseconds. |
| interaction_id | varchar | The ID of the interaction, such as a Text-to-SQL session ID or label generation job ID. |
| created_at | timestamp | The date and time when the usage record was created. |
| num_model_calls | float | The number of model calls made in the usage record. |
| interaction_type | varchar | The type of AI interaction. Values include: TEXT_TO_SQL, LABEL_GENERATION, WIKI_GENERATION, SEMANTIC_SEARCH. |
Usage Examples
View AI usage by interaction type
SELECT
interaction_type,
COUNT(*) as total_interactions,
SUM(input_tokens) as total_input_tokens,
SUM(output_tokens) as total_output_tokens
FROM sys.organization.model_usage
WHERE created_at >= CURRENT_DATE - INTERVAL '30' DAY
GROUP BY interaction_type
ORDER BY total_interactions DESC;
View AI usage by project
SELECT
p.project_name,
COUNT(m.id) as total_interactions,
SUM(m.input_tokens + m.output_tokens) as total_tokens
FROM sys.organization.model_usage m
JOIN sys.organization.projects p ON m.project_id = p.project_id
WHERE m.created_at >= CURRENT_DATE - INTERVAL '7' DAY
GROUP BY p.project_name
ORDER BY total_tokens DESC;
View daily AI usage trends
SELECT
DATE_TRUNC('day', created_at) as usage_date,
interaction_type,
COUNT(*) as interactions,
SUM(input_tokens + output_tokens) as total_tokens
FROM sys.organization.model_usage
WHERE created_at >= CURRENT_DATE - INTERVAL '30' DAY
GROUP BY DATE_TRUNC('day', created_at), interaction_type
ORDER BY usage_date DESC, total_tokens DESC;
Notes
- Managed AI Service: Dremio Cloud uses managed AI services with support for multiple providers: OpenAI, AWS Bedrock, and Azure OpenAI
- Data Retention: Usage data is retained for 365 days
- Delay: There may be a 1-2 hour delay between AI feature usage and when the data appears in this table
- Privacy: Only metadata about AI usage is stored; actual prompts and responses are not persisted
- Permissions: Users can only see usage data for projects they have access to
Related Topics
- Generative AI - Overview of AI features in Dremio Cloud
- Text-to-SQL Experience - Using AI to generate SQL
- Generating Labels and Wikis - AI-powered dataset documentation
- SYS.ORGANIZATION.USAGE - Engine and compute usage tracking