import type { AxiosInstance } from 'axios'; export declare const USAGE_INTERVALS: readonly ["total", "day", "week", "month"]; export type UsageInterval = typeof USAGE_INTERVALS[number]; export declare const USAGE_GROUP_BY: readonly ["account", "checkType", "account,checkType"]; export type UsageGroupBy = typeof USAGE_GROUP_BY[number]; export type UsageWarningCode = 'PARTIAL_WINDOW' | 'USAGE_TERMS_FLAGGED' | 'UNKNOWN_BUDGET'; export type UsageErrorCode = 'ACCOUNT_NOT_IN_USAGE_TERMS' | 'INVALID_CURSOR' | 'INVALID_RANGE' | 'NO_USAGE_TERMS' | 'USAGE_STORE_UNAVAILABLE' | 'USAGE_TERMS_CONFLICT'; export interface UsageTermsParams { /** YYYY-MM-DD, inclusive. Resolves the usage terms that cover this date. Defaults to today. */ to?: string; } export interface UsageRangeParams extends UsageTermsParams { /** YYYY-MM-DD, inclusive. */ from?: string; accountIds?: string[]; checkTypes?: string[]; } export interface UsageSeriesParams extends UsageRangeParams { interval?: UsageInterval; groupBy?: UsageGroupBy; limit?: number; nextId?: string; } export interface UsageAccount { id: string; name: string; } export interface UsageTerms { id: string; name: string; accounts: UsageAccount[]; contractStartDate: string; contractEndDate: string; usageStartDate: string; creditBudget: number | null; standardCreditsPerUnit: number | null; premiumCreditsPerUnit: number | null; } export interface UsageCredits { used: number | null; percentOfBudget: number | null; } export interface CheckRunMeasures { totalRuns: number; finalRuns: number; retryRuns: number; cancelledRuns: number; multiStepRequests: number; playwrightBillableDurationMs: number; degradedRuns: number; failedRuns: number; errorRuns: number; abortedRuns: number; overMaxResponseTimeRuns: number; standardBillableUnits: number; premiumBillableUnits: number; } export interface AiInvocationMeasures { invocations: number; durationMs: number; } export type UsageMeter = { meterType: 'CHECK_RUN'; measures: CheckRunMeasures; } | { meterType: 'AI_INVOCATION'; measures: AiInvocationMeasures; }; export interface UsageMetrics { credits: UsageCredits; meters: UsageMeter[]; } export interface UsageWarning { code: UsageWarningCode; message: string; } export interface UsageProjectionWindow { usage: UsageMetrics; projectedAnnualPercentOfBudget: number | null; projectedCreditsAtContractEnd: number | null; projectedPercentAtContractEnd: number | null; projectedWeeksUntilExhausted: number | null; } export interface UsageProjections { weeksSinceStart: number; weeksRemaining: number; remainingCredits: number | null; windows: { sinceStart: UsageProjectionWindow; last30Days: UsageProjectionWindow; last7Days: UsageProjectionWindow; last1Day: UsageProjectionWindow; }; } export interface UsageSummary { usageTermsId: string; period: { from: string; to: string; }; totals: UsageMetrics; projections: UsageProjections; } export interface UsageRow extends UsageMetrics { periodStart: string; periodEnd: string; accountId?: string; checkType?: string; } export interface UsageSeries { usageTermsId: string; period: { from: string; to: string; interval: UsageInterval; groupBy: UsageGroupBy; }; data: UsageRow[]; length: number; nextId: string | null; warnings: UsageWarning[]; } declare class Usage { api: AxiosInstance; constructor(api: AxiosInstance); getTerms(params?: UsageTermsParams): Promise>; getSummary(params?: UsageRangeParams): Promise>; getSeries(params?: UsageSeriesParams): Promise>; } export default Usage;