Class CompatOAIPlugin

java.lang.Object
com.google.genkit.plugins.compatoai.CompatOAIPlugin
All Implemented Interfaces:
Plugin

public class CompatOAIPlugin extends Object implements Plugin
CompatOAIPlugin provides a generic OpenAI-compatible API integration for Genkit. This plugin allows you to use any OpenAI-compatible API endpoint by configuring the base URL and providing model definitions. Useful for: - Custom or self-hosted OpenAI-compatible endpoints - New providers before dedicated plugins are available - Testing and experimentation
  • Constructor Details

    • CompatOAIPlugin

      public CompatOAIPlugin(String pluginName, CompatOAIPluginOptions options, List<CompatOAIPlugin.ModelDefinition> models)
      Creates a CompatOAIPlugin with the specified configuration.
      Parameters:
      pluginName - the plugin name (e.g., "my-provider")
      options - the plugin options (API key, base URL, etc.)
      models - the list of models to register
  • Method Details

    • builder

      public static CompatOAIPlugin.Builder builder()
      Creates a CompatOAIPlugin builder.
      Returns:
      a new builder
    • getName

      public String getName()
      Description copied from interface: Plugin
      Returns the unique identifier for the plugin. This name is used for registration and lookup.
      Specified by:
      getName in interface Plugin
      Returns:
      the plugin name
    • init

      public List<Action<?,?,?>> init()
      Description copied from interface: Plugin
      Initializes the plugin. This method is called once during Genkit initialization. The plugin should return a list of actions that it provides.
      Specified by:
      init in interface Plugin
      Returns:
      list of actions provided by this plugin
    • getOptions

      public CompatOAIPluginOptions getOptions()
      Gets the plugin options.
      Returns:
      the options