Ai Coding Tools

How to Build a Personal AI Assistant in 2 Hours with Cursor

By BTW Team4 min read

How to Build a Personal AI Assistant in 2 Hours with Cursor

If you're like me, the idea of having a personal AI assistant sounds pretty appealing. But the thought of coding one from scratch? That can feel overwhelming. Luckily, with tools like Cursor, you can build your own AI assistant in just 2 hours. This isn’t some pie-in-the-sky promise; I’ve done it myself, and I’m here to share exactly how you can do it too.

Prerequisites: What You Need to Get Started

Before we dive in, here’s what you’ll need:

  • Cursor: A code editor that uses AI to assist you in writing code. It’s free to start with some features, and paid plans begin at $20/month.
  • Basic Understanding of JavaScript: If you can write simple functions and understand variables, you’re good to go.
  • An OpenAI API Key: This is necessary to access the GPT models that will power your assistant. OpenAI's API pricing starts at $0.0004 per token, which is quite affordable for small projects.

Step-by-Step Guide to Building Your AI Assistant

Step 1: Set Up Cursor

  1. Download and Install Cursor: Go to the Cursor website and download the app. It should take just a few minutes.
  2. Create a New Project: Open Cursor, and start a new project. Name it something like "My Personal AI Assistant."

Step 2: Create the Assistant Logic

  1. Define Your Assistant’s Purpose: Decide what you want your AI assistant to do. Examples could be answering questions, setting reminders, or fetching data from APIs.

  2. Write the Main Function: Here’s a simple function to get you started:

    async function getResponse(input) {
        const response = await fetch('https://api.openai.com/v1/engines/davinci-codex/completions', {
            method: 'POST',
            headers: {
                'Authorization': `Bearer YOUR_API_KEY`,
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                prompt: input,
                max_tokens: 50
            })
        });
        return await response.json();
    }
    
  3. Test Your Function: In Cursor, run the function with a test input like "What’s the weather today?"

Step 3: Build a User Interface (Optional)

If you want to make your assistant more user-friendly, you can set up a simple HTML interface.

  1. Create an HTML File: Add an input box and a button to send messages to your assistant.
  2. Link Your JavaScript: Ensure your JavaScript file is linked to your HTML so that everything works together.

Step 4: Testing and Debugging

Run your assistant through various scenarios to see how it handles different inputs. If you encounter issues, check the console in Cursor for error messages.

Step 5: Deploy Your Assistant

Once you're satisfied with your assistant, you can deploy it using services like Vercel or Netlify, both of which have free tiers suitable for indie projects.

Troubleshooting Common Issues

  • API Key Errors: Ensure your OpenAI API key is correctly set up and has the right permissions.
  • Fetch Errors: Check your internet connection and ensure the API endpoint is correct.
  • Unexpected Responses: Refine your prompts to get better outputs from the AI.

Pricing Breakdown for Tools Used

| Tool | Pricing | Best For | Limitations | Our Take | |---------------|----------------------------|----------------------------|-------------------------------------|-----------------------------------| | Cursor | Free + $20/mo for pro | AI coding assistance | Limited features on the free plan | We use this for quick coding tasks | | OpenAI API | Starts at $0.0004 per token| Access to GPT models | Costs can add up with heavy use | Essential for AI functionality | | Vercel | Free tier available | Deploying web apps | Limited bandwidth on free tier | Great for indie projects |

What We Actually Use

For building our personal AI assistants, we primarily use Cursor for coding and OpenAI's API for the backend processing. If you want a more robust setup, consider adding Vercel for deployment.

Conclusion: Start Here

Building a personal AI assistant can be straightforward if you use the right tools. Start with Cursor and follow the steps I laid out. You can have a functional assistant up and running in just 2 hours. Don't let the complexities of coding scare you. With the right resources, you can do it!

Follow Our Building Journey

Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.

Subscribe

Never miss an episode

Subscribe to Built This Week for weekly insights on AI tools, product building, and startup lessons from Ryz Labs.

Subscribe
Ai Coding Tools

How to Write Clean Code Using AI Tools in 30 Minutes

How to Write Clean Code Using AI Tools in 30 Minutes As a solo developer or indie hacker, you know that writing clean code is crucial for maintainability and scalability. Yet, with

Jun 4, 20264 min read
Ai Coding Tools

GitHub Copilot vs Codeium: Which is Better for Advanced Developers?

GitHub Copilot vs Codeium: Which is Better for Advanced Developers in 2026? As an advanced developer, you know the importance of optimizing your workflow. With AI tools like GitHub

Jun 4, 20263 min read
Ai Coding Tools

How to Write a Complete API with AI Coding Assistants in Just 2 Hours

How to Write a Complete API with AI Coding Assistants in Just 2 Hours Building an API can feel like a daunting task, especially if you’re a solo founder or indie hacker with limite

Jun 4, 20264 min read
Ai Coding Tools

Why GitHub Copilot Isn't the Ultimate AI Coding Tool: 5 Alternatives You Should Consider

Why GitHub Copilot Isn't the Ultimate AI Coding Tool: 5 Alternatives You Should Consider As a solo founder or indie hacker, you might think GitHub Copilot is the holy grail of AI c

Jun 4, 20264 min read
Ai Coding Tools

How to Integrate GitHub Copilot in Your Workflow: A Beginner's Guide

How to Integrate GitHub Copilot in Your Workflow: A Beginner's Guide Integrating AI into your coding workflow can feel like a daunting task, especially for indie hackers and side p

Jun 4, 20263 min read
Ai Coding Tools

Why Many Developers Overrate AI Coding Assistants

Why Many Developers Overrate AI Coding Assistants As a solo founder or indie hacker, the promise of AI coding assistants can be alluring. After all, who wouldn't want a tool that c

Jun 4, 20264 min read