export declare class CostTracker {
constructor(config?: CostTrackerConfig);
track(entry: Omit<CostEntry, "cost" | "breakdown" | "timestamp">): CostEntry;
beginPendingAttempt(attemptId: string): void;
endPendingAttempt(attemptId: string): void;
get currency(): string;
recordUsage(input: UsageRecordInput): Promise<CostAssessment>;
startAttempt(input: AccountingScope & {
attemptId: string;
operationId: string;
context: BillingContext;
attemptVisibility?: "physical" | "opaque";
}): Promise<void>;
queryUsage(query?: UsageQuery): Promise<UsagePage<UsageObservation>>;
queryCosts(query?: UsageQuery): Promise<CostQueryResult>;
queryAssessments(query?: UsageQuery & {
selected?: boolean;
targetId?: string;
}): Promise<UsagePage<CostAssessment>>;
queryRunUsage(scope: AccountingScope): Promise<TokenUsage>;
reprice(query: UsageQuery, catalog: PricingCatalog, view?: string): Promise<CostAssessment[]>;
recordReportedCost(input: ReportedCostInput, view?: string): Promise<CostAssessment>;
allocate(assessmentId: string, members: AllocationMember[], options: {
tenantId?: string;
policyVersion: string;
view?: string;
}): Promise<CostAllocation[]>;
queryAllocations(query?: UsageQuery): Promise<UsagePage<CostAllocation>>;
finalizeGroup(targetId: string, options: {
tenantId?: string;
view?: string;
confirmedFinal: true;
}): Promise<CostAssessment>;
checkBudgetAfterUsage(scope: AccountingScope): Promise<BudgetDecision>;
close(): Promise<void>;
flush(): Promise<void>;
releaseReservation(tenantId: string, reservationId: string, confirmedNotAccepted: boolean): Promise<void>;
checkBudget(scope: AccountingScope & {
attemptId?: string;
currency?: string;
}, bound?: string): Promise<BudgetDecision>;
/** @deprecated Legacy local budget check. Throws after canonical accounting; use the ledger overload. */
checkBudget(runId: string, sessionId?: string, userId?: string): void;
getSummary(filter?: {
agentName?: string;
userId?: string;
since?: Date;
}): CostSummary;
/**
* Check budget using in-progress (cumulative) usage without persisting an entry.
* Called during multi-roundtrip runs (e.g. tool calling) to enforce limits mid-run.
* @deprecated Legacy local usage only. Canonical callers use asynchronous ledger admission.
*/
checkInProgressBudget(modelId: string, cumulativeUsage: TokenUsage, runId?: string, sessionId?: string, userId?: string): boolean;
/** @deprecated Legacy local usage only. Canonical callers use asynchronous ledger admission. */
isBudgetExceeded(runId: string, sessionId?: string, userId?: string): boolean;
/** @deprecated Legacy local allowance only; queryRunUsage observes canonical usage without reserving budget. */
estimateRemaining(runId: string): {
costRemaining: number | null;
tokensRemaining: number | null;
};
getEntries(): readonly CostEntry[];
reset(): void;
}