---
title: "Usage data model"
url: "https://docs.unified.to/compute/usage/model"
description: "The Usage data model object in Unified's Usage API: 11 fields, including created_at, updated_at and start_at, with types and enum values."
---
# Usage data model

 View field support, webhooks, and list parameters for each integration on the [Supported Integrations](https://docs.unified.to/compute/integrations.md) page. 

| Field        | Type               | Required | Description                                                                                  |
| ------------ | ------------------ | -------- | -------------------------------------------------------------------------------------------- |
| id           | string             | No       | Unique identifier for the usage record                                                       |
| created\_at  | string (date-time) | No       | When the usage record was created (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)                   |
| updated\_at  | string (date-time) | No       | When the usage record was last updated (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)              |
| start\_at    | string (date-time) | No       | Start of the usage period (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)                           |
| end\_at      | string (date-time) | No       | End of the usage period (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)                             |
| instance\_id | string             | No       | The instance the usage belongs to, when per-instance                                         |
| category     | enum               | No       | What was consumed Values: GPU, CPU, MEMORY, STORAGE, NETWORK, OTHER                          |
| quantity     | number             | No       | Amount consumed, in unit                                                                     |
| unit         | enum               | No       | Unit of quantity Values: GPU\_HOUR, VCPU\_SECOND, GB\_SECOND, GB\_MONTH, BYTE, SECOND, OTHER |
| cost\_amount | number             | No       | Cost of the usage, when the vendor reports it                                                |
| currency     | string             | No       | Currency 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

```typescript
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]

```
