Skip to main content
The genai_get_pricing function retrieves the pricing information for a specific AI model. It returns a dynamic object containing the input token price and output token price per million tokens, which you can use for cost calculations and budgeting. You can use this function to display pricing information, create cost calculators, audit pricing data, or understand the cost structure of different AI models.

For users of other query languages

If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.
In Splunk SPL, you would typically use a lookup table to retrieve pricing information by model name.
In ANSI SQL, you would join with a pricing table to get model costs.

Usage

Syntax

Parameters

Returns

Returns a dynamic object containing pricing information with the following structure:
Returns null if the model is not recognized.

Example

Get pricing information for a GenAI model to understand cost structure. Query
Run in Playground Output This query shows which models are being used and their associated pricing, helping teams make informed decisions.
  • genai_cost: Calculates total cost for a conversation. Use this for actual cost calculation after retrieving pricing information.
  • genai_input_cost: Calculates input token cost. This function uses genai_get_pricing internally to determine input costs.
  • genai_output_cost: Calculates output token cost. This function uses genai_get_pricing internally to determine output costs.
  • genai_estimate_tokens: Estimates token count. Combine with pricing information to predict costs before making API calls.