415→ let category: String 416→ let currentLimit: Double 417→ let suggestedLimit: Double 418→ let reason: String 419→ } 420→ 421→ // MARK: - API Call with System Prompt 422→ private func callClaudeAPI(prompt: String, systemPrompt: String = "", maxTokens: Int = 4096) async throws -> String { 423→ guard let url = URL(string: baseURL) else { 424→ throw AIError.invalidURL 425→ } 426→ 427→ var request = URLRequest(url: url) 428→ request.httpMethod = "POST" 429→ request.setValue("application/json", forHTTPHeaderField: "Content-Type") 430→ request.setValue(apiKey, forHTTPHeaderField: "x-api-key") 431→ request.setValue("2023-06-01", forHTTPHeaderField: "anthropic-version") 432→ 433→ var body: [String: Any] = [ 434→ "model": "claude-3-haiku-20240307", 435→ "max_tokens": maxTokens, 436→ "messages": [ 437→ ["role": "user", "content": prompt] 438→ ] 439→ ] 440→ 441→ if !systemPrompt.isEmpty { 442→ body["system"] = systemPrompt 443→ } 444→ 445→ request.httpBody = try JSONSerialization.data(withJSONObject: body) 446→ 447→ let (data, response) = try await URLSession.shared.data(for: request) 448→ 449→ guard let httpResponse = response as? HTTPURLResponse else { 450→ throw AIError.invalidResponse 451→ } 452→ 453→ if httpResponse.statusCode != 200 { 454→ if let errorJson = try? JSONSerialization.jsonObject(with: data) as? [String: Any], 455→ let errorMessage = errorJson["error"] as? [String: Any], 456→ let message = errorMessage["message"] as? String { 457→ throw AIError.apiError(message) 458→ } 459→ throw AIError.apiError("Status code: \(httpResponse.statusCode)") 460→ } 461→ 462→ guard let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any], 463→ let content = json["content"] as? [[String: Any]], 464→ let firstContent = content.first, 465→ let text = firstContent["text"] as? String else { 466→ throw AIError.parseError 467→ } 468→ 469→ return text 470→ } 471→ 472→ struct AIResponse { 473→ let plan: String 474→ let steps: [PayoffStep] 475→ let summary: PayoffSummary 476→ let insights: [String] 477→ let generatedAt: Date 478→ } 479→ 480→ struct PayoffStep: Identifiable { 481→ let id = UUID() 482→ let month: Int 483→ let action: String 484→ let debtName: String 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.