How to make AI-Powered Resume Cover Letter Customizer App

C# Tutorials
AI powered

Introduction

In today’s competitive job market,resume and cover letter for each job application is crucial—but manually editing them every time is tedious. What if AI could do it for you?

In this step-by-step guide, we’ll build a Resume & Cover Letter Customizer App using DeepSeek API  to automatically optimize resumes and generate personalized cover letters.

The Power of DeepSeek API

We’ll use DeepSeek’s AI (like ChatGPT but optimized for accuracy) to:

  • Analyze resumes and job descriptions.
  • Rewrite content using industry keywords.
  • Generate human-like cover letters.

*(If DeepSeek’s API is unavailable, replace with OpenAI GPT-4—code stays similar!)*

Before coding, ensure you have: DeepSeek API Key (Get it here)

Application Design

AI

There are four buttons: Load Resume, Load Job Description, Generate, and Save Output. The Load Resume button loads the resume into RichTextBox1, and the Load Job Description button is used to upload the job description into RichTextBox2. When the Generate button is clicked, it will generate a customized cover letter and resume, displaying them in RichTextBox3. The generated content can then be saved as a .txt file using the Save Output button.

Define API

C#
  private readonly string deepseekApiKey = "API";  // <-- Put your   API Key here

Code for Load Resume

C#
  private void BtnLoadResume_Click_1(object sender, EventArgs e)
  {
      OpenFileDialog ofd = new OpenFileDialog();
      if (ofd.ShowDialog() == DialogResult.OK)
      {
          txtResume.Text = File.ReadAllText(ofd.FileName);
      }
  }

Code for Load Job Description

C#
private void btnLoadJobDesc_Click(object sender, EventArgs e)
{
    OpenFileDialog ofd = new OpenFileDialog();
    if (ofd.ShowDialog() == DialogResult.OK)
    {
        txtJobDesc.Text = File.ReadAllText(ofd.FileName);
    }
}

Code for Generate Button

C#
 private async void btnGenerate_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(txtResume.Text) || string.IsNullOrWhiteSpace(txtJobDesc.Text))
     {
         MessageBox.Show("Please load both Resume and Job Description.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }

     string prompt = $"Given this Resume:\n{txtResume.Text}\n\nAnd this Job Description:\n{txtJobDesc.Text}\n\n" +
                    "Customize the Resume to better fit the Job Description and write a professional Cover Letter.";

     btnGenerate.Enabled = false;
     btnGenerate.Text = "Generating...";

     try
     {
         string result = await CallDeepSeekAPI(prompt);
         txtOutput.Text = result;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"API Error: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         btnGenerate.Enabled = true;
         btnGenerate.Text = "Generate Resume & Cover Letter";
     }
 }

Call Deepseek API

C#
 private async Task<string> CallDeepSeekAPI(string prompt)
 {
     using (HttpClient client = new HttpClient())
     {
         client.DefaultRequestHeaders.Add("Authorization", $"Bearer {deepseekApiKey}");

         var requestBody = new
         {
             model = "deepseek-chat", // Confirm model name in DeepSeek's docs
             messages = new[]
             {
                 new { role = "user", content = prompt }
             },
             temperature = 0.7,  // Optional: Controls creativity (0-2)
             max_tokens = 2000   // Optional: Limits response length
         };

         var content = new StringContent(
             JsonConvert.SerializeObject(requestBody),
             Encoding.UTF8,
             "application/json"
         );

         HttpResponseMessage response = await client.PostAsync(
             "https://api.deepseek.com/v1/chat/completions", // Check DeepSeek's actual API URL
             content
         );

         string responseString = await response.Content.ReadAsStringAsync();

         if (!response.IsSuccessStatusCode)
         {
             throw new Exception($"API Error: {response.StatusCode}\n{responseString}");
         }

         dynamic jsonResponse = JsonConvert.DeserializeObject(responseString);

         if (jsonResponse?.choices == null || jsonResponse.choices.Count == 0)
         {
             throw new Exception("No valid response from DeepSeek API.");
         }

         return jsonResponse.choices[0].message.content.ToString().Trim();
     }
 }

Code for Save Output button

C#
 private void btnSaveOutput_Click_1(object sender, EventArgs e)
 {
     SaveFileDialog sfd = new SaveFileDialog();
     sfd.Filter = "Text Files|*.txt";
     if (sfd.ShowDialog() == DialogResult.OK)
     {
         File.WriteAllText(sfd.FileName, txtOutput.Text);
         MessageBox.Show("File saved successfully.");
     }
 }

Source code

Click here to download source code.

Demonstration video

Discussion (0)

Share Your Thoughts

Your email address will not be published. Required fields are marked *