Google AI (Gemini + Imagen)
The Google plugin provides comprehensive AI capabilities using Google’s Gemini and Imagen models.
Features
Section titled “Features”| Feature | Provider | Description |
|---|---|---|
| Text Generation | Gemini | Generate text with structured JSON output support |
| Vision Analysis | Gemini | Analyze images and extract information |
| Image Editing | Gemini (Nano Banana) | Edit images using AI with natural language |
| Image Generation | Gemini / Imagen | Generate images from text prompts |
Installation
Section titled “Installation”pnpm add @teamflojo/floimg-googleAPI Key
Section titled “API Key”Get your API key from Google AI Studio.
export GOOGLE_AI_API_KEY=your-api-keyAll providers support per-request API keys via the apiKey parameter, allowing users to provide their own keys.
Gemini Text
Section titled “Gemini Text”Generate text using Gemini with optional structured JSON output.
Registration
Section titled “Registration”import createClient from '@teamflojo/floimg';import { geminiText } from '@teamflojo/floimg-google';
const floimg = createClient();floimg.registerTextProvider(geminiText());// Simple text generationconst result = await floimg.generateText({ provider: 'gemini-text', params: { prompt: 'Write 3 creative image prompts for a fantasy landscape', }});
console.log(result.content);Structured JSON Output
Section titled “Structured JSON Output”// Generate structured JSONconst result = await floimg.generateText({ provider: 'gemini-text', params: { prompt: 'Generate image prompts for a product photoshoot', outputFormat: 'json', jsonSchema: { type: 'object', properties: { prompts: { type: 'array', items: { type: 'string' } }, style: { type: 'string' }, mood: { type: 'string' } } } }});
console.log(result.parsed); // Typed JSON objectParameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text prompt for generation |
systemPrompt | string | No | System prompt to guide behavior |
context | string | No | Additional context (e.g., from vision analysis) |
outputFormat | 'text' | 'json' | No | Output format (default: 'text') |
jsonSchema | object | No | JSON schema for structured output |
temperature | number | No | Creativity (0-2, default: 0.7) |
maxTokens | number | No | Max response tokens (default: 1000) |
apiKey | string | No | Per-request API key override |
Gemini Vision
Section titled “Gemini Vision”Analyze images using Gemini’s multimodal capabilities.
Registration
Section titled “Registration”import createClient from '@teamflojo/floimg';import { geminiVision } from '@teamflojo/floimg-google';
const floimg = createClient();floimg.registerVisionProvider(geminiVision());// Analyze an imageconst result = await floimg.analyzeImage({ provider: 'gemini-vision', blob: imageBlob, params: { prompt: 'What objects are in this image? List them with confidence scores.', }});
console.log(result.content);Structured Output
Section titled “Structured Output”// Get structured analysisconst result = await floimg.analyzeImage({ provider: 'gemini-vision', blob: imageBlob, params: { prompt: 'Analyze this product image', outputFormat: 'json', jsonSchema: { type: 'object', properties: { objects: { type: 'array', items: { type: 'string' } }, colors: { type: 'array', items: { type: 'string' } }, mood: { type: 'string' }, suggestedTags: { type: 'array', items: { type: 'string' } } } } }});
console.log(result.parsed.suggestedTags);Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | No | What to analyze (default: “Describe this image”) |
outputFormat | 'text' | 'json' | No | Output format (default: 'text') |
jsonSchema | object | No | JSON schema for structured output |
maxTokens | number | No | Max response tokens (default: 1000) |
apiKey | string | No | Per-request API key override |
Gemini Edit (Nano Banana)
Section titled “Gemini Edit (Nano Banana)”Edit images using Gemini’s native image generation with natural language instructions.
Nano Banana is Google’s codename for Gemini’s image generation/editing capability.
Registration
Section titled “Registration”import createClient from '@teamflojo/floimg';import { geminiTransform } from '@teamflojo/floimg-google';
const floimg = createClient();floimg.registerTransformProvider(geminiTransform());// Edit an imageconst edited = await floimg.transform({ blob: inputImage, op: 'edit', provider: 'gemini-transform', params: { prompt: 'Make the sky more vibrant with dramatic sunset colors', }});
await floimg.save(edited, './edited-image.png');Pre-Prompt for Dynamic Workflows
Section titled “Pre-Prompt for Dynamic Workflows”When receiving prompts from upstream nodes (e.g., text generation), use prePrompt to add context:
const edited = await floimg.transform({ blob: inputImage, op: 'edit', provider: 'gemini-transform', params: { prompt: dynamicPromptFromTextNode, // e.g., "a magical forest" prePrompt: 'Edit this image by incorporating the following concept while preserving the original composition:', }});Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Edit instructions |
prePrompt | string | No | Instructions prepended to prompt (for dynamic workflows) |
model | string | No | Model (gemini-2.5-flash-image or gemini-3-pro-image-preview) |
aspectRatio | string | No | Output aspect ratio (see below) |
imageSize | string | No | Output resolution: 1K, 2K, or 4K (default: 1K) |
groundingWithSearch | boolean | No | Enable Google Search grounding for real-time data |
apiKey | string | No | Per-request API key override |
Aspect Ratios
Section titled “Aspect Ratios”Supported values: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
Image Sizes
Section titled “Image Sizes”| Size | Resolution | Use Case |
|---|---|---|
1K | ~1024px | Default, fast generation |
2K | ~2048px | Higher quality output |
4K | ~4096px | Print/archival quality |
Google Search Grounding
Section titled “Google Search Grounding”When enabled, the model can generate images based on real-time data:
const edited = await floimg.transform({ blob: inputImage, op: 'edit', provider: 'gemini-transform', params: { prompt: 'Add the current weather forecast for Tokyo as an overlay', groundingWithSearch: true, aspectRatio: '16:9', imageSize: '2K', }});Models
Section titled “Models”| Model | Description |
|---|---|
gemini-2.5-flash-image | Fast, high-volume (default) |
gemini-3-pro-image-preview | Higher quality, better text rendering |
Gemini Generate
Section titled “Gemini Generate”Generate images from text prompts using Gemini’s native image generation.
Registration
Section titled “Registration”import createClient from '@teamflojo/floimg';import { geminiGenerate } from '@teamflojo/floimg-google';
const floimg = createClient();floimg.registerGenerator(geminiGenerate());const image = await floimg.generate({ generator: 'gemini-generate', params: { prompt: 'A cozy coffee shop interior with warm lighting and plants', aspectRatio: '16:9', imageSize: '2K', }});
await floimg.save(image, './coffee-shop.png');Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Image description |
model | string | No | Model (default: gemini-2.5-flash-image) |
aspectRatio | string | No | Output aspect ratio (default: 1:1) |
imageSize | string | No | Output resolution: 1K, 2K, or 4K (default: 1K) |
groundingWithSearch | boolean | No | Enable Google Search grounding |
apiKey | string | No | Per-request API key override |
Aspect ratios, image sizes, and Google Search grounding work the same as in Gemini Edit.
Google Imagen
Section titled “Google Imagen”Generate images using Google’s Imagen model (separate from Gemini).
Registration
Section titled “Registration”import createClient from '@teamflojo/floimg';import googleImagen from '@teamflojo/floimg-google';
const floimg = createClient();floimg.registerGenerator(googleImagen());const image = await floimg.generate({ generator: 'google-imagen', params: { prompt: 'A photorealistic mountain lake at sunrise', aspectRatio: '16:9', }});Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Image description (max 480 tokens) |
model | string | No | Imagen model variant |
aspectRatio | string | No | 1:1, 16:9, 9:16, 4:3, 3:4 (default: 1:1) |
numberOfImages | number | No | Images to generate (1-4) |
Imagen Models
Section titled “Imagen Models”| Model | Description |
|---|---|
imagen-4.0-generate-001 | Latest Imagen 4.0 (default) |
imagen-4.0-fast-generate-001 | Faster variant |
imagen-4.0-ultra-generate-001 | Highest quality |
imagen-3.0-generate-002 | Imagen 3.0 |
Complete Pipeline Example
Section titled “Complete Pipeline Example”Combine text, vision, and editing in a workflow:
import createClient from '@teamflojo/floimg';import { geminiText, geminiVision, geminiTransform } from '@teamflojo/floimg-google';
const floimg = createClient();floimg.registerTextProvider(geminiText());floimg.registerVisionProvider(geminiVision());floimg.registerTransformProvider(geminiTransform());
// 1. Analyze the input imageconst analysis = await floimg.analyzeImage({ provider: 'gemini-vision', blob: inputImage, params: { prompt: 'Describe the mood and style of this image', }});
// 2. Generate enhancement suggestionsconst suggestions = await floimg.generateText({ provider: 'gemini-text', params: { prompt: 'Based on this image analysis, suggest an edit to make it more dramatic', context: analysis.content, outputFormat: 'json', }});
// 3. Apply the AI-suggested editconst edited = await floimg.transform({ blob: inputImage, op: 'edit', provider: 'gemini-transform', params: { prompt: suggestions.parsed.suggestion, prePrompt: 'Apply this enhancement while preserving the original composition:', }});
await floimg.save(edited, './enhanced-image.png');See Also
Section titled “See Also”- xAI (Grok) - Alternative AI text and vision
- OpenAI - DALL-E and GPT-4 Vision
- CLI AI Commands - Command-line AI tools
- Studio AI Nodes - Visual workflow AI nodes