/**
 * Cost tracking — model pricing, pre-run estimation, and post-run actuals.
 *
 * Uses a pricing table (YAML config or TS `definePricingTable()`) to compute
 * USD cost from token usage. Supports budget controls with warn/stop thresholds.
 *
 * @see docs/design-docs/architecture-overhaul/observability-telemetry.md
 */
import type { TraceTokenUsage } from "../../../_vendor/ailf-core/index.d.ts";
/** Per-model pricing (USD per 1M tokens) */
export interface ModelPricing {
    /** Input tokens cost per 1M tokens */
    input: number;
    /** Output tokens cost per 1M tokens */
    output: number;
    /** Cached input tokens cost per 1M tokens (optional) */
    cachedInput?: number;
}
/** Budget control thresholds (in USD) */
export interface BudgetConfig {
    perRun?: {
        warn: number;
        stop: number;
    };
    perTask?: {
        warn: number;
        stop: number;
    };
}
/** Cost estimate for a pipeline run */
export interface CostEstimate {
    /** Estimated total cost in USD */
    totalUSD: number;
    /** Per-model breakdown */
    perModel: {
        modelId: string;
        estimatedUSD: number;
    }[];
    /** Whether estimate exceeds budget warning threshold */
    exceedsWarning: boolean;
    /** Whether estimate exceeds budget stop threshold */
    exceedsStop: boolean;
}
/** Actual cost computed from real token usage */
export interface ActualCost {
    /** Actual total cost in USD */
    totalUSD: number;
    /** Per-model actual cost */
    perModel: {
        modelId: string;
        actualUSD: number;
        tokens: TraceTokenUsage;
    }[];
}
/** Budget check result */
export interface BudgetCheckResult {
    /** Whether to proceed */
    proceed: boolean;
    /** Warning message (if any) */
    warning?: string;
    /** Current spend in USD */
    currentUSD: number;
    /** Budget limit that was checked */
    limitUSD?: number;
}
/**
 * Compute actual cost from token usage and model pricing.
 *
 * @param usage - Token counts from provider response
 * @param pricing - Per-model pricing (USD per 1M tokens)
 * @returns Cost in USD
 */
export declare function computeCost(usage: TraceTokenUsage, pricing: ModelPricing): number;
/**
 * Look up pricing for a model ID.
 *
 * Tries exact match first, then falls back to prefix matching
 * (e.g., "openai:chat:gpt-4o-2024-11-20" matches "openai:chat:gpt-4o").
 */
export declare function lookupPricing(modelId: string, customPricing?: Record<string, ModelPricing>): ModelPricing | undefined;
/**
 * Estimate cost for a pipeline run before execution.
 *
 * Uses task count, estimated tokens per task complexity, and model pricing.
 */
export declare function estimateRunCost(taskCount: number, modelIds: string[], budget?: BudgetConfig, customPricing?: Record<string, ModelPricing>): CostEstimate;
/**
 * Check if current spend exceeds budget thresholds.
 */
export declare function checkBudget(currentUSD: number, budget: BudgetConfig, level: "perRun" | "perTask"): BudgetCheckResult;
