/**
 * Default pricing table for known models (USD per million tokens).
 * Single source of truth — apt-tools.mjs imports from compiled dist.
 * Update this table as providers change rates.
 */
export const DEFAULT_PRICING = {
    'claude-opus-4-6': { inputPerMillion: 15, outputPerMillion: 75 },
    'claude-sonnet-4-5-20250929': { inputPerMillion: 3, outputPerMillion: 15 },
    'claude-sonnet-4-20250514': { inputPerMillion: 3, outputPerMillion: 15 },
    'claude-haiku-3-5-20241022': { inputPerMillion: 0.8, outputPerMillion: 4 },
    'gpt-4o': { inputPerMillion: 2.5, outputPerMillion: 10 },
    'gpt-4o-mini': { inputPerMillion: 0.15, outputPerMillion: 0.6 },
    'o3-mini': { inputPerMillion: 1.1, outputPerMillion: 4.4 },
    o3: { inputPerMillion: 10, outputPerMillion: 40 },
    'gemini-2.5-pro': { inputPerMillion: 1.25, outputPerMillion: 10 },
    'gemini-2.5-flash': { inputPerMillion: 0.15, outputPerMillion: 0.6 },
};
/**
 * Calculate cost in USD for a given token usage and model.
 *
 * Lookup order: customPricing -> DEFAULT_PRICING -> unknown (zero cost).
 */
export function calculateCost(inputTokens, outputTokens, modelId, customPricing) {
    // Check custom pricing first
    if (customPricing && modelId in customPricing) {
        const pricing = customPricing[modelId];
        const costUsd = (inputTokens / 1_000_000) * pricing.inputPerMillion +
            (outputTokens / 1_000_000) * pricing.outputPerMillion;
        return { costUsd, pricingSource: 'custom' };
    }
    // Check default pricing
    if (modelId in DEFAULT_PRICING) {
        const pricing = DEFAULT_PRICING[modelId];
        const costUsd = (inputTokens / 1_000_000) * pricing.inputPerMillion +
            (outputTokens / 1_000_000) * pricing.outputPerMillion;
        return { costUsd, pricingSource: 'known' };
    }
    // Unknown model — zero cost
    return { costUsd: 0, pricingSource: 'unknown' };
}
//# sourceMappingURL=pricing.js.map