Skip to content

ccusage / data-loader / sessionUsageSchema

Variable: sessionUsageSchema

ts
const sessionUsageSchema: ObjectSchema<{
  sessionId: SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Session ID cannot be empty">, BrandAction<string, "SessionId">]>;
  projectPath: SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Project path cannot be empty">, BrandAction<string, "ProjectPath">]>;
  inputTokens: NumberSchema<undefined>;
  outputTokens: NumberSchema<undefined>;
  cacheCreationTokens: NumberSchema<undefined>;
  cacheReadTokens: NumberSchema<undefined>;
  totalCost: NumberSchema<undefined>;
  lastActivity: SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Date must be in YYYY-MM-DD format">, BrandAction<string, "ActivityDate">]>;
  versions: ArraySchema<SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Invalid version format">, BrandAction<string, "Version">]>, undefined>;
  modelsUsed: ArraySchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>, undefined>;
  modelBreakdowns: ArraySchema<ObjectSchema<{
     modelName: SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>;
     inputTokens: NumberSchema<undefined>;
     outputTokens: NumberSchema<undefined>;
     cacheCreationTokens: NumberSchema<undefined>;
     cacheReadTokens: NumberSchema<undefined>;
     cost: NumberSchema<undefined>;
  }, undefined>, undefined>;
}, undefined>;

Valibot schema for session-based usage aggregation data

Released under the MIT License.