Here is the FlexReport query that gathers all Generative AI and ML costs across AWS, Azure, and GCP. The query uses CTEs and a UNION ALL to consolidate billing data from AWS Bedrock, Azure AI, and GCP Vertex and AI, mapping their native columns to the FinOps FOCUS standard (including ProviderName, ServiceName, ModelName, ConsumedQuantity, and BilledCost). This helps you track AI spending across clouds, standardize token usage, or monitor the costs of specific models (like Claude, GPT-4o, Gemini, etc.).
{
"sqlStatement": "WITH cxtemp_AWS_AI_Usage AS ( SELECT 'AWS' AS ProviderName, timeInterval_Month AS BillingPeriodStart, lineItem_UsageAccountId AS SubAccountId, \"organization##accountname\" AS SubAccountName, bill_PayerAccountId AS BilledAccountId, product_region AS RegionName, NULL AS ResourceGroupName, product_ProductName AS ServiceName, lineItem_UsageType AS ServiceSubcategory, CASE WHEN LOWER(lineItem_UsageType) LIKE '%nova%' OR LOWER(lineItem_UsageType) LIKE '%titan%' OR LOWER(lineItem_UsageType) LIKE '%llama%' OR LOWER(lineItem_UsageType) LIKE '%guardrail%' OR LOWER(lineItem_UsageType) LIKE '%qwen%' OR LOWER(lineItem_UsageType) LIKE '%mixtral%' OR LOWER(lineItem_UsageType) LIKE '%pixtral%' OR LOWER(lineItem_UsageType) LIKE '%mistral%' OR LOWER(lineItem_UsageType) LIKE '%claude%' OR LOWER(lineItem_UsageType) LIKE '%deepseek%' THEN SPLIT_PART(lineItem_UsageType, '-', 2) WHEN LOWER(lineItem_UsageType) LIKE '%gpt%' THEN 'OpenAI' WHEN LOWER(lineItem_UsageType) LIKE '%bedrockflows%' THEN 'Bedrock Flows' WHEN LOWER(product_ProductName) LIKE '%agentcore%' OR LOWER(lineItem_UsageType) LIKE '%agent%' THEN 'Bedrock Agents' WHEN LOWER(lineItem_UsageType) LIKE '%dataautomation%' THEN 'Data Automation' WHEN LOWER(lineItem_UsageType) LIKE '%generatesql%' THEN 'Generate SQL' WHEN LOWER(lineItem_LineItemDescription) LIKE '%marketplace%' THEN SPLIT_PART(product_ProductName, '(', 1) WHEN LOWER(lineItem_LineItemDescription) LIKE '%tax%' THEN 'Tax/Fees' ELSE 'Other Models' END AS ModelName, CASE WHEN LOWER(lineItem_LineItemDescription) LIKE '%tax%' THEN 'Tax/Fees' WHEN LOWER(lineItem_LineItemDescription) LIKE '%input%' OR LOWER(lineItem_LineItemDescription) LIKE '%input-tokens%' THEN 'Input Tokens' WHEN LOWER(lineItem_LineItemDescription) LIKE '%output%' OR LOWER(lineItem_LineItemDescription) LIKE '%output-tokens%' THEN 'Output Tokens' WHEN LOWER(lineItem_LineItemDescription) LIKE '%node%' OR LOWER(lineItem_UsageType) LIKE '%bedrockflows%' THEN 'Bedrock Flows' WHEN LOWER(lineItem_LineItemDescription) LIKE '%guardrail%' OR LOWER(lineItem_UsageType) LIKE '%guardrail%' THEN 'Guardrails' WHEN LOWER(lineItem_LineItemDescription) LIKE '%image%' OR LOWER(lineItem_UsageType) LIKE '%imagegenerator%' OR LOWER(lineItem_UsageType) LIKE '%novacanvas%' THEN 'Image Generation' WHEN LOWER(lineItem_UsageType) LIKE '%embedding%' OR LOWER(lineItem_UsageType) LIKE '%titanembedding%' THEN 'Embeddings' WHEN LOWER(pricing_unit) LIKE '%video%' THEN 'Video Generation' WHEN LOWER(lineItem_UsageType) LIKE '%storage%' THEN 'Storage' WHEN LOWER(lineItem_UsageType) LIKE '%inference%' THEN 'Inference' WHEN LOWER(lineItem_UsageType) LIKE '%optimize%' THEN 'OptimizePrompt' WHEN LOWER(lineItem_LineItemDescription) LIKE '%marketplace%' AND LOWER(lineItem_UsageType) LIKE '%input%' THEN 'Input Tokens' WHEN LOWER(lineItem_LineItemDescription) LIKE '%marketplace%' AND LOWER(lineItem_UsageType) LIKE '%output%' THEN 'Output Tokens' ELSE 'Other Usage' END AS UsageCategory, CASE WHEN lineItem_LineItemDescription LIKE '%Marketplace%' THEN SPLIT_PART (lineItem_LineItemDescription, '|', 3) ELSE pricing_unit END AS PricingUnit, SUM(lineItem_UsageAmount) AS SUM_Consumption_In_Units, SUM(lineItem_UnblendedCost) AS SUM_Cost, CASE WHEN lineItem_LineItemDescription LIKE '%Marketplace%' THEN 'AWS Marketplace' ELSE 'AWS' END AS PublisherName, lineItem_CurrencyCode AS CurrencyCode FROM AWS_CUR WHERE product_ProductName LIKE '%Amazon Bedrock%' GROUP BY timeInterval_Month, lineItem_UsageType, lineItem_Operation, product_region, lineItem_UsageAccountId, \"organization##accountname\", bill_PayerAccountId, product_ProductName, lineItem_LineItemDescription, pricing_unit, lineItem_CurrencyCode ), cxtemp_Azure_AI_Usage AS ( SELECT 'Azure' AS ProviderName, timeInterval_Month AS BillingPeriodStart, SubscriptionID AS SubAccountId, SubscriptionName AS SubAccountName, BillingAccountId AS BilledAccountId, LOWER(ResourceLocation) AS RegionName, ResourceGroup AS ResourceGroupName, ProductName AS ServiceName, MeterName AS ServiceSubcategory, CASE WHEN LOWER(ProductName) LIKE '%ai search - free%' THEN 'AI Search - Free' WHEN LOWER(ProductName) LIKE '%ai search - standard%' THEN 'AI Search - Standard' WHEN LOWER(MeterName) LIKE '%o4-mini%' THEN 'o4-series' WHEN LOWER(MeterName) LIKE '%o3%' THEN 'o3-series' WHEN LOWER(MeterName) LIKE '%o1%' THEN 'o1-series' WHEN LOWER(MeterName) LIKE '%gpt 5.2%' OR LOWER(MeterName) LIKE '%gpt-5.2%' THEN 'GPT-5.2' WHEN LOWER(MeterName) LIKE '%gpt 5.1%' OR LOWER(MeterName) LIKE '%gpt-5.1%' THEN 'GPT-5.1' WHEN LOWER(MeterName) LIKE '%gpt 5%' OR LOWER(MeterName) LIKE '%gpt-5%' THEN 'GPT-5' WHEN LOWER(MeterName) LIKE '%gpt-4.1-mini%' OR LOWER(MeterName) LIKE '%gpt 4.1 mini%' THEN 'GPT-4.1 Mini' WHEN LOWER(MeterName) LIKE '%gpt-4.1%' THEN 'GPT-4.1' WHEN LOWER(MeterName) LIKE '%gpt-4o-mini%' OR LOWER(MeterName) LIKE '%gpt 4o mini%' THEN 'GPT-4o Mini' WHEN LOWER(MeterName) LIKE '%gpt-4o%' OR LOWER(MeterName) LIKE '%gpt 4o%' THEN 'GPT-4o' WHEN LOWER(MeterName) LIKE '%gpt-4%' OR LOWER(MeterName) LIKE '%gpt 4%' THEN 'GPT-4' WHEN LOWER(MeterName) LIKE '%gpt-3.5%' OR LOWER(MeterName) LIKE '%gpt-35%' OR LOWER(MeterName) LIKE '%gpt 3.5%' THEN 'GPT-3.5 Turbo' WHEN LOWER(MeterName) LIKE '%gpt-image%' OR LOWER(MeterName) LIKE '%dall-e%' THEN 'Dall-E / Image' WHEN LOWER(MeterName) LIKE '%whisper%' THEN 'Whisper' WHEN LOWER(MeterName) LIKE '%speech%' THEN 'Azure Speech' WHEN LOWER(MeterName) LIKE '%code-interpreter%' THEN 'Code Interpreter' WHEN LOWER(MeterName) LIKE '%k2 thinking%' OR LOWER(MeterName) LIKE '%kimi%' THEN 'Kimi-K2' WHEN LOWER(MeterName) LIKE '%r1 %' OR LOWER(MeterName) LIKE '%deepseek%' THEN 'Deepseek' WHEN LOWER(MeterName) LIKE '%embedding%' THEN 'Embeddings' ELSE MeterSubCategory END AS ModelName, CASE WHEN LOWER(MeterName) LIKE '%cached%' OR LOWER(MeterName) LIKE '%cchd%' THEN 'Cached Tokens' WHEN LOWER(MeterName) LIKE '%outp%' OR LOWER(MeterName) LIKE '%outpt%' OR LOWER(MeterName) LIKE '%txt out%' OR LOWER(MeterName) LIKE '%opt%' THEN 'Output Tokens' WHEN LOWER(MeterName) LIKE '%inp%' OR LOWER(MeterName) LIKE '%inpt%' OR LOWER(MeterName) LIKE '%tokens%' THEN 'Input Tokens' WHEN LOWER(MeterName) LIKE '%images%' THEN 'Image Generation' WHEN LOWER(MeterName) LIKE '%session%' THEN 'Sessions' WHEN LOWER(MeterName) LIKE '%text records%' THEN 'Text Records' WHEN LOWER(MeterName) LIKE '%characters%' OR LOWER(MeterName) LIKE '%speech to text%' THEN 'Characters' WHEN LOWER(MeterName) LIKE '%pages%' THEN 'OCR Pages' WHEN LOWER(MeterName) LIKE '%search%' OR LOWER(MeterName) LIKE '%unit%' THEN 'Service Units' ELSE 'Other Provisioned' END AS UsageCategory, UnitOfMeasure AS PricingUnit, SUM(Quantity) AS SUM_Consumption_In_Units, SUM(CostInReportingCurrency) AS SUM_Cost, 'Microsoft' AS PublisherName, ReportingCurrency AS CurrencyCode FROM AZURE_COST_USAGE WHERE ( LOWER(MeterCategory) IN ('foundry models', 'foundry tools') OR LOWER(ProductName) LIKE '%azure openai%' OR LOWER(ProductName) LIKE '%ai search%' OR LOWER(ProductName) LIKE '%cognitive%' ) GROUP BY timeInterval_Month, SubscriptionName, SubscriptionID, BillingAccountId, ResourceGroup, MeterCategory, ProductName, MeterName, MeterSubCategory, UnitOfMeasure, ReportingCurrency, ResourceLocation ), cxtemp_GCP_AI_Usage AS ( SELECT 'GCP' AS ProviderName, timeInterval_Month AS BillingPeriodStart, Project_Id AS SubAccountId, Project_Name AS SubAccountName, Billing_Account_Id AS BilledAccountId, Region AS RegionName, NULL AS ResourceGroupName, Service_Description AS ServiceName, Sku_Description AS ServiceSubcategory, CASE WHEN LOWER(Sku_Description) LIKE '%gemini 3.1 flash%' THEN 'Gemini 3.1 Flash' WHEN LOWER(Sku_Description) LIKE '%gemini 3.0 pro%' OR LOWER(Sku_Description) LIKE '%gemini 3 pro%' OR LOWER(Sku_Description) LIKE '%gemini_3_pro%' THEN 'Gemini 3 Pro' WHEN LOWER(Sku_Description) LIKE '%gemini 3 flash%' THEN 'Gemini 3 Flash' WHEN LOWER(Sku_Description) LIKE '%gemini 2.5 pro%' THEN 'Gemini 2.5 Pro' WHEN LOWER(Sku_Description) LIKE '%gemini 2.5 flash%' THEN 'Gemini 2.5 Flash' WHEN LOWER(Sku_Description) LIKE '%gemini 2.0 flash%' THEN 'Gemini 2.0 Flash' WHEN LOWER(Sku_Description) LIKE '%gemini 1.5 pro%' THEN 'Gemini 1.5 Pro' WHEN LOWER(Sku_Description) LIKE '%gemini 1.5 flash%' THEN 'Gemini 1.5 Flash' WHEN LOWER(Sku_Description) LIKE '%gemini pro%' THEN 'Gemini Pro' WHEN LOWER(Sku_Description) LIKE '%gemini code assist%' THEN 'Gemini Code Assist' WHEN LOWER(Sku_Description) LIKE '%claude 3.7 sonnet%' THEN 'Claude 3.7 Sonnet' WHEN LOWER(Service_Description) LIKE '%claude sonnet 4.5%' OR LOWER(Sku_Description) LIKE '%claude sonnet 4.5%' THEN 'Claude 4.5 Sonnet' WHEN LOWER(Sku_Description) LIKE '%claude haiku 4 5%' OR LOWER(Sku_Description) LIKE '%claude haiku 4.5%' THEN 'Claude 4.5 Haiku' WHEN LOWER(Service_Description) LIKE '%claude opus 4.6%' OR LOWER(Sku_Description) LIKE '%claude opus 4.6%' THEN 'Claude 4.6 Opus' WHEN LOWER(Service_Description) LIKE '%claude opus 4.5%' OR LOWER(Sku_Description) LIKE '%claude opus 4.5%' THEN 'Claude 4.5 Opus' WHEN LOWER(Service_Description) LIKE '%claude sonnet 4%' OR LOWER(Sku_Description) LIKE '%claude sonnet 4%' THEN 'Claude 4.0 Sonnet' WHEN LOWER(Sku_Description) LIKE '%claude 3.5 sonnet%' THEN 'Claude 3.5 Sonnet' WHEN LOWER(Sku_Description) LIKE '%claude 3.5 haiku%' THEN 'Claude 3.5 Haiku' WHEN LOWER(Sku_Description) LIKE '%claude 3 haiku%' THEN 'Claude 3 Haiku' WHEN LOWER(Sku_Description) LIKE '%veo 3%' THEN 'Veo 3' WHEN LOWER(Sku_Description) LIKE '%veo 2%' THEN 'Veo 2' WHEN LOWER(Sku_Description) LIKE '%imagen 4%' THEN 'Imagen 4' WHEN LOWER(Sku_Description) LIKE '%imagen 3%' THEN 'Imagen 3' WHEN LOWER(Sku_Description) LIKE '%imagen%' THEN 'Imagen' WHEN LOWER(Sku_Description) LIKE '%palm text bison%' THEN 'PaLM' WHEN LOWER(Sku_Description) LIKE '%lyria2%' THEN 'Lyria 2' WHEN LOWER(Sku_Description) LIKE '%embed%' THEN 'Embeddings' WHEN LOWER(Sku_Description) LIKE '%vector search%' OR LOWER(Service_Description) LIKE '%vertex ai search%' THEN 'Vector Search' WHEN LOWER(Sku_Description) LIKE '%grounding%' OR LOWER(Sku_Description) LIKE '%search tool%' THEN 'LLM Grounding' WHEN LOWER(Service_Description) LIKE '%cloud speech%' THEN 'Cloud Speech API' WHEN LOWER(Service_Description) LIKE '%document ai%' THEN 'Cloud Document AI' WHEN LOWER(Sku_Description) LIKE '%dialogflow%' OR LOWER(Sku_Description) LIKE '%vertex ai conversation%' THEN 'Dialogflow / Conversation' WHEN LOWER(Sku_Description) LIKE '%evaluation service%' THEN 'Vertex AI Evaluation' WHEN LOWER(Sku_Description) LIKE '%nvidia%' OR LOWER(Sku_Description) LIKE '%colab%' OR LOWER(Sku_Description) LIKE '%feature store%' OR LOWER(Sku_Description) LIKE '%vertex ai: online/batch%' OR LOWER(Sku_Description) LIKE '%vertex ai: training%' OR LOWER(Sku_Description) LIKE '%vertex ai: automl%' OR LOWER(Sku_Description) LIKE '%tensorboard%' OR LOWER(Sku_Description) LIKE '%metadata storage%' OR LOWER(Sku_Description) LIKE '%pipeline job%' THEN 'Vertex AI Infrastructure' ELSE 'Other AI Models' END AS ModelName, CASE WHEN LOWER(Sku_Description) LIKE '%cach%' THEN 'Cached Tokens' WHEN LOWER(Sku_Description) LIKE '%input%' THEN 'Input Tokens' WHEN LOWER(Sku_Description) LIKE '%output%' THEN 'Output Tokens' WHEN LOWER(Sku_Description) LIKE '%audio generation%' OR LOWER(Sku_Description) LIKE '%veo%' OR LOWER(Sku_Description) LIKE '%video generation%' THEN 'Video / Audio Generation' WHEN LOWER(Sku_Description) LIKE '%imagen%' OR LOWER(Sku_Description) LIKE '%virtual try-on%' OR LOWER(Sku_Description) LIKE '%image generation%' THEN 'Image Generation' WHEN LOWER(Sku_Description) LIKE '%vector search%' OR LOWER(Sku_Description) LIKE '%index%' THEN 'Search/Indexing' ELSE 'Other Usage' END AS UsageCategory, Units AS PricingUnit, SUM(Consumption_In_Units) AS SUM_Consumption_In_Units, SUM(Cost) AS SUM_Cost, 'Google Cloud' AS PublisherName, Currency AS CurrencyCode FROM GCP_BILLING_EXPORT WHERE Project_Id IS NOT NULL AND ( LOWER(Service_Description) IN ( 'vertex ai', 'gemini api', 'vertex ai search', 'cloud document ai api', 'cloud speech api', 'cloud dialogflow api' ) OR LOWER(Service_Description) LIKE '%claude%' OR LOWER(Sku_Description) LIKE '%gemini%' ) GROUP BY timeInterval_Month, Project_Id, Project_Name, Billing_Account_Id, Service_Description, Sku_Description, Cost_Type, Currency, Region, Units ), cxtemp_Combined_AI_Usage AS ( SELECT ProviderName, BillingPeriodStart, SubAccountId, SubAccountName, BilledAccountId, RegionName, ResourceGroupName, ServiceName, ServiceSubcategory, ModelName, UsageCategory, PricingUnit, SUM_Consumption_In_Units, SUM_Cost, PublisherName, CurrencyCode FROM cxtemp_AWS_AI_Usage UNION ALL SELECT ProviderName, BillingPeriodStart, SubAccountId, SubAccountName, BilledAccountId, RegionName, ResourceGroupName, ServiceName, ServiceSubcategory, ModelName, UsageCategory, PricingUnit, SUM_Consumption_In_Units, SUM_Cost, PublisherName, CurrencyCode FROM cxtemp_Azure_AI_Usage UNION ALL SELECT ProviderName, BillingPeriodStart, SubAccountId, SubAccountName, BilledAccountId, RegionName, ResourceGroupName, ServiceName, ServiceSubcategory, ModelName, UsageCategory, PricingUnit, SUM_Consumption_In_Units, SUM_Cost, PublisherName, CurrencyCode FROM cxtemp_GCP_AI_Usage ) SELECT ProviderName, BillingPeriodStart as BillingPeriodStart, SubAccountId, SubAccountName, BilledAccountId, RegionName, ResourceGroupName, ServiceName, ServiceSubcategory, ModelName, UsageCategory, PricingUnit, SUM_Consumption_In_Units, SUM_Cost as SUM_Cost, PublisherName, CurrencyCode FROM cxtemp_Combined_AI_Usage ORDER BY BillingPeriodStart ASC, SUM_Cost DESC",
"dataGranularity": "MONTHLY",
"timeRange": {
"last": 12
},
"limit": -1
}
Model Name:

Usage Category:

The combined query above requires active billing data for AWS, Azure, and GCP in your environment. If you only use a single cloud, running the combined query will result in a schema validation error, such as 'Dataset not available'. Alternatively, you can use the individual cloud-only query provided below.
AWS:
{
"sqlStatement": "SELECT 'AWS' AS ProviderName, timeInterval_Month AS BillingPeriodStart, lineItem_UsageAccountId AS SubAccountId, \"organization##accountname\" AS SubAccountName, bill_PayerAccountId AS BilledAccountId, product_region AS RegionName, product_ProductName AS ServiceName, lineItem_UsageType AS ServiceSubcategory, CASE WHEN LOWER(lineItem_UsageType) LIKE '%nova%' OR LOWER(lineItem_UsageType) LIKE '%titan%' OR LOWER(lineItem_UsageType) LIKE '%llama%' OR LOWER(lineItem_UsageType) LIKE '%guardrail%' OR LOWER(lineItem_UsageType) LIKE '%qwen%' OR LOWER(lineItem_UsageType) LIKE '%mixtral%' OR LOWER(lineItem_UsageType) LIKE '%pixtral%' OR LOWER(lineItem_UsageType) LIKE '%mistral%' OR LOWER(lineItem_UsageType) LIKE '%claude%' OR LOWER(lineItem_UsageType) LIKE '%deepseek%' THEN SPLIT_PART(lineItem_UsageType, '-', 2) WHEN LOWER(lineItem_UsageType) LIKE '%gpt%' THEN 'OpenAI' WHEN LOWER(lineItem_UsageType) LIKE '%bedrockflows%' THEN 'Bedrock Flows' WHEN LOWER(product_ProductName) LIKE '%agentcore%' OR LOWER(lineItem_UsageType) LIKE '%agent%' THEN 'Bedrock Agents' WHEN LOWER(lineItem_UsageType) LIKE '%dataautomation%' THEN 'Data Automation' WHEN LOWER(lineItem_UsageType) LIKE '%generatesql%' THEN 'Generate SQL' WHEN LOWER(lineItem_LineItemDescription) LIKE '%marketplace%' THEN SPLIT_PART(product_ProductName, '(', 1) WHEN LOWER(lineItem_LineItemDescription) LIKE '%tax%' THEN 'Tax/Fees' ELSE 'Other Models' END AS ModelName, CASE WHEN LOWER(lineItem_LineItemDescription) LIKE '%tax%' THEN 'Tax/Fees' WHEN LOWER(lineItem_LineItemDescription) LIKE '%input%' OR LOWER(lineItem_LineItemDescription) LIKE '%input-tokens%' THEN 'Input Tokens' WHEN LOWER(lineItem_LineItemDescription) LIKE '%output%' OR LOWER(lineItem_LineItemDescription) LIKE '%output-tokens%' THEN 'Output Tokens' WHEN LOWER(lineItem_LineItemDescription) LIKE '%node%' OR LOWER(lineItem_UsageType) LIKE '%bedrockflows%' THEN 'Bedrock Flows' WHEN LOWER(lineItem_LineItemDescription) LIKE '%guardrail%' OR LOWER(lineItem_UsageType) LIKE '%guardrail%' THEN 'Guardrails' WHEN LOWER(lineItem_LineItemDescription) LIKE '%image%' OR LOWER(lineItem_UsageType) LIKE '%imagegenerator%' OR LOWER(lineItem_UsageType) LIKE '%novacanvas%' THEN 'Image Generation' WHEN LOWER(lineItem_UsageType) LIKE '%embedding%' OR LOWER(lineItem_UsageType) LIKE '%titanembedding%' THEN 'Embeddings' WHEN LOWER(pricing_unit) LIKE '%video%' THEN 'Video Generation' WHEN LOWER(lineItem_UsageType) LIKE '%storage%' THEN 'Storage' WHEN LOWER(lineItem_UsageType) LIKE '%inference%' THEN 'Inference' WHEN LOWER(lineItem_UsageType) LIKE '%optimize%' THEN 'OptimizePrompt' WHEN LOWER(lineItem_LineItemDescription) LIKE '%marketplace%' AND LOWER(lineItem_UsageType) LIKE '%input%' THEN 'Input Tokens' WHEN LOWER(lineItem_LineItemDescription) LIKE '%marketplace%' AND LOWER(lineItem_UsageType) LIKE '%output%' THEN 'Output Tokens' ELSE 'Other Usage' END AS UsageCategory, CASE WHEN lineItem_LineItemDescription LIKE '%Marketplace%' THEN SPLIT_PART (lineItem_LineItemDescription, '|', 3) ELSE pricing_unit END AS PricingUnit, SUM(lineItem_UsageAmount) AS SUM_Consumption_In_Units, SUM(lineItem_UnblendedCost) AS SUM_Cost, CASE WHEN lineItem_LineItemDescription LIKE '%Marketplace%' THEN 'AWS Marketplace' ELSE 'AWS' END AS PublisherName, lineItem_CurrencyCode AS CurrencyCode FROM AWS_CUR WHERE product_ProductName LIKE '%Amazon Bedrock%' GROUP BY timeInterval_Month, lineItem_UsageType, lineItem_Operation, product_region, lineItem_UsageAccountId, \"organization##accountname\", bill_PayerAccountId, product_ProductName, lineItem_LineItemDescription, pricing_unit, lineItem_CurrencyCode ORDER BY BillingPeriodStart ASC, SUM_Cost DESC",
"dataGranularity": "MONTHLY",
"timeRange": {
"last": 12
},
"limit": -1
}
Azure:
{
"sqlStatement": "SELECT 'Azure' AS ProviderName, timeInterval_Month AS BillingPeriodStart, SubscriptionID AS SubAccountId, SubscriptionName AS SubAccountName, BillingAccountId AS BilledAccountId, LOWER(ResourceLocation) AS RegionName, ResourceGroup AS ResourceGroupName, ProductName AS ServiceName, MeterName AS ServiceSubcategory, CASE WHEN LOWER(ProductName) LIKE '%ai search - free%' THEN 'AI Search - Free' WHEN LOWER(ProductName) LIKE '%ai search - standard%' THEN 'AI Search - Standard' WHEN LOWER(MeterName) LIKE '%o4-mini%' THEN 'o4-series' WHEN LOWER(MeterName) LIKE '%o3%' THEN 'o3-series' WHEN LOWER(MeterName) LIKE '%o1%' THEN 'o1-series' WHEN LOWER(MeterName) LIKE '%gpt 5.2%' OR LOWER(MeterName) LIKE '%gpt-5.2%' THEN 'GPT-5.2' WHEN LOWER(MeterName) LIKE '%gpt 5.1%' OR LOWER(MeterName) LIKE '%gpt-5.1%' THEN 'GPT-5.1' WHEN LOWER(MeterName) LIKE '%gpt 5%' OR LOWER(MeterName) LIKE '%gpt-5%' THEN 'GPT-5' WHEN LOWER(MeterName) LIKE '%gpt-4.1-mini%' OR LOWER(MeterName) LIKE '%gpt 4.1 mini%' THEN 'GPT-4.1 Mini' WHEN LOWER(MeterName) LIKE '%gpt-4.1%' THEN 'GPT-4.1' WHEN LOWER(MeterName) LIKE '%gpt-4o-mini%' OR LOWER(MeterName) LIKE '%gpt 4o mini%' THEN 'GPT-4o Mini' WHEN LOWER(MeterName) LIKE '%gpt-4o%' OR LOWER(MeterName) LIKE '%gpt 4o%' THEN 'GPT-4o' WHEN LOWER(MeterName) LIKE '%gpt-4%' OR LOWER(MeterName) LIKE '%gpt 4%' THEN 'GPT-4' WHEN LOWER(MeterName) LIKE '%gpt-3.5%' OR LOWER(MeterName) LIKE '%gpt-35%' OR LOWER(MeterName) LIKE '%gpt 3.5%' THEN 'GPT-3.5 Turbo' WHEN LOWER(MeterName) LIKE '%gpt-image%' OR LOWER(MeterName) LIKE '%dall-e%' THEN 'Dall-E / Image' WHEN LOWER(MeterName) LIKE '%whisper%' THEN 'Whisper' WHEN LOWER(MeterName) LIKE '%speech%' THEN 'Azure Speech' WHEN LOWER(MeterName) LIKE '%code-interpreter%' THEN 'Code Interpreter' WHEN LOWER(MeterName) LIKE '%k2 thinking%' OR LOWER(MeterName) LIKE '%kimi%' THEN 'Kimi-K2' WHEN LOWER(MeterName) LIKE '%r1 %' OR LOWER(MeterName) LIKE '%deepseek%' THEN 'Deepseek' WHEN LOWER(MeterName) LIKE '%embedding%' THEN 'Embeddings' ELSE MeterSubCategory END AS ModelName, CASE WHEN LOWER(MeterName) LIKE '%cached%' OR LOWER(MeterName) LIKE '%cchd%' THEN 'Cached Tokens' WHEN LOWER(MeterName) LIKE '%outp%' OR LOWER(MeterName) LIKE '%outpt%' OR LOWER(MeterName) LIKE '%txt out%' OR LOWER(MeterName) LIKE '%opt%' THEN 'Output Tokens' WHEN LOWER(MeterName) LIKE '%inp%' OR LOWER(MeterName) LIKE '%inpt%' OR LOWER(MeterName) LIKE '%tokens%' THEN 'Input Tokens' WHEN LOWER(MeterName) LIKE '%images%' THEN 'Image Generation' WHEN LOWER(MeterName) LIKE '%session%' THEN 'Sessions' WHEN LOWER(MeterName) LIKE '%text records%' THEN 'Text Records' WHEN LOWER(MeterName) LIKE '%characters%' OR LOWER(MeterName) LIKE '%speech to text%' THEN 'Characters' WHEN LOWER(MeterName) LIKE '%pages%' THEN 'OCR Pages' WHEN LOWER(MeterName) LIKE '%search%' OR LOWER(MeterName) LIKE '%unit%' THEN 'Service Units' ELSE 'Other Provisioned' END AS UsageCategory, UnitOfMeasure AS PricingUnit, SUM(Quantity) AS SUM_Consumption_In_Units, SUM(CostInReportingCurrency) AS SUM_Cost, 'Microsoft' AS PublisherName, ReportingCurrency AS CurrencyCode FROM AZURE_COST_USAGE WHERE ( LOWER(MeterCategory) IN ('foundry models', 'foundry tools') OR LOWER(ProductName) LIKE '%azure openai%' OR LOWER(ProductName) LIKE '%ai search%' OR LOWER(ProductName) LIKE '%cognitive%' ) GROUP BY timeInterval_Month, SubscriptionName, SubscriptionID, BillingAccountId, ResourceGroup, MeterCategory, ProductName, MeterName, MeterSubCategory, UnitOfMeasure, ReportingCurrency, ResourceLocation ORDER BY BillingPeriodStart ASC, SUM_Cost DESC",
"needBackLinkingForTags": true,
"dataGranularity": "MONTHLY",
"timeRange": {
"last": 12
},
"limit": -1
}
GCP:
{
"sqlStatement": "SELECT 'GCP' AS ProviderName, timeInterval_Month AS BillingPeriodStart, Project_Id AS SubAccountId, Project_Name AS SubAccountName, Billing_Account_Id AS BilledAccountId, Region AS RegionName, Service_Description AS ServiceName, Sku_Description AS ServiceSubcategory, CASE WHEN LOWER(Sku_Description) LIKE '%gemini 3.1 flash%' THEN 'Gemini 3.1 Flash' WHEN LOWER(Sku_Description) LIKE '%gemini 3.0 pro%' OR LOWER(Sku_Description) LIKE '%gemini 3 pro%' OR LOWER(Sku_Description) LIKE '%gemini_3_pro%' THEN 'Gemini 3 Pro' WHEN LOWER(Sku_Description) LIKE '%gemini 3 flash%' THEN 'Gemini 3 Flash' WHEN LOWER(Sku_Description) LIKE '%gemini 2.5 pro%' THEN 'Gemini 2.5 Pro' WHEN LOWER(Sku_Description) LIKE '%gemini 2.5 flash%' THEN 'Gemini 2.5 Flash' WHEN LOWER(Sku_Description) LIKE '%gemini 2.0 flash%' THEN 'Gemini 2.0 Flash' WHEN LOWER(Sku_Description) LIKE '%gemini 1.5 pro%' THEN 'Gemini 1.5 Pro' WHEN LOWER(Sku_Description) LIKE '%gemini 1.5 flash%' THEN 'Gemini 1.5 Flash' WHEN LOWER(Sku_Description) LIKE '%gemini pro%' THEN 'Gemini Pro' WHEN LOWER(Sku_Description) LIKE '%gemini code assist%' THEN 'Gemini Code Assist' WHEN LOWER(Sku_Description) LIKE '%claude 3.7 sonnet%' THEN 'Claude 3.7 Sonnet' WHEN LOWER(Service_Description) LIKE '%claude sonnet 4.5%' OR LOWER(Sku_Description) LIKE '%claude sonnet 4.5%' THEN 'Claude 4.5 Sonnet' WHEN LOWER(Sku_Description) LIKE '%claude haiku 4 5%' OR LOWER(Sku_Description) LIKE '%claude haiku 4.5%' THEN 'Claude 4.5 Haiku' WHEN LOWER(Service_Description) LIKE '%claude opus 4.6%' OR LOWER(Sku_Description) LIKE '%claude opus 4.6%' THEN 'Claude 4.6 Opus' WHEN LOWER(Service_Description) LIKE '%claude opus 4.5%' OR LOWER(Sku_Description) LIKE '%claude opus 4.5%' THEN 'Claude 4.5 Opus' WHEN LOWER(Service_Description) LIKE '%claude sonnet 4%' OR LOWER(Sku_Description) LIKE '%claude sonnet 4%' THEN 'Claude 4.0 Sonnet' WHEN LOWER(Sku_Description) LIKE '%claude 3.5 sonnet%' THEN 'Claude 3.5 Sonnet' WHEN LOWER(Sku_Description) LIKE '%claude 3.5 haiku%' THEN 'Claude 3.5 Haiku' WHEN LOWER(Sku_Description) LIKE '%claude 3 haiku%' THEN 'Claude 3 Haiku' WHEN LOWER(Sku_Description) LIKE '%veo 3%' THEN 'Veo 3' WHEN LOWER(Sku_Description) LIKE '%veo 2%' THEN 'Veo 2' WHEN LOWER(Sku_Description) LIKE '%imagen 4%' THEN 'Imagen 4' WHEN LOWER(Sku_Description) LIKE '%imagen 3%' THEN 'Imagen 3' WHEN LOWER(Sku_Description) LIKE '%imagen%' THEN 'Imagen' WHEN LOWER(Sku_Description) LIKE '%palm text bison%' THEN 'PaLM' WHEN LOWER(Sku_Description) LIKE '%lyria2%' THEN 'Lyria 2' WHEN LOWER(Sku_Description) LIKE '%embed%' THEN 'Embeddings' WHEN LOWER(Sku_Description) LIKE '%vector search%' OR LOWER(Service_Description) LIKE '%vertex ai search%' THEN 'Vector Search' WHEN LOWER(Sku_Description) LIKE '%grounding%' OR LOWER(Sku_Description) LIKE '%search tool%' THEN 'LLM Grounding' WHEN LOWER(Service_Description) LIKE '%cloud speech%' THEN 'Cloud Speech API' WHEN LOWER(Service_Description) LIKE '%document ai%' THEN 'Cloud Document AI' WHEN LOWER(Sku_Description) LIKE '%dialogflow%' OR LOWER(Sku_Description) LIKE '%vertex ai conversation%' THEN 'Dialogflow / Conversation' WHEN LOWER(Sku_Description) LIKE '%evaluation service%' THEN 'Vertex AI Evaluation' WHEN LOWER(Sku_Description) LIKE '%nvidia%' OR LOWER(Sku_Description) LIKE '%colab%' OR LOWER(Sku_Description) LIKE '%feature store%' OR LOWER(Sku_Description) LIKE '%vertex ai: online/batch%' OR LOWER(Sku_Description) LIKE '%vertex ai: training%' OR LOWER(Sku_Description) LIKE '%vertex ai: automl%' OR LOWER(Sku_Description) LIKE '%tensorboard%' OR LOWER(Sku_Description) LIKE '%metadata storage%' OR LOWER(Sku_Description) LIKE '%pipeline job%' THEN 'Vertex AI Infrastructure' ELSE 'Other AI Models' END AS ModelName, CASE WHEN LOWER(Sku_Description) LIKE '%cach%' THEN 'Cached Tokens' WHEN LOWER(Sku_Description) LIKE '%input%' THEN 'Input Tokens' WHEN LOWER(Sku_Description) LIKE '%output%' THEN 'Output Tokens' WHEN LOWER(Sku_Description) LIKE '%audio generation%' OR LOWER(Sku_Description) LIKE '%veo%' OR LOWER(Sku_Description) LIKE '%video generation%' THEN 'Video / Audio Generation' WHEN LOWER(Sku_Description) LIKE '%imagen%' OR LOWER(Sku_Description) LIKE '%virtual try-on%' OR LOWER(Sku_Description) LIKE '%image generation%' THEN 'Image Generation' WHEN LOWER(Sku_Description) LIKE '%vector search%' OR LOWER(Sku_Description) LIKE '%index%' THEN 'Search/Indexing' ELSE 'Other Usage' END AS UsageCategory, Units AS PricingUnit, SUM(Consumption_In_Units) AS SUM_Consumption_In_Units, SUM(Cost) AS SUM_Cost, 'Google Cloud' AS PublisherName, Currency AS CurrencyCode FROM GCP_BILLING_EXPORT WHERE Project_Id IS NOT NULL AND ( LOWER(Service_Description) IN ( 'vertex ai', 'gemini api', 'vertex ai search', 'cloud document ai api', 'cloud speech api', 'cloud dialogflow api' ) OR LOWER(Service_Description) LIKE '%claude%' OR LOWER(Sku_Description) LIKE '%gemini%' ) GROUP BY timeInterval_Month, Project_Id, Project_Name, Billing_Account_Id, Service_Description, Sku_Description, Cost_Type, Currency, Region, Units ORDER BY BillingPeriodStart ASC, SUM_Cost DESC",
"dataGranularity": "MONTHLY",
"timeRange": {
"last": 12
},
"limit": -1
}