# AIUsage

**Kind:** Database Model

**Source:** [`atloria-monorepo/libs/database/prisma/schema.prisma`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/database/prisma/schema.prisma#L1225)

## Fields

| Field | Type | Required | Key |
|---|---|---|---|
| `id` | `String` | ✓ | PK |
| `organizationId` | `String` | ✓ |  |
| `projectId` | `String` | - |  |
| `userId` | `String` | ✓ |  |
| `provider` | `String` | ✓ |  |
| `model` | `String` | ✓ |  |
| `operationType` | `String` | ✓ |  |
| `entityType` | `String` | ✓ |  |
| `entityId` | `String` | ✓ |  |
| `inputTokens` | `Int` | ✓ |  |
| `outputTokens` | `Int` | ✓ |  |
| `totalTokens` | `Int` | ✓ |  |
| `inputCost` | `Int` | ✓ |  |
| `outputCost` | `Int` | ✓ |  |
| `totalCost` | `Int` | ✓ |  |
| `inputPricePerMToken` | `Int` | ✓ |  |
| `outputPricePerMToken` | `Int` | ✓ |  |
| `metadata` | `Json` | - |  |
| `createdAt` | `DateTime` | ✓ |  |

## Diagram

```mermaid
erDiagram
    AIUsage {
        id String [PK]
        organizationId String
        projectId String?
        userId String
        provider String
        model String
        operationType String
        entityType String
        entityId String
        inputTokens Int
        outputTokens Int
        totalTokens Int
        inputCost Int
        outputCost Int
        totalCost Int
        inputPricePerMToken Int
        outputPricePerMToken Int
        metadata Json?
        createdAt DateTime
    }
```
