Build Your First Personal AI Assistant with JavaScript in 5 Minutes (For Free 🤯) – Start The Timer!

🚀 The Whole AI Hype: Why JS Devs Should Care

Since ChatGPT was released in late 2022, the AI space has been growing at a super impressive speed. Companies are raising hundreds of millions of dollars, state-of-the-art AI models are being rele…


This content originally appeared on DEV Community and was authored by Dean

🚀 The Whole AI Hype: Why JS Devs Should Care

Since ChatGPT was released in late 2022, the AI space has been growing at a super impressive speed. Companies are raising hundreds of millions of dollars, state-of-the-art AI models are being released literally every day, and mindblowing products are being introduced daily.

While Python has been the primary language of the AI revolution, JavaScript developers can also benefit significantly from this industry growth. Why? Many startups are now prepared to bring their AI research to production, and what better way to ship products faster than by using the language of the web: JavaScript!

Don't believe me? You can do a quick search for the rise in product engineering job roles over the past year. So if you're new to building AI powered apps, let's get started.

Starting the timer

⏱️ Let’s Start the Timer: Setting Up Your Dev Environment

Here’s what you need:

  • Node.js (v18+ recommended)

  • A code editor (VS Code, WebStorm, or whatever you love)

  • npm (comes with Node)

  • An API key (but stay tuned for a free hack!)

Install the OpenAI SDK:
npm install openai

💸 Wait, Isn’t This Supposed to Be Free?

I know I said you can build this for free, but the official OpenAI API key costs money to get started. Stay with me, and I'll reveal a cool, legit open secret on how you can use hundreds of AI models for free, including some that rival OpenAI models in terms of performance.

Okay, time is running out, let's build our personal research assistant with inbuilt search support!

Your Personal AI Assistant with JavaScript

import OpenAI from "openai";
const client = new OpenAI();

const completion = await client.chat.completions.create({
    model: "gpt-4o-search-preview",
    web_search_options: {},
    messages: [{
        "role": "user",
        "content": "Give me a quick summary of a trending good news story"
    }],
});

console.log(completion.choices[0].message.content);

You should get a response like below after running node index.js:

In April 2025, researchers in Miami, Florida, developed BIOCAP tiles—a 3D-printed modular system designed to support marine life and reduce wave impact along urban seawalls. These tiles are set to be installed at Morningside Park, aiming to protect marine ecosystems from coastal erosion.

Voila! Now you have your own personal AI assistant that you can use for coding, research, and much more. You can also create a frontend React app that queries this setup as an API route or even entirely within your frontend app.

Give It Wings — The Free Model Hack

Here’s the hack: OpenRouter. It’s a unified API gateway that lets you access hundreds of AI models (including many for free) using the same OpenAI-compatible sdk we installed. You just swap the base URL and use their free models, which you can see here.

For this tutorial, we will use the latest Llama-4 Maverick model from Meta. Here's the full code:

import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: "https://openrouter.ai/api/v1",
  apiKey: "<OPENROUTER_API_KEY>"
});

async function main() {
  const completion = await openai.chat.completions.create({
    model: "meta-llama/llama-4-maverick:free",
    messages: [
      {
        role: "user",
        content: "Give me a quick summary of a trending good news story"
      }
    ],
  });

  console.log(completion.choices[0].message.content);
}

main();

You should also get an almost similar result when you run the code.

Here's a trending good news story:
Global Efforts to Protect Endangered Sea Turtles Paying Off
Conservation efforts to protect endangered sea turtles are showing significant results worldwide. Thanks to the collaborative efforts of governments, NGOs, and local communities, many sea turtle species are experiencing a notable increase in population.

One notable example is the Kemp's ridley sea turtle, which was on the brink of extinction in the 1980s with only around 400 nesting females. Conservation efforts, including the establishment of protected nesting sites and reduction of bycatch in fishing gear, have led to a remarkable recovery. In 2020, the number of Kemp's ridley nesting females reached a record high of over 22,000.

Similarly, conservation efforts in the Great Barrier Reef have led to a significant increase in the population of green turtles. The number of nesting turtles has risen by over 50% since 2000, thanks to efforts to reduce pollution, protect nesting sites, and promote sustainable fishing practices.

That’s it. You’re now running a personal AI assistant at no cost.

✨ Final Thoughts

With tools like OpenRouter, you don’t need a fat wallet to build something amazing.

If you build something cool or have any questions, please leave a comment and tag me. I would love to help in any way! If you found this article useful, add a reaction and share it with your peers.

Support Me ❤️❤️

I'm building an SDK called Docuglean that helps you process and extract key information from all types of documents efficiently using AI models.

Please give the project a ⭐ on GitHub, and I would be super happy :)

Give Docuglean a 🌟 on GitHub.


This content originally appeared on DEV Community and was authored by Dean


Print Share Comment Cite Upload Translate Updates
APA

Dean | Sciencx (2025-06-17T17:15:42+00:00) Build Your First Personal AI Assistant with JavaScript in 5 Minutes (For Free 🤯) – Start The Timer!. Retrieved from https://www.scien.cx/2025/06/17/build-your-first-personal-ai-assistant-with-javascript-in-5-minutes-for-free-%f0%9f%a4%af-start-the-timer/

MLA
" » Build Your First Personal AI Assistant with JavaScript in 5 Minutes (For Free 🤯) – Start The Timer!." Dean | Sciencx - Tuesday June 17, 2025, https://www.scien.cx/2025/06/17/build-your-first-personal-ai-assistant-with-javascript-in-5-minutes-for-free-%f0%9f%a4%af-start-the-timer/
HARVARD
Dean | Sciencx Tuesday June 17, 2025 » Build Your First Personal AI Assistant with JavaScript in 5 Minutes (For Free 🤯) – Start The Timer!., viewed ,<https://www.scien.cx/2025/06/17/build-your-first-personal-ai-assistant-with-javascript-in-5-minutes-for-free-%f0%9f%a4%af-start-the-timer/>
VANCOUVER
Dean | Sciencx - » Build Your First Personal AI Assistant with JavaScript in 5 Minutes (For Free 🤯) – Start The Timer!. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/06/17/build-your-first-personal-ai-assistant-with-javascript-in-5-minutes-for-free-%f0%9f%a4%af-start-the-timer/
CHICAGO
" » Build Your First Personal AI Assistant with JavaScript in 5 Minutes (For Free 🤯) – Start The Timer!." Dean | Sciencx - Accessed . https://www.scien.cx/2025/06/17/build-your-first-personal-ai-assistant-with-javascript-in-5-minutes-for-free-%f0%9f%a4%af-start-the-timer/
IEEE
" » Build Your First Personal AI Assistant with JavaScript in 5 Minutes (For Free 🤯) – Start The Timer!." Dean | Sciencx [Online]. Available: https://www.scien.cx/2025/06/17/build-your-first-personal-ai-assistant-with-javascript-in-5-minutes-for-free-%f0%9f%a4%af-start-the-timer/. [Accessed: ]
rf:citation
» Build Your First Personal AI Assistant with JavaScript in 5 Minutes (For Free 🤯) – Start The Timer! | Dean | Sciencx | https://www.scien.cx/2025/06/17/build-your-first-personal-ai-assistant-with-javascript-in-5-minutes-for-free-%f0%9f%a4%af-start-the-timer/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.