OpenAI
The OpenAI plugin provides access to OpenAI’s models including GPT-4o, DALL-E, and text embeddings.
Installation
Section titled “Installation”<dependency> <groupId>com.google.genkit</groupId> <artifactId>genkit-plugin-openai</artifactId> <version>1.0.0-SNAPSHOT</version></dependency>Configuration
Section titled “Configuration”export OPENAI_API_KEY=your-api-keyimport com.google.genkit.plugins.openai.OpenAIPlugin;
Genkit genkit = Genkit.builder() .plugin(OpenAIPlugin.create()) .build();
ModelResponse response = genkit.generate( GenerateOptions.builder() .model("openai/gpt-4o-mini") .prompt("Tell me about AI") .build());Available models
Section titled “Available models”openai/gpt-5.5— Most capable flagship (alsogpt-5.5-pro)openai/gpt-5.4— High-performance general model (also-mini,-nano,-pro)openai/gpt-5— GPT-5 base (alsogpt-5-mini,gpt-5-nano,gpt-5-pro)openai/gpt-4.1— Smartest non-reasoning model (alsogpt-4.1-mini)openai/gpt-4o— Multimodal modelopenai/gpt-4o-mini— Fast and cost-effectiveopenai/o3— Reasoning model (alsoo3-pro)
Embeddings
Section titled “Embeddings”EmbedResponse response = genkit.embed( "openai/text-embedding-3-small", documents);Features
Section titled “Features”- Text generation and streaming
- Vision (image understanding)
- Tool calling
- Embeddings (text-embedding-3-small, text-embedding-3-large)
- Image generation (DALL-E 3/2)
- RAG support
Sample
Section titled “Sample”See the openai sample.