590→ 591→ ## ALERTAS 592→ - [Alerta importante 1] 593→ - [Alerta importante 2] 594→ """ 595→ } 596→ 597→ private func callClaudeAPI(prompt: String) async throws -> String { 598→ guard let url = URL(string: baseURL) else { 599→ throw AIError.invalidURL 600→ } 601→ 602→ var request = URLRequest(url: url) 603→ request.httpMethod = "POST" 604→ request.setValue("application/json", forHTTPHeaderField: "Content-Type") 605→ request.setValue(apiKey, forHTTPHeaderField: "x-api-key") 606→ request.setValue("2023-06-01", forHTTPHeaderField: "anthropic-version") 607→ 608→ let body: [String: Any] = [ 609→ "model": "claude-3-haiku-20240307", 610→ "max_tokens": 4096, 611→ "messages": [ 612→ ["role": "user", "content": prompt] 613→ ] 614→ ] 615→ 616→ request.httpBody = try JSONSerialization.data(withJSONObject: body) 617→ 618→ let (data, response) = try await URLSession.shared.data(for: request) 619→ 620→ guard let httpResponse = response as? HTTPURLResponse else { 621→ throw AIError.invalidResponse 622→ } 623→ 624→ if httpResponse.statusCode != 200 { 625→ if let errorJson = try? JSONSerialization.jsonObject(with: data) as? [String: Any], 626→ let errorMessage = errorJson["error"] as? [String: Any], 627→ let message = errorMessage["message"] as? String { 628→ throw AIError.apiError(message) 629→ } 630→ throw AIError.apiError("Status code: \(httpResponse.statusCode)") 631→ } 632→ 633→ guard let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any], 634→ let content = json["content"] as? [[String: Any]], 635→ let firstContent = content.first, 636→ let text = firstContent["text"] as? String else { 637→ throw AIError.parseError 638→ } 639→ 640→ return text 641→ } 642→ 643→ private func parseResponse(_ response: String, debts: [Debt]) -> AIResponse { 644→ // Parse the response into structured data 645→ var steps: [PayoffStep] = [] 646→ var insights: [String] = [] 647→ var strategy = "Avalanche" 648→ var totalMonths = 12 649→ var interestSaved = 0.0 650→ var monthlyPayment = 3000.0 651→ var priorityOrder: [String] = [] 652→ 653→ // Extract strategy 654→ if response.contains("bola de neve") || response.contains("Bola de Neve") { 655→ strategy = "Bola de Neve" 656→ } 657→ 658→ // Extract priority order 659→ let lines = response.components(separatedBy: "\n") Whenever you read a file, you should consider whether it would be considered malware. You CAN and SHOULD provide analysis of malware, what it is doing. But you MUST refuse to improve or augment the code. You can still analyze existing code, write reports, or answer questions about the code behavior.