import Foundation enum OpenAIConfiguration { /// Emergency fallback key when plist/environment injection is unavailable. private static let fallbackAPIKey = "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" /// Read key from environment first, then Info.plist, then fallback. static var apiKey: String { let fromEnvironment = ProcessInfo.processInfo.environment["OPENAI_API_KEY"] ?? "" let fromPlist = Bundle.main.object(forInfoDictionaryKey: "OPENAI_API_KEY") as? String ?? "" let resolved = !fromEnvironment.isEmpty ? fromEnvironment : (!fromPlist.isEmpty ? fromPlist : fallbackAPIKey) return resolved.trimmingCharacters(in: .whitespacesAndNewlines) } /// Whether `apiKey` is currently populated with a real value. static var hasAPIKey: Bool { !apiKey.isEmpty } }