Connect with us

Artificial Intelligence

How to Get Bard API Key and MakerSuite Access

Learn how to generate a Bard API key for free on MakerSuite after getting past the waitlist to create generative AI applications with PaLM 2.

Published

on

Developing AI chatbots in Python or JavaScript is easy when using modules and libraries that help you connect with robust large language models (LLMs) managed by well-established entities such as OpenAI or Google. GPT-4, the current model of the revolutionary service known as ChatGPT, is a highly sought-after solution for developers and business owners looking to employ the power of Generative Artificial Intelligence to improve and scale their interactions with users through intelligent chatbots. However, Google remains a fierce competitor in this domain with its own AI chatbot, Bard.

Early in 2023, when Bard AI was introduced, Google underlined its intention of transforming it to become the principal nexus between global knowledge and the rich duo of intelligence and creativity. The expectation was to obtain a system that could ingest the bulk of the information on the web and, through extensive training, generate up-to-date, high-quality responses to virtually any query for users of any demographic.

Powered by Google’s next-generation PaLM 2 model, the Bard AI chatbot can perform advanced reasoning and multilingual translation and generate code in several programming languages. PaLM 2, which stands for Pathways Language Model 2, is a large language model boasting over 500 billion parameters that power the Bard AI chatbot.

To allow for rapid prototyping and sharing of generative AI ideas, developers can register on Google’s MakerSuite. This platform lets them explore the prompt gallery to better work on prompt design or prompt engineering. Yet, for those who prefer to code AI applications from scratch, one of the main benefits of using MakerSuite is creating and managing API keys, specifically Bard API keys.

How to join the Bard API / MakerSuite waitlist

Go to the MakerSuite homepage. You will be prompted to log into your Google account to authenticate yourself if you do not have access to the platform yet. Upon logging in, you may see a page encouraging you to join the PaLM API and MakerSuite waitlist. The PaLM API is the Bard API; the two terms may be used interchangeably as the API opens the door to Bard AI’s underlying technology (PaLM 2). The roadmap for the Bard API rollout reveals that Google has opted for a progressive release, hence the waitlist.

Waitlist application on MakerSuite for access to the Bard API.
Screenshot of the application form to access the Bard API on MakerSuite.

Select your country or region. You may select any country, including China, where Google services are largely unavailable.

Specify your profession. You may choose from any of the following:

  • Academic
  • Creative
  • Data Scientist
  • Engineer
  • Journalist
  • Product Manager
  • Student
  • Other

State your intended use of the Bard API. This section must make it clear to the reviewers why you want to use the Bard API and MakerSuite. The options for intents include the following:

  • Academic research
  • Create something new
  • Incorporate LLMs into existing work
  • Learn about Google’s LLM offerings
  • Understand general LLM capabilities
  • Other

Note: The review of waitlist applications is relatively flexible, so be honest about what you intend to use Bard API for. You may select more than one option depending on your plans.

Once you finish your Bard API waitlist application, click on the ‘Join with my Google account’ button. If your request is successful, an email from the PaLM API and MakerSuite Team will be sent to the (Google) email account you registered with, welcoming you to the platform to start prototyping.

Screenshot of the MakerSuite homepage after logging in with access.

From there, go to MakerSuite and click on the ‘Create an API key’ button under the section headlined ‘Start developing.’ For every Bard API key you create on MakerSuite, you can associate it with a new Google Cloud project or an existing one. Select the new project option for a fresh start, then generate your key. It will be listed in a table displaying your tokens, Google Cloud project names, API key creation date, and an option to delete the keys you no longer wish to use. Remember that API keys must be treated as high-level security information, as anyone with access to them may engage in unwanted activity within your cloud project or incur hefty costs under your name through heavy usage.

Screenshot of the MakerSuite page where users can create Bard API keys.

Copy the key you generated to call the Bard API directly from your code. In most Bard AI tutorials on this website, we interact with Google Generative AI’s Python client library. Nonetheless, a faster way of testing your Bard API key is by running a cURL command. If you do not already have the cURL utility tool installed on your computer, install the correct version for your operating system. Once done, open up your notepad application (or any raw text application) and edit the cURL command below to replace the value “YOUR_API_KEY" with your generated key.

curl \
-H 'Content-Type: application/json' \
-d '{ "prompt": { "text": "Give me a synonym of intelligence."} }' \
"https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key=YOUR_API_KEY"

For beginners, here is a brief explanation of the line-separated command above.

curl is the name of the cURL command.

-H 'Content-Type: application/json' specifies that the request body is JSON.

-d '{ "prompt": { "text": "Give me a synonym of intelligence."} }' is the request body, a JSON object with a single property called prompt. The prompt property has a string value, which is the prompt you want the API to generate text for.

"https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key=YOUR_API_KEY" is the URL of the API endpoint. The ‘key’ parameter is your API key, a unique identifier you use to authenticate your requests to the API.

Now, paste the modified cURL command in your terminal and hit Enter.

You may get a JSON response similar to the snippet below. While we will not dive into what each field represents and how to understand the values returned by the Bard API, it is worth noting that the part of it we are interested in is the value of the "output" field. In the test we ran, the value returned was “acumen,” which is indeed a synonym of the word intelligence.

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   792    0   731  100    61    382     31  0:00:01  0:00:01 --:--:--   414{
  "candidates": [
    {
      "output": "acumen",
      "safetyRatings": [
        {
          "category": "HARM_CATEGORY_DEROGATORY",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_TOXICITY",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_VIOLENCE",
          "probability": "LOW"
        },
        {
          "category": "HARM_CATEGORY_SEXUAL",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_MEDICAL",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_DANGEROUS",
          "probability": "NEGLIGIBLE"
        }
      ]
    }
  ]
}

If you got a similar result, your Bard API key is active, and you can interact with the service as expected. As you can see, the steps to get a Bard API key for free on MakerSuite by joining the waitlist are minimal and easy to go through. In future Bard AI tutorials, we will learn how to understand JSON responses better and extract specific values to build advanced Python applications powered by Google’s Generative AI client library.

Click to comment

Leave a Reply

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

Trending

Exit mobile version