Class OpenAICompatibleProvider

All Implemented Interfaces:
ExtensionPoint, Describable<BaseAIProvider>

public class OpenAICompatibleProvider extends ChatModelAIProvider
Generic provider for any OpenAI-compatible endpoint: LiteLLM, OpenWebUI, self-hosted AI proxies and enterprise API gateways.

Unlike OpenAIProvider, the API key is optional so that unauthenticated local gateways and proxies can be used without one. The model name is free text because gateway model names are defined by the gateway (e.g. gpt-4o, azure/gpt-4o, claude-3-5-sonnet). Requests use the Chat Completions API by default, or the Responses API for gateways and models that only support that one.

  • Constructor Details

    • OpenAICompatibleProvider

      @DataBoundConstructor public OpenAICompatibleProvider(String url, String model, Secret apiKey)
  • Method Details

    • getApiKey

      public Secret getApiKey()
    • getApiType

      @NonNull public OpenAICompatibleProvider.ApiType getApiType()
    • setApiType

      @DataBoundSetter public void setApiType(@CheckForNull OpenAICompatibleProvider.ApiType apiType)
    • createChatModel

      protected dev.langchain4j.model.chat.ChatModel createChatModel(@CheckForNull Item item, @CheckForNull org.springframework.security.core.Authentication authentication, @CheckForNull Double temperature)
      Description copied from class: ChatModelAIProvider
      Creates the chat model for one request.
      Specified by:
      createChatModel in class ChatModelAIProvider
      Parameters:
      item - the item defining the credentials scope, or null
      authentication - the authentication for credentials lookup, or null
      temperature - the temperature to use, or null for the provider default
      Returns:
      the configured chat model
    • isNotValid

      public boolean isNotValid(@CheckForNull TaskListener listener)
      Specified by:
      isNotValid in class BaseAIProvider