@@ -12,15 +12,32 @@ description: Cost protocol schemas
1212## TypeScript Usage
1313
1414``` typescript
15- import { BillingPeriodSchema , BudgetLimitSchema , BudgetStatusSchema , BudgetTypeSchema , CostAlertSchema , CostAlertTypeSchema , CostAnalyticsSchema , CostBreakdownDimensionSchema , CostBreakdownEntrySchema , CostEntrySchema , CostMetricTypeSchema , CostOptimizationRecommendationSchema , CostQueryFiltersSchema , CostReportSchema } from ' @objectstack/spec/ai' ;
16- import type { BillingPeriod , BudgetLimit , BudgetStatus , BudgetType , CostAlert , CostAlertType , CostAnalytics , CostBreakdownDimension , CostBreakdownEntry , CostEntry , CostMetricType , CostOptimizationRecommendation , CostQueryFilters , CostReport } from ' @objectstack/spec/ai' ;
15+ import { AIOperationCostSchema , BillingPeriodSchema , BudgetLimitSchema , BudgetStatusSchema , BudgetTypeSchema , CostAlertSchema , CostAlertTypeSchema , CostAnalyticsSchema , CostBreakdownDimensionSchema , CostBreakdownEntrySchema , CostEntrySchema , CostMetricTypeSchema , CostOptimizationRecommendationSchema , CostQueryFiltersSchema , CostReportSchema , TokenUsageSchema } from ' @objectstack/spec/ai' ;
16+ import type { AIOperationCost , BillingPeriod , BudgetLimit , BudgetStatus , BudgetType , CostAlert , CostAlertType , CostAnalytics , CostBreakdownDimension , CostBreakdownEntry , CostEntry , CostMetricType , CostOptimizationRecommendation , CostQueryFilters , CostReport , TokenUsage } from ' @objectstack/spec/ai' ;
1717
1818// Validate data
19- const result = BillingPeriodSchema .parse (data );
19+ const result = AIOperationCostSchema .parse (data );
2020```
2121
2222---
2323
24+ ## AIOperationCost
25+
26+ ### Properties
27+
28+ | Property | Type | Required | Description |
29+ | :--- | :--- | :--- | :--- |
30+ | ** operationId** | ` string ` | ✅ | |
31+ | ** operationType** | ` Enum<'conversation' \| 'orchestration' \| 'prediction' \| 'rag' \| 'nlq'> ` | ✅ | |
32+ | ** agentName** | ` string ` | optional | Agent that performed the operation |
33+ | ** modelId** | ` string ` | ✅ | |
34+ | ** tokens** | ` object ` | ✅ | |
35+ | ** cost** | ` number ` | ✅ | Cost in USD |
36+ | ** timestamp** | ` string ` | ✅ | |
37+ | ** metadata** | ` Record<string, any> ` | optional | |
38+
39+ ---
40+
2441## BillingPeriod
2542
2643### Allowed Values
@@ -316,3 +333,15 @@ const result = BillingPeriodSchema.parse(data);
316333| ** format** | ` Enum<'summary' \| 'detailed' \| 'executive'> ` | optional | |
317334| ** currency** | ` string ` | optional | |
318335
336+ ---
337+
338+ ## TokenUsage
339+
340+ ### Properties
341+
342+ | Property | Type | Required | Description |
343+ | :--- | :--- | :--- | :--- |
344+ | ** prompt** | ` integer ` | ✅ | Input tokens |
345+ | ** completion** | ` integer ` | ✅ | Output tokens |
346+ | ** total** | ` integer ` | ✅ | Total tokens |
347+
0 commit comments