@@ -68,17 +68,15 @@ export const BillingPeriodSchema = z.enum([
6868export const CostEntrySchema = z . object ( {
6969 /** Identity */
7070 id : z . string ( ) . describe ( 'Unique cost entry ID' ) ,
71- timestamp : z . string ( ) . describe ( 'ISO 8601 timestamp' ) ,
71+ timestamp : z . string ( ) . datetime ( ) . describe ( 'ISO 8601 timestamp' ) ,
7272
7373 /** Request Details */
7474 modelId : z . string ( ) . describe ( 'AI model used' ) ,
7575 provider : z . string ( ) . describe ( 'AI provider (e.g., "openai", "anthropic")' ) ,
7676 operation : z . string ( ) . describe ( 'Operation type (e.g., "chat_completion", "embedding")' ) ,
7777
78- /** Usage Metrics */
79- promptTokens : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
80- completionTokens : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
81- totalTokens : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
78+ /** Usage Metrics - Standardized */
79+ tokens : TokenUsageSchema . optional ( ) . describe ( 'Standardized token usage' ) ,
8280 requestCount : z . number ( ) . int ( ) . positive ( ) . default ( 1 ) ,
8381
8482 /** Cost Calculation */
@@ -156,8 +154,8 @@ export const BudgetStatusSchema = z.object({
156154 scope : z . string ( ) . optional ( ) ,
157155
158156 /** Current Period */
159- periodStart : z . string ( ) . describe ( 'ISO 8601 timestamp' ) ,
160- periodEnd : z . string ( ) . describe ( 'ISO 8601 timestamp' ) ,
157+ periodStart : z . string ( ) . datetime ( ) . describe ( 'ISO 8601 timestamp' ) ,
158+ periodEnd : z . string ( ) . datetime ( ) . describe ( 'ISO 8601 timestamp' ) ,
161159
162160 /** Usage */
163161 currentCost : z . number ( ) . nonnegative ( ) . default ( 0 ) ,
@@ -175,7 +173,7 @@ export const BudgetStatusSchema = z.object({
175173 projectedOverage : z . number ( ) . nonnegative ( ) . optional ( ) . describe ( 'Projected overage' ) ,
176174
177175 /** Last Update */
178- lastUpdated : z . string ( ) . describe ( 'ISO 8601 timestamp' ) ,
176+ lastUpdated : z . string ( ) . datetime ( ) . describe ( 'ISO 8601 timestamp' ) ,
179177} ) ;
180178
181179/**
@@ -195,7 +193,7 @@ export const CostAlertTypeSchema = z.enum([
195193export const CostAlertSchema = z . object ( {
196194 /** Alert Details */
197195 id : z . string ( ) ,
198- timestamp : z . string ( ) . describe ( 'ISO 8601 timestamp' ) ,
196+ timestamp : z . string ( ) . datetime ( ) . describe ( 'ISO 8601 timestamp' ) ,
199197 type : CostAlertTypeSchema ,
200198 severity : z . enum ( [ 'info' , 'warning' , 'critical' ] ) ,
201199
@@ -217,7 +215,7 @@ export const CostAlertSchema = z.object({
217215 /** Status */
218216 acknowledged : z . boolean ( ) . default ( false ) ,
219217 acknowledgedBy : z . string ( ) . optional ( ) ,
220- acknowledgedAt : z . string ( ) . optional ( ) ,
218+ acknowledgedAt : z . string ( ) . datetime ( ) . optional ( ) ,
221219 resolved : z . boolean ( ) . default ( false ) ,
222220
223221 /** Metadata */
@@ -255,17 +253,17 @@ export const CostBreakdownEntrySchema = z.object({
255253 percentageOfTotal : z . number ( ) . min ( 0 ) . max ( 1 ) ,
256254
257255 /** Time Range */
258- periodStart : z . string ( ) . optional ( ) ,
259- periodEnd : z . string ( ) . optional ( ) ,
256+ periodStart : z . string ( ) . datetime ( ) . optional ( ) ,
257+ periodEnd : z . string ( ) . datetime ( ) . optional ( ) ,
260258} ) ;
261259
262260/**
263261 * Cost Analytics
264262 */
265263export const CostAnalyticsSchema = z . object ( {
266264 /** Time Range */
267- periodStart : z . string ( ) . describe ( 'ISO 8601 timestamp' ) ,
268- periodEnd : z . string ( ) . describe ( 'ISO 8601 timestamp' ) ,
265+ periodStart : z . string ( ) . datetime ( ) . describe ( 'ISO 8601 timestamp' ) ,
266+ periodEnd : z . string ( ) . datetime ( ) . describe ( 'ISO 8601 timestamp' ) ,
269267
270268 /** Summary Metrics */
271269 totalCost : z . number ( ) . nonnegative ( ) ,
@@ -334,7 +332,7 @@ export const CostOptimizationRecommendationSchema = z.object({
334332
335333 /** Status */
336334 status : z . enum ( [ 'pending' , 'accepted' , 'rejected' , 'implemented' ] ) . default ( 'pending' ) ,
337- implementedAt : z . string ( ) . optional ( ) ,
335+ implementedAt : z . string ( ) . datetime ( ) . optional ( ) ,
338336} ) ;
339337
340338/**
@@ -344,11 +342,11 @@ export const CostReportSchema = z.object({
344342 /** Report Metadata */
345343 id : z . string ( ) ,
346344 name : z . string ( ) ,
347- generatedAt : z . string ( ) . describe ( 'ISO 8601 timestamp' ) ,
345+ generatedAt : z . string ( ) . datetime ( ) . describe ( 'ISO 8601 timestamp' ) ,
348346
349347 /** Time Range */
350- periodStart : z . string ( ) . describe ( 'ISO 8601 timestamp' ) ,
351- periodEnd : z . string ( ) . describe ( 'ISO 8601 timestamp' ) ,
348+ periodStart : z . string ( ) . datetime ( ) . describe ( 'ISO 8601 timestamp' ) ,
349+ periodEnd : z . string ( ) . datetime ( ) . describe ( 'ISO 8601 timestamp' ) ,
352350 period : BillingPeriodSchema ,
353351
354352 /** Analytics */
@@ -383,8 +381,8 @@ export const CostReportSchema = z.object({
383381 */
384382export const CostQueryFiltersSchema = z . object ( {
385383 /** Time Range */
386- startDate : z . string ( ) . optional ( ) . describe ( 'ISO 8601 timestamp' ) ,
387- endDate : z . string ( ) . optional ( ) . describe ( 'ISO 8601 timestamp' ) ,
384+ startDate : z . string ( ) . datetime ( ) . optional ( ) . describe ( 'ISO 8601 timestamp' ) ,
385+ endDate : z . string ( ) . datetime ( ) . optional ( ) . describe ( 'ISO 8601 timestamp' ) ,
388386
389387 /** Dimensions */
390388 modelIds : z . array ( z . string ( ) ) . optional ( ) ,
0 commit comments