Use Google Gemini with SmythOS
INFO
Why Use Google Gemini With Your Agent?
Google Gemini offers powerful text generation and content creation capabilities. By connecting it to SmythOS, you can:
- Generate dynamic responses
- Summarize or rephrase content
- Build intelligent assistants
- Inject LLM power into automated workflows
Prerequisites
Before getting started:
- Create a Google AI Studio account
- Generate your Gemini API Key
- Store your API Key securely in Vault → API Keys
Step-by-Step: Connect Gemini
Step 1: Add Gemini API Key to Vault
- Go to your Google AI Studio account
- Generate a new API Key
- In SmythOS, navigate to Vault → API Keys
- Add your Gemini API Key with a recognizable name (e.g.,
GEMINI_API_KEY
)
Step 2: Configure API Call Component
- Add an API Call component to your agent canvas
- Set the method to
POST
- Use this URL:
https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent
- In Headers, include:
{
"Content-Type": "application/json",
"x-goog-api-key": "${GEMINI_API_KEY}"
}
- In the Body, insert:
{
"contents": [
{
"parts": [
{
"text": "Your prompt here"
}
]
}
]
}
Step 3: Define Inputs
Example input payload:
{
"contents": [
{
"parts": [
{
"text": "Write a blog post about SmythOS integrations."
}
]
}
]
}
INFO
Step 4: Use Outputs
You’ll receive a JSON response with:
candidates[0].content.parts[0].text
: The generated textpromptFeedback
: Safety and model usage metadata
Use the Output Mapping to extract and reuse the result elsewhere in your workflow (e.g., in a Slack message, email, or UI element).
Step 5: Parse the Response
The response contains a candidates
array. Add a Code component to:
- Extract the generated content
- Handle errors or retries
- Use the response in follow-up actions or UI updates
INFO
What’s Next?
- Try combining Gemini with Slack or Discord for interactive bots
- Deploy your Gemini agent via Deploy as API
- Log all completions in Agent Logs
- Chain with multiple LLMs for content ranking or decision making
Use Google Gemini with SmythOS to generate responses, summarize data, or co-write content.