BLOG

GPU Cloud Billing: From Usage Metering to Billing

December 10, 2025

Cloud providers building GPU or Neo Cloud services face a universal challenge: how to turn resource consumption into revenue with accuracy, automation, and operational efficiency. In our previous blog, we demonstrated how to programmatically retrieve usage data from Rafay’s Usage Metering APIs and generate structured CSVs for downstream processing in an external billing platform.

In this follow-up blog, we take the next step toward a complete billing workflow—automatically transforming usage into billable cost using SKU-specific pricing. With GPU clouds scaling faster than ever and enterprise AI workloads becoming increasingly dynamic, providers must ensure their billing engine is consistent, transparent, and tightly integrated with their platform. The enhancements described in this blog are designed exactly for that.

Why Cost Automation Matters for GPU Cloud Providers

When a customer launches a GPU VM, deploys a Slurm workload, or provisions an AI/ML environment, they expect metering and billing to just work. Fortunately, Rafay’s Usage Metering API gives providers a clean, structured view of usage—broken down by organization (i.e. tenant), profile (i.e. SKU), instance, and duration.

However, raw usage alone is not enough for billing teams. To generate invoices or chargeback reports, someone must:

  1. Map SKUs to hourly pricing
  2. Compute usage × rate
  3. Apply reserved/on-demand logic
  4. Layer in additional fees (storage, egress, warm pools, etc.)
  5. Export the results into a billing system

Most organizations build a billing pipeline for this, but without automation, billing becomes brittle and error-prone. Manually joining usage data with a price book slows invoicing cycles and creates room for discrepancies.

For organizations that do not have a billing platform, we have enhanced our original utility to now calculate costs automatically, producing a CSV that is immediately ready for billing ingestion.

About the Utility

Download

The ncp_metrics.py script is a Python utility that collects billing and usage metrics for compute and service instances from the Rafay Console API. It generates CSV reports containing detailed billing information including usage hours, billing rates, and calculated billing amounts for each instance.

What the Utility Does

  1. Fetches Instance Usage Data Retrieves compute and service instance usage data for a specified time range
  2. Retrieves Billing Information Looks up billing rates for each profile associated with instances
  3. Calculates Billing Amounts Computes total billing amounts based on usage hours and billing rates
  4. Generates CSV Reports Creates timestamped CSV files with all metrics
  5. Sorts Output Produces a sorted version of the CSV file organized by organization name

Prerequisites

  • requests - For making HTTP API calls
  • csv - For CSV file operations (built-in)
  • datetime - For date/time operations (built-in)

Environment Variables

This exercise assumes that you have access to an instance of the Rafay Platform (i.e. Controller). Ensure that you have Org Admin level access to the Default Org so that you can use the API Keys to programmatically retrieve the usage metering data.

The utility requires the following environment variables to be set:

Variable Description Example
Days Number of days to look back for usage data 30
Rafay_Default_API_Key Default API key for Rafay Console your-api-key
Partner_API_Key Partner API key for profile billing lockups your-partner-api-key
Rafay_Console_URL Rafay Console URL (without https://) console.rafay.dev
Currency Currency code for billing calculationa USD, EUR, etc. 

Usage

Step 1: Set Environment Variables

export DAYS=30
export RAFAY_DEFAULT_API_KEY="your-default-api-key"
export PARTNER_API_KEY="your-partner-api-key"
export RAFAY_CONSOLE_URL="your_rafay_url"
export CURRENCY="USD"

Step 2: Run the Utility

python ncp_metrics.py

Step 3: Review Output Files

The utility generates two CSV files:

  1. ncp-metrics-{timestamp}.csv: Raw metrics data
  2. ncp-metrics-sorted-{timestamp}.csv: Sorted by organization name

Example filenames:

  • ncp-metrics-12092025-154146.csv
  • ncp-metrics-sorted-12092025-154146.csv

Example Output

Notice the billing rate and billing amount columns.

Organization Profile Type Profile Instance Usage (h) Status Billing Rate Billing Amount (EUR)
Coke Compute medium-gpu-vm coke-2-gpu-vm 238.00h Running EUR 2/h 476
Coke Compute small-vcluster coke-small-vcluster-instance 238.00h Running EUR 2/h 476
Coke Service small-vllm small-inference-endpoint-user 238.00h Running EUR 3/h 714
Coke Service small-vllm coke-demo-inference-ep 238.00h Running EUR 3/h 714

Closing Thoughts

GPU cloud providers are moving rapidly toward usage-based economics for both infrastructure (GPU VMs, MIG slices, Slurm clusters) and AI services (model hosting, fine-tuning, inference endpoints). To operate at scale, they require automated, transparent billing workflows.

By enhancing the usage metering utility to include SKU-based cost calculation, we’ve taken a major step toward enabling frictionless billing integration for cloud and enterprise providers. The pipeline is modular, extensible, and easy to adapt to your pricing model.

Share this post

Want a deeper dive in the Rafay Platform?

Book time with an expert.

Book a demo
Tags:

You might be also be interested in...

Product

GPU Cloud Billing: From Usage Metering to Billing

In this blog, we take the next step toward a complete billing workflow—automatically transforming usage into billable cost using SKU-specific pricing.

Read Now

News

Introducing the Rafay Partner Elevate Program

The Rafay Partner Elevate Program is designed to empower our global ecosystem of partners from resellers and system integrators to managed service providers, to deliver cutting-edge AI, cloud, and Kubernetes outcomes faster and more profitably.

Read Now

Product

Empowering Platform Teams: Doing More with Less in the Kubernetes Era

This blog details the specific features of the Rafay Platform Version 4.0 Which Further Simplifies Kubernetes Management and Accelerates Cloud-Native Operations for Enterprises and Cloud Providers

Read Now