How to add Gemini AI to a Webflow site securely using Webflow Cloud
Blog post from Webflow
Integrating an AI feature like Gemini with Webflow involves challenges such as keeping the Gemini API key secure and managing CORS configurations, which are efficiently addressed by using Webflow Cloud as a solution. This approach allows for the Gemini proxy to run as a Next.js endpoint within the same domain, eliminating CORS issues and ensuring the API key remains server-side. The setup involves using the Webflow Cloud app to handle authentication, conversation history, and system prompts, while the Webflow page manages the user interface. There are three main methods to connect Gemini to Webflow: using Webflow Cloud for visitor-facing AI features, a Cloudflare Worker proxy for teams familiar with Cloudflare, and automation platforms like Zapier for event-driven workflows. The choice depends on whether real-time responses or event-driven workflows are needed. The guide provides a detailed walkthrough for the Webflow Cloud path, including obtaining necessary tools such as a Gemini API key, a Webflow site with Cloud access, a GitHub account for deployment, and Node.js. It highlights key steps like setting up the project, deploying the Cloud app, creating a Gemini proxy endpoint, and adding a chat interface to the Webflow page, ensuring multi-turn conversation context and secure API key management.