Gemini
Overview
Google Gemini is a family of multimodal AI models that can be integrated into your Emergent applications for chat, content generation, vision tasks, and more. Emergent provides built-in support for Gemini models through the Universal LLM Key system, making it simple to add Google's latest AI capabilities to your app.
This guide walks you through setting up Gemini in your Emergent project and making your first API call.
Prerequisites
Before you begin, you'll need:
- An active Emergent project
Note
Gemini access is Emergent-managed, you do not need a Google Cloud account or a Gemini API key to get started. Bringing your own key is optional.
You can use Gemini models in two ways:
- Automatically via the Universal LLM Key - Emergent provides access without requiring your own API key
- With your own API key - Connect your Google account for direct billing and usage tracking
Using Gemini with the Universal LLM Key
The simplest way to get started is using Emergent's Universal LLM Key, which provides immediate access to Gemini models without any configuration.
The Universal LLM Key is included with your Emergent account and supports multiple AI providers including Google. Your usage is metered as part of your Emergent subscription.
When you describe your app in chat, Emergent agents automatically use Gemini models (or other supported providers) through the Universal LLM Key. No additional setup is required - just start building.
Connecting Your Own Gemini API Key
The preferred approach is the Universal LLM Key. However, if you want to bring your own Gemini API key, you can provide your own key when Emergent asks for your Gemini credentials.
Visit Google AI Studio and sign in to your Google account. Create an API key and copy it.
Warning
Never commit your API key to version control or share it publicly. Treat it like a password.
Multimodal Capabilities
Gemini models support text, image, audio, and video inputs, making them ideal for applications that need to process multiple content types.
Example: Vision Task
(The agent writes and wires up this code for you.)
Troubleshooting
Warning
If you are using your own key and see authentication errors, verify that your
GOOGLE_API_KEY is correctly set and that the key has not been revoked or restricted in the Google Cloud Console.Common issues and solutions:
| Issue | Solution |
|---|---|
| "API key not valid" | Double-check that you copied the full key without extra spaces. Regenerate the key in Google AI Studio if needed. |
| "Model not found" | Ensure you're using a valid model identifier (e.g., ). Some models may require allowlist access. |
| Slow responses | Gemini Pro models may take longer for complex requests. Consider using Flash models for latency-sensitive applications. |
| CORS errors | Gemini API calls should be made server-side. If calling from the browser, proxy requests through your Emergent backend. |

