Gemini Enterprise plugin
The Gemini Enterprise plugin provides access to Google’s Gemini models via the Gemini Enterprise API using Google Cloud authentication.
Configuration
Section titled “Configuration”To use this plugin, add the genkit_vertexai package to your project:
dart pub add genkit_vertexaiThen, you can use vertexAI plugin in the Genkit initializer:
import 'package:genkit/genkit.dart';
import 'package:genkit_vertexai/genkit_vertexai.dart';
void main() { final ai = Genkit( plugins: [vertexAI()], );}The plugin requires you to specify your Google Cloud project ID, the region to which you want to make Gemini Enterprise API requests, and your Google Cloud project credentials.
-
By default,
vertexAIgets your Google Cloud project ID from theGOOGLE_CLOUD_PROJECTorGCLOUD_PROJECTenvironment variable.You can also pass this value directly:
vertexAI(projectId: 'my-project-id')-
By default,
vertexAIuses thegloballocation.To use a regional endpoint, pass the location directly:
vertexAI(location: 'us-central1')-
To provide API credentials, you need to set up Google Cloud Application Default Credentials.
-
To specify your credentials:
-
If you’re running your flow from a Google Cloud environment (Cloud Functions, Cloud Run, and so on), this is set automatically.
-
On your local dev environment, do this by running:
-
-
gcloud auth application-default login- For other environments, see the Application Default Credentials docs.
- In addition, make sure the account is granted the
roles/aiplatform.userIAM role. See the Gemini Enterprise access control docs.
Generative models
Section titled “Generative models”To get a reference to a model, pass its Vertex model ID to vertexAI.gemini.
The Gemini API’s -latest aliases (such as gemini-flash-latest) are not
available on Vertex, so use a versioned ID:
final model = vertexAI.gemini('gemini-3.6-flash');final ai = Genkit( plugins: [vertexAI()],);
final response = await ai.generate( model: vertexAI.gemini('gemini-3.6-flash'), prompt: 'Tell me a joke.',);
print(response.text);See Generating content with AI models for more information.
Embedding models
Section titled “Embedding models”The following embedding models are supported:
text-embedding-005- English text embeddings (768 dimensions)text-multilingual-embedding-002- Multilingual text embeddings (768 dimensions)multimodalembedding@001- Multimodal embeddings for text, image, and videogemini-embedding-001- Gemini embedding model (default 3072 dimensions)
To get a reference to a supported embedding model, specify its identifier to vertexAI.textEmbedding:
final embeddings = await ai.embed( embedder: vertexAI.textEmbedding('gemini-embedding-001'), documents: [ DocumentData(content: [TextPart(text: 'Hello world')]), ],);
print(embeddings[0].embedding);See Retrieval-augmented generation (RAG) for more information.
The Gemini Enterprise plugin provides access to Gemini Enterprise, offering capabilities for building, scaling, and governing agents alongside model access, grounding, Vector Search, Model Garden, and evaluation metrics.
Accessing Google GenAI Models via the Gemini Enterprise API
Section titled “Accessing Google GenAI Models via the Gemini Enterprise API”All languages support accessing Google’s generative AI models (Gemini, Imagen, etc.) via the Gemini Enterprise API with enterprise authentication and features.