"use strict";
/**
 * AI Provider Client Factories
 *
 * Provides lazy-initialized clients for OpenAI and Anthropic APIs.
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PARALLEL_API_BATCHES = exports.FILES_PER_API_BATCH = exports.HAIKU_PRICING = exports.GPT5_MINI_PRICING = void 0;
exports.getAnthropicClient = getAnthropicClient;
exports.getOpenAIClient = getOpenAIClient;
const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
const openai_1 = __importDefault(require("openai"));
// ============================================================================
// Anthropic Client
// ============================================================================
/**
 * Initialize Anthropic client
 */
function getAnthropicClient() {
    const apiKey = process.env.ANTHROPIC_API_KEY;
    if (!apiKey) {
        throw new Error('ANTHROPIC_API_KEY environment variable is not set');
    }
    return new sdk_1.default({ apiKey });
}
// ============================================================================
// OpenAI Client
// ============================================================================
// Singleton instance for connection reuse
let openaiClient = null;
/**
 * Initialize OpenAI client (singleton)
 */
function getOpenAIClient() {
    if (!openaiClient) {
        const apiKey = process.env.OPENAI_API_KEY;
        if (!apiKey) {
            throw new Error('OPENAI_API_KEY environment variable is not set');
        }
        openaiClient = new openai_1.default({ apiKey });
    }
    return openaiClient;
}
// ============================================================================
// Pricing Constants
// ============================================================================
/**
 * GPT-5-mini pricing constants (per 1M tokens)
 */
exports.GPT5_MINI_PRICING = {
    input: 0.25, // $0.25 per 1M tokens
    cached: 0.025, // $0.025 per 1M tokens (10% of input)
    output: 2.00, // $2.00 per 1M tokens
};
/**
 * Claude 3.5 Haiku pricing constants (per 1M tokens)
 */
exports.HAIKU_PRICING = {
    input: 0.80, // $0.80 per 1M tokens
    cacheWrite: 1.00, // $1.00 per 1M tokens (5m cache)
    cacheRead: 0.08, // $0.08 per 1M tokens
    output: 4.00, // $4.00 per 1M tokens
};
// ============================================================================
// Batching Configuration
// ============================================================================
/**
 * Number of files to include in each API call (Phase 2 optimization)
 * Batching multiple files reduces API overhead and leverages prompt caching better
 */
exports.FILES_PER_API_BATCH = 8;
/**
 * Number of API batches to process in parallel (Phase 3 optimization)
 * Higher values = faster scans but more API load
 * OpenAI/GPT-5-mini handles this well
 */
exports.PARALLEL_API_BATCHES = 6;
//# sourceMappingURL=clients.js.map