Basics
Quick Start

bard-ai Quick Start

Use this page to just get a glimpse of the power of bard-ai. Make sure you read through the next few pages for a more comprehensive tutorial.

Make sure you read through the Authentication page first, if you haven't already.

To get your first AI output from Bard, copy and paste the following code into your IDE of choice:

import Bard, { askAI } from "bard-ai";
 
await Bard.init(COOKIE_KEY);
 
console.log(await askAI("Hello world!"));

Let's walk through what this code is doing:

Imports

import Bard, { askAI } from "bard-ai";

We start by importing the overarching Bard Object from bard-ai, as well as the askAI sub-function alongside it. (We do this to avoid having to write the longer Bard.askAI(), but it also works)

Initialization

await Bard.init(COOKIE_KEY);

Next, we need to initialize bard-ai. Because this makes a web request and takes time, make sure to use await syntax. Be sure to use your own key here!

Ask Bard!

console.log(await askAI("Hello world!"));

Finally, we use the askAI function, with the first parameter of the query to ask Bard something. We log the output.

Congratulations! You've made your first request with Bard. Read on for more detailed documentation, including how to continue chats, export conversations, recieve image URLs from Bard, and more.