<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[GDG Canberra - Medium]]></title>
        <description><![CDATA[GDG Canberra is a vibrant community of tech enthusiasts and developers based in the heart of Australia’s capital city. We come together to explore the latest in Google technologies, exchange ideas, and collaborate on exciting projects. - Medium]]></description>
        <link>https://medium.com/google-developer-group-canberra?source=rss----8b734a9f10ce---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>GDG Canberra - Medium</title>
            <link>https://medium.com/google-developer-group-canberra?source=rss----8b734a9f10ce---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 03:57:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/google-developer-group-canberra" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Add Gemini to your next web project]]></title>
            <link>https://medium.com/google-developer-group-canberra/add-gemini-to-your-next-web-project-a53fe4679951?source=rss----8b734a9f10ce---4</link>
            <guid isPermaLink="false">https://medium.com/p/a53fe4679951</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gemini]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Nandun Bandara]]></dc:creator>
            <pubDate>Fri, 22 Nov 2024 13:30:14 GMT</pubDate>
            <atom:updated>2024-11-23T01:03:54.946Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DSSZzkPSMyaXjPKH2UR03g.png" /></figure><h3>Add Gemini to your Node.js Project</h3><h4>Been thinking of adding AI to your projects? Did you know it is as easy as 3 simple steps to add Gemini to a Node.js project?</h4><p>I’ll show you how to easily integrate Google’s Gemini API into your Node.js environment. We’ll go through step by step, so whether you’re a beginner or just looking for a straightforward implementation, you should be able to follow along easily.</p><p><em>Get our Node.js (typescript) boilerplate </em><a href="https://github.com/gdgcanberra/typescript-node-starter"><em>here</em></a><em> to follow along with the article.</em></p><h3>Step 1: Set Up Google Cloud Platform (GCP)</h3><p>First things first, you are going to need a Google Cloud account to get started. Follow these steps to set it up and enable the Gemini API:</p><ol><li><strong>Create a Google Cloud Platform Account</strong><br>If you haven’t done so already, go to Google Cloud Console and sign up. If you are a new user, you may even get some free credits to use.</li><li><strong>Enable Gemini API</strong><br>Once you’re logged in, search for the Gemini API. Click on “Enable” to add it to your project.</li><li><strong>Get an API Key</strong><br>After enabling the API, you’ll need an API key to authenticate your requests. Go to the “Credentials” section under “APIs and Services”, create a new API key, and make sure to store it safely. You are going to need it to make API calls.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*qmLQCk3fhHDQESpkdv2Pcg.png" /><figcaption>(Step 2: Search for Gemini API)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xAlVW96roxgRVkxjS1rgPQ.png" /><figcaption>(Step 2: Enable Gemini API on your Google Cloud Platform account)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*Iyor_0bKSfiQLk19W1gyDg.png" /><figcaption>(Step 3: Create API key)</figcaption></figure><h3>Step 2: Install the SDK</h3><p>Next, let’s get the required software development kit (SDK) installed in your Node.js project. This SDK will allow you to easily communicate with the Gemini API from your code.</p><ul><li>Open the terminal, go to your project directory, and run the following command:</li></ul><p>npm install @google/generative-ai</p><p>This will install the Google Generative AI SDK that will help you call Gemini API within your project.</p><h3>Step 3: Make Your First API Call</h3><p>Now that everything is set up, let’s write some code to interact with the Gemini API.</p><ol><li><strong>Import the SDK</strong><br>In your JavaScript code, import the Google Generative AI module:</li></ol><pre>import { GoogleGenerativeAI } from &#39;@google/generative-ai&#39;;</pre><p><strong>2. Initialize the Client</strong><br>Use the API key you got earlier to create an instance of the GoogleGenerativeAI client:</p><pre>const genAI = new GoogleGenerativeAI(&#39;&lt;YOUR API KEY&gt;&#39;);</pre><p><strong>3. Make an API Request</strong><br>You can now make your first API request to generate content. Here’s a simple example to generate a basic text response:</p><pre>(async () =&gt; {<br>  const model = genAI.getGenerativeModel({ model: &#39;gemini-1.5-flash&#39; });<br>  const { response } = await model.generateContent(&#39;Hello, world&#39;);<br>  <br>  console.log(response.text());<br>})();</pre><p>This snippet uses the gemini-1.5-flash model to generate content based on the provided prompt. To add your own prompt, change the following line.</p><pre>const { response } = await model.generateContent(&#39;&lt;YOUR PROMPT HERE&gt;&#39;);</pre><h3>Next Steps</h3><p>The complete code is shared under the ‘getting-started’ directory in this respository: <a href="https://github.com/gdgcanberra/gemini">https://github.com/gdgcanberra/gemini</a></p><p>You can now start exploring how and what you can do with Gemini, trying out different capabilities and use cases. To help you get started, let me share some resources below.</p><ol><li><a href="https://ai.google.dev/gemini-api/docs">https://ai.google.dev/gemini-api/docs</a></li><li><a href="https://www.promptingguide.ai/">https://www.promptingguide.ai/</a></li></ol><p>And you call always ask Gemini! :D</p><h3>Troubleshooting Tips</h3><ul><li><strong>API Errors</strong>: Make sure that your API key is correct and has the required permissions to talk to the Gemini API.</li></ul><h3>Wrapping Up</h3><p>By following these steps, you should now have a Node.js project with an integration with the Google Gemini API. From here, you can explore all sorts of use cases — from content generation to conversational AI.</p><p>Feel free to drop a comment below if you have questions or run into issues. Happy coding!</p><p>If this guide was helpful, consider sharing it with your fellow developers in your community. 😊</p><p><em>Join Google Developer Group Canberra at </em><a href="https://gdg.community.dev/gdg-canberra/"><em>https://gdg.community.dev/gdg-canberra/</em></a><em> and follow our socials at @gdgcanberra</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=twitter&amp;url=https%3A//x.com/nandunbandaraa/status/1860078499467600190&amp;image=" width="500" height="281" frameborder="0" scrolling="no"><a href="https://medium.com/media/80d7dbf6b16f2b30cb97c25e4876ae10/href">https://medium.com/media/80d7dbf6b16f2b30cb97c25e4876ae10/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qMdCKQqyvytkrxkCkuZ2ng.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a53fe4679951" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-developer-group-canberra/add-gemini-to-your-next-web-project-a53fe4679951">Add Gemini to your next web project</a> was originally published in <a href="https://medium.com/google-developer-group-canberra">GDG Canberra</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>