Skip to main content
A transform turns usage your services already emit into cost data. It reads one event shape, maps it to cost columns, prices it, and records the result beside the rest of your spend. Use it when you have usage but no bill, such as tokens per customer from your own AI gateway or requests counted by a Prometheus counter. If you already have billing records with costs, send them with Push FOCUS data instead.

Supported formats

Each transform accepts one format. You choose it when you create the transform.

Counters and gauges

A counter, such as tokens or requests served, only goes up. CostGraph bills each increase. A gauge, such as seats in use or running instances, goes up and down. CostGraph bills a gauge by value and time: 10 seats held for 30 minutes is 5 seat-hours. Price a gauge per unit-hour. OpenTelemetry metrics declare their own type. For Prometheus, choose Metric type on the transform. Prometheus transform with Metric type set to Gauge, priced per unit-hour from value_hours.

Transform setup

A transform is set up in four parts, each on its own tab of the transform:
  1. Mapping turns a sample event into a cost row. Create a transform.
  2. Cost prices each row. Price usage.
  3. Send usage shows the endpoint and configuration for your format. Send usage.
  4. Recent events shows what was accepted and rejected. Fix rejected events.
The transform checks your sample event as you edit and shows the row it produces. You can save only when that preview is ready.

Requirements

  • Membership in the organization to create, edit, or delete transforms.
  • A push connection for each source of usage. Create it in Integrations. Refer to Create the connection.
  • An API key with the focus:write scope, created in Settings > API keys.

Next steps

Create a transform

Map a sample event to cost columns and save it.