Google’s Gemini AI chat has rapidly become one of the most powerful tools in the artificial intelligence landscape. With its massive context window (up to 2 million tokens) and incredible speed, it rivals—and often beats—GPT-5.

But here is the problem: Google provides a great chat interface at gemini.google.com, but they don’t give you a simple “widget” to put on your own business website. If you want to use Gemini to answer customer support questions or capture leads on your site, you usually have to hire a developer.

Until now. In this guide, we will show you how to build a custom Gemini AI chat agent and embed it on your site in under 5 minutes using tochat.

Why Choose Gemini Over GPT-5?

Before we build, why should you use Google’s model?

  • Speed: The Gemini 2.5 Flash model is incredibly fast, making it perfect for real-time website interactions.
  • Cost (BYOK): Google offers a generous free tier for their API. By using a “Bring Your Own Key” platform like tochat, you can often run your agent for free.
  • Context: Gemini can “read” massive amounts of data. You can upload entire employee handbooks or huge PDF catalogs, and Gemini won’t forget the details.

Step 1: Get Your Free Gemini API Key

To run a Gemini AI chat on your site, you need an engine. That engine is the API Key.

Google makes this easy. You can generate a key in seconds via Google AI Studio. We have a full guide on how to do this here: How to Get Your Free Gemini API Key in 2 Minutes.

Step 2: Create Your Agent in tochat

Once you have your key, you need a wrapper—something that turns raw code into a beautiful chat bubble.

  1. Log in to your tochat Dashboard.
  2. Click “+ Agent”.
  3. In the General Tab, paste your Gemini API Key.
  4. Use the Persona Builder to give your agent a role (e.g., “You are a helpful support rep for my shoe store”).

Step 3: Train It on Your Data (RAG)

A generic Gemini AI chat is cool, but a custom one is profitable. You need to teach it about your business.

Go to the Source Tab in tochat. Here you can:

  • Upload PDF guides (Pricing, Returns Policy).
  • Paste your website URL (to scrape your About page).
  • Add specific Q&A pairs (e.g., “What is the WiFi password?”).

tochat uses RAG (Retrieval-Augmented Generation) to feed this data to Gemini instantly when a user asks a question.

Step 4: Embed on Your Site

Now, let’s go live.

  1. Go to the Embed Tab in your agent settings.
  2. Copy the single line of JavaScript code provided.
  3. Paste it into the <body> of your website (works on WordPress, Shopify, Wix, and custom HTML).

Conclusion

Adding a Gemini AI chat to your website doesn’t require a computer science degree. With tochat, you get the power of Google’s smartest model, customized with your data, running 24/7 to help your customers.

Ready to build? Start creating your agent for free today.