Due Date: Thursday, October 2nd at 10:00 am

Expected time: Less than an hour

Background: In this prep, you will complete the necessary steps to connect to and use the Gemini LLM API by setting up a Google Cloud project and redeeming cloud credits.

Purpose: The purpose of this prep is to get you prepared for Assignment 3, which will involve you using an LLM API for integrating AI agumentation into your personal project.

Your tasks

Please go through the following steps to redeem your cloud credits, set up a Google Cloud project and API key, and make sure that the Gemini LLM using your API key works.

Activating and Redeeming Your Google Credits

  1. Check your email from us via Canvas with a link to the credit redemption webpage.
  2. Enter your Kerberos ID in the “School Email” field before the @mit.edu dropdown. Click Submit.
  3. Check your MIT email for a message titled “Your Google Cloud Education Credits Request” and click the link inside. Note: the opened webpage may say something like “this email has already been verified” — that’s fine.
  4. After confirming your request, you should get another email titled “Your Google Cloud Education Credit Coupon.” This email includes both your coupon code and a link to redeem it.
    1. Open the redemption link.
    2. Choose whichever personal Google account you want to use with Google Cloud. Do not use your MIT Google account.
    3. Copy‑paste the coupon code from the email and click Submit at the bottom of the page — this should apply the credits!

Creating a Google Cloud Project and API Key

Once you have redeemed your credits, you need a Google Cloud project and API key to associate with the credits. This way, when you make requests to the Gemini API with your key, the correct project and credits are billed.

Make an API key

  1. Go to Google AI Studio.
  2. Sign in with the same personal Google account you applied the credits to.
  3. Click Create API Key.
    1. You may be prompted to create or select a project that the API key is associated with — if so, name a project and the key.

      Here, you’re creating a key, my-key, that is part of the gemini-test project.

    2. Select a project from the dropdown or click Create project if you have no projects.
    3. Click Create key.
    4. Once the key is created, click the key details (the hyperlink comprised of random characters above your key’s name).
    5. Copy your API key from the API key details pop-up.

      You should see something like this — in this case, the project is named gemini-test.

Ensure your API key is connected to the Google Cloud credits you just redeemed.

  1. Next to your API key, click Set up billing.

  2. Click Link a billing account.

  3. Select Billing Account for Education from the billing account dropdown.
  4. You should now see the Google Cloud dashboard — you can confirm your billing account is set up by clicking Credits in the left-side ribbon.

  5. You should see a credit named Software Design worth $50, like this:

Testing Your Google Cloud API Key with Gemini

With billing and your API key set up, use the steps below to confirm the Gemini API works in your project.

1) Clone the test repository

git clone https://github.com/61040-fa25/intro-gemini-schedule
cd intro-gemini-schedule

2) Install dependencies

npm install

3) Add your API key 1. Create a file named config.json. It is .gitignore-d so your key won’t be pushed to GitHub. It must be named config.json or the key could be committed and the code won’t work. 2. Copy the structure from config.json.template and paste it into config.json: { "apiKey": "YOUR_GEMINI_API_KEY_HERE" } 3. Replace "YOUR_GEMINI_API_KEY_HERE" with your actual key from the previous section.

4) Run the project

npm start

5) Verify the result

  • Good response: You should see generated text.

  • Bad response: The call fails (e.g., wrong key or network issue).

Submission

No submission for this assignment.

Resources and Advice

Check out the class resources page for more links related to setting up Google Cloud platform and using the Gemini API.