Ai Coding Tools

How to Build Your First AI-Enhanced App in 2 Hours

By BTW Team4 min read

Comparing tools? See the AI tools tested on the show.

In short

A step-by-step guide to leveraging AI coding tools to create a simple yet functional application within just two hours.

If you're anything like me, the idea of building an AI-enhanced app can feel a bit daunting. With so many tools and frameworks out there, it’s easy to feel overwhelmed and think that you need a PhD in machine learning to get started. But here's the good news: you don't! In fact, I’ve found that you can build a functional AI app in just two hours. Let's break down exactly how you can do this using accessible AI coding tools.

Prerequisites: What You Need to Get Started

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

  1. A Code Editor: I recommend Visual Studio Code (free).
  2. Node.js: Download it from nodejs.org.
  3. Basic JavaScript Knowledge: Familiarity with JavaScript will help, but I’ll guide you through the key parts.
  4. An OpenAI API Key: Sign up at OpenAI to get your API key for AI functionalities.

Step 1: Choose Your AI Tool

Here’s a list of AI tools you can use to enhance your app, along with their pricing and specifics:

| Tool Name | What It Does | Pricing | Best For | Limitations | Our Take | |-------------------|-----------------------------------------------|-----------------------------------|------------------------------|-------------------------------------|-------------------------------| | OpenAI GPT-3 | Natural language processing and generation | Free tier + $0.0004 per token | Chatbots, content generation | Token costs can add up quickly | We use this for generating text | | Hugging Face | Pre-trained models for various ML tasks | Free tier + $9/mo for Pro | NLP tasks, image analysis | Some models require fine-tuning | We use this for NLP tasks | | TensorFlow.js | Run ML models directly in the browser | Free | Browser-based AI applications | Steeper learning curve | We don’t use this due to complexity | | Dialogflow | Build conversational interfaces | Free tier + $20/mo for Essentials | Chatbots | Limited to Google ecosystem | We use this for chatbots | | RunwayML | Creative AI tools for video and images | Free tier + $12/mo for Pro | Creative projects | More suited for artistic applications | We don’t use this, not our focus | | Microsoft Azure AI| Comprehensive AI services | Free tier + $3 for 1,000 transactions | Enterprise-level solutions | Can be expensive for small projects | We don’t use this due to costs |

Step 2: Set Up Your Project

  1. Create a New Directory: Open your terminal and run:

    mkdir my-ai-app
    cd my-ai-app
    
  2. Initialize a New Node.js Project:

    npm init -y
    
  3. Install Required Packages: For this example, we’ll use OpenAI’s API:

    npm install axios dotenv
    
  4. Create a .env File: Store your API key securely.

    OPENAI_API_KEY=your_api_key_here
    

Step 3: Write Your Code

Here’s a simple example of how to call the OpenAI API:

require('dotenv').config();
const axios = require('axios');

const getAIResponse = async (prompt) => {
    const response = await axios.post('https://api.openai.com/v1/engines/davinci/completions', {
        prompt: prompt,
        max_tokens: 150
    }, {
        headers: {
            'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`
        }
    });
    return response.data.choices[0].text;
};

getAIResponse("What's the weather like today?")
    .then(console.log)
    .catch(console.error);

Step 4: Run Your App

  1. Start Your App:

    node index.js
    
  2. Expected Output: You should see a response from the OpenAI API based on your prompt.

Troubleshooting: What Could Go Wrong

  • API Key Issues: Make sure your API key is correct and has access to the API.
  • Network Errors: Ensure you have an internet connection.
  • Code Errors: Check for typos in your code. Use a linter to catch common mistakes.

What’s Next?

Once you have your basic AI app running, consider adding features like user input, a frontend interface, or integrating with other APIs for richer functionality. You could also explore more complex AI models or even deploy your app using platforms like Heroku or Vercel.

Conclusion: Start Here

Building your first AI-enhanced app doesn’t have to be complicated. With the right tools and a clear plan, you can get something functional up and running in about two hours. If you're ready to dive into AI coding, start with OpenAI or Hugging Face as they offer user-friendly options for beginners.

Watch real AI builds every week

Built This Week is a weekly podcast where Jordan Metzner and Sam Nadler build something real with AI every episode, test new AI tools and talk with founders who build with AI.

See the tools

Watch real AI builds every week

Built This Week is a weekly podcast where Jordan Metzner and Sam Nadler build something real with AI every episode, test new AI tools and talk with founders who build with AI.

See the tools
Ai Coding Tools

3 AI Coding Tools That Are Overrated (and Why You Should Avoid Them)

3 AI Coding Tools That Are Overrated (and Why You Should Avoid Them) In the everevolving landscape of AI coding tools, it's easy to get swept up in the hype. As indie hackers and s

Nov 30, 20263 min read
Ai Coding Tools

5 Ways AI Coding Tools Can Accelerate Your MVP Development in 2026

5 Ways AI Coding Tools Can Accelerate Your MVP Development in 2026 In 2026, the landscape for indie hackers and solo founders has evolved significantly, especially with the advent

Nov 26, 20264 min read
Ai Coding Tools

5 AI Coding Tools That Make Legacy Code Feel Brand New in 2026

5 AI Coding Tools That Make Legacy Code Feel Brand New in 2026 If you’re a developer stuck maintaining legacy code, you know the frustration. It’s like navigating a maze blindfolde

Nov 23, 20264 min read
Ai Coding Tools

10 AI Coding Tools That Will Save You Hours of Debugging in 2026

10 AI Coding Tools That Will Save You Hours of Debugging in 2026 Debugging can feel like a neverending cycle of frustration. Whether you're a solo founder or an indie hacker, spend

Nov 18, 20265 min read
Ai Coding Tools

10 Common Mistakes When Using AI Coding Tools for MVP Development

10 Common Mistakes When Using AI Coding Tools for MVP Development As a founder in 2026, you’re likely aware that AI coding tools can significantly speed up the MVP development proc

Nov 16, 20264 min read
Ai Coding Tools

5 AI Coding Myths Every Beginner Developer Should Ditch in 2026

5 AI Coding Myths Every Beginner Developer Should Ditch in 2026 As a beginner developer, you’ve probably come across a ton of buzz surrounding AI coding tools. But with all the hyp

Nov 12, 20263 min read