Cost Estimates, Usage Metering & Billing - Rafay Product Documentation

Dimensional SKUs

In this Get Started guide, you will learn how to do the following as a "SKU Designer" at a cloud provider.

  1. Configure a SKU with Dimension based Pricing
  2. Validate cost estimates
  3. Use APIs to programmatically retrieve usage metrics for the SKU

This data can then be used by the cloud provider's billing platform to generate a bill for the SKU.

Important

This guide assumes that you have already setup a working SKU (i.e. compute or service profile) based on other/existing Get Started guides.


1. Configure Dimension Based Pricing

Next, you will configure dimension based pricing on an existing profile within your default organization. Pricing can be configured within the Global Settings of the default Org.

The base_unit is the dividing number to determine the billable units. As an example, if the user selects 2048 for the memory and the base_unit is 1024, the user will be billed at 2x the price rate (2048/1024 = 2). The time_unit can be either m, h or d (minute/hour/day).

- name: <PROFILE_NAME>
  billing:
    currency:
    - USD
    dimensions:
    - memory
    - cpu
    ratecard:
      memory:
      - price: 2
        time_unit: h
        currency: USD
        base_unit: 1024
      cpu:
      - price: 1
        time_unit: h
        currency: USD
        base_unit: 1000

If a profile contains specific values for a dimension that each have their own pricing, we can define value based dimensions in the following way.

- name: <PROFILE_NAME>
  billing:
    currency:
    - USD
    dimensions:
    - GPU Type
    ratecard:
      GPU Type:
      - price: 1
        time_unit: h
        base_value: 1
        count_from: "GPU Count"
        currency: USD
        value: A4
      - price: 1.2
        time_unit: h
        base_value: 1
        count_from: "GPU Count"
        currency: USD
        value: L40
      - price: 1.5
        time_unit: h
        base_value: 1
        count_from: "GPU Count"
        currency: USD
        value: A100
      - price: 2.5
        time_unit: h
        base_value: 1
        count_from: "GPU Count"
        currency: USD
        value: H100

2. Configure Dimension Based Metrics

Next, you will configure the profile with the dimensions that should be reported through the metric's API. In the previous step's example, memory and CPU dimensions were added to the rate card. We will now add these two dimensions to the metrics API for this profile.

The "name" field is the name of the dimension that will be displayed in the metrics API output. The "value" field is the expression used to match the name of the dimension configured within the ratecard.

[
  {
    "name": "CPU",
    "type": "jsonpath",
    "isLabel": true,
    "value": "$.spec.variables[?(@.name == 'cpu')].value"
  },
  {
    "name": "Memory",
    "type": "jsonpath",
    "isLabel": true,
    "value": "$.spec.variables[?(@.name == 'memory')].value"
  }
]

3. View Dimension Based Pricing Estimates

Next you will use the end user facing self service portal (i.e. Developer Hub) to view the newly set dimension pricing estimates.

Within the Profile Catalog, the profile card will NOT display any cost settings. This is different than the SKU based configuration.

You will now see the estimated monthly cost of the instance. If the dimensions are updated within the window, the pricing will be updated to reflect the selections.


4. Retrieve Dimension Based Metrics/Usage

Important

It can take up to 1 hour for usage metrics to be aggregated and available on the controller for retrieval via APIs

Next you will use Swagger to access the Billing APIs in order to pull Dimension based usage metrics.

Name Value
kind Kind of profile (compute, service)
profile_name The name of the dimension based profile to filter on
range_from The date range FROM in the format 2025-07-29T00:00:00.157Z
range_to The date range To in the format 2025-07-29T00:00:00.157Z

You will notice the response for the dimension based profile will display the additional billing parameters that were defined within the profile.