Table of Contents

Interface IBudgetTracker

Namespace
JD.AI.Core.Governance
Assembly
JD.AI.Core.dll

Tracks AI provider spending against daily and monthly budget limits.

public interface IBudgetTracker

Methods

GetStatusAsync(CancellationToken)

Returns the current spending status.

Task<BudgetStatus> GetStatusAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task<BudgetStatus>

IsWithinBudgetAsync(BudgetPolicy?, CancellationToken)

Returns true when the current spend is within the configured limits. If policy is null, always returns true.

Task<bool> IsWithinBudgetAsync(BudgetPolicy? policy, CancellationToken ct = default)

Parameters

policy BudgetPolicy
ct CancellationToken

Returns

Task<bool>

RecordSpendAsync(decimal, string, CancellationToken)

Records spend for a provider interaction.

Task RecordSpendAsync(decimal amountUsd, string providerName, CancellationToken ct = default)

Parameters

amountUsd decimal
providerName string
ct CancellationToken

Returns

Task