Usage data model

View field support, webhooks, and list parameters for each integration on the Supported Integrations page.

FieldTypeRequiredDescription
idstringNoUnique identifier for the usage record
created_atstring (date-time)NoWhen the usage record was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
updated_atstring (date-time)NoWhen the usage record was last updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
start_atstring (date-time)NoStart of the usage period (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
end_atstring (date-time)NoEnd of the usage period (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
instance_idstringNoThe instance the usage belongs to, when per-instance
categoryenumNoWhat was consumed Values: GPU, CPU, MEMORY, STORAGE, NETWORK, OTHER
quantitynumberNoAmount consumed, in unit
unitenumNoUnit of quantity Values: GPU_HOUR, VCPU_SECOND, GB_SECOND, GB_MONTH, BYTE, SECOND, OTHER
cost_amountnumberNoCost of the usage, when the vendor reports it
currencystringNoCurrency of cost_amount (ISO 4217)

TypeScript

TypeScript
export type ComputeUsage = {
	id?: string; // Unique identifier for the usage record
	created_at?: string-time; // When the usage record was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	updated_at?: string-time; // When the usage record was last updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	start_at?: string-time; // Start of the usage period (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	end_at?: string-time; // End of the usage period (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)
	instance_id?: string; // The instance the usage belongs to, when per-instance
	category?: 'GPU' | 'CPU' | 'MEMORY' | 'STORAGE' | 'NETWORK' | 'OTHER'; // What was consumed
	quantity?: number; // Amount consumed, in unit
	unit?: 'GPU_HOUR' | 'VCPU_SECOND' | 'GB_SECOND' | 'GB_MONTH' | 'BYTE' | 'SECOND' | 'OTHER'; // Unit of quantity
	cost_amount?: number; // Cost of the usage, when the vendor reports it
	currency?: string; // Currency of cost_amount (ISO 4217)
	raw?: any; // Raw data from integration
} 

Zod

Zod
import { z } from 'zod';

export const ZodComputeUsage = z.object({
	id: z.string().optional().describe("Unique identifier for the usage record"),
	created_at: z.string-time().optional().describe("When the usage record was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	updated_at: z.string-time().optional().describe("When the usage record was last updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	start_at: z.string-time().optional().describe("Start of the usage period (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	end_at: z.string-time().optional().describe("End of the usage period (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"),
	instance_id: z.string().optional().describe("The instance the usage belongs to, when per-instance"),
	category: z.enum("GPU", "CPU", "MEMORY", "STORAGE", "NETWORK", "OTHER").optional().describe("What was consumed"),
	quantity: z.number().optional().describe("Amount consumed, in unit"),
	unit: z.enum("GPU_HOUR", "VCPU_SECOND", "GB_SECOND", "GB_MONTH", "BYTE", "SECOND", "OTHER").optional().describe("Unit of quantity"),
	cost_amount: z.number().optional().describe("Cost of the usage, when the vendor reports it"),
	currency: z.string().optional().describe("Currency of cost_amount (ISO 4217)"),

});

Python

Python
import dataclasses

@dataclasses.dataclass
class ComputeUsageCategory(str, Enum):
	GPU = 'GPU'
	CPU = 'CPU'
	MEMORY = 'MEMORY'
	STORAGE = 'STORAGE'
	NETWORK = 'NETWORK'
	OTHER = 'OTHER'

@dataclasses.dataclass
class ComputeUsageUnit(str, Enum):
	GPU_HOUR = 'GPU_HOUR'
	VCPU_SECOND = 'VCPU_SECOND'
	GB_SECOND = 'GB_SECOND'
	GB_MONTH = 'GB_MONTH'
	BYTE = 'BYTE'
	SECOND = 'SECOND'
	OTHER = 'OTHER'

@dataclasses.dataclass
class ComputeUsage:
	"""Unique identifier for the usage record"""
	id: Optional[str]
	"""When the usage record was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	created_at: Optional[str]
	"""When the usage record was last updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	updated_at: Optional[str]
	"""Start of the usage period (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	start_at: Optional[str]
	"""End of the usage period (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)"""
	end_at: Optional[str]
	"""The instance the usage belongs to, when per-instance"""
	instance_id: Optional[str]
	"""What was consumed"""
	category: Optional[ComputeUsageCategory]
	"""Amount consumed, in unit"""
	quantity: Optional[int]
	"""Unit of quantity"""
	unit: Optional[ComputeUsageUnit]
	"""Cost of the usage, when the vendor reports it"""
	cost_amount: Optional[int]
	"""Currency of cost_amount (ISO 4217)"""
	currency: Optional[str]
Are we missing anything? Let us know
Was this page helpful?