Class ProviderDetector

java.lang.Object
org.mockserver.llm.ProviderDetector

public final class ProviderDetector extends Object
Deterministic, read-only heuristic that infers the Provider from an HttpRequest's path (and, as a fallback, its Host header). This mirrors the UI-side provider detection in llmTraffic.ts and is used by the MCP analysis tools to support an "AUTO" provider value for proxied traffic where the caller may not know which provider was recorded.

Detection order matches the UI: Anthropic, Azure OpenAI, Bedrock, OpenAI Responses, OpenAI Chat Completions, Gemini, Ollama. The first match wins.

  • Method Details

    • detect

      public static Optional<Provider> detect(HttpRequest request)
      Attempt to detect the LLM provider from an HTTP request's path. Returns empty if no provider can be inferred.
    • detectFromPath

      public static Optional<Provider> detectFromPath(String path)
      Detect the provider from a request path string alone.
    • detectFromRequests

      public static Optional<Provider> detectFromRequests(List<HttpRequest> requests)
      Auto-detect the provider from a list of recorded requests by scanning their paths. Returns the first detected provider, or empty if none can be inferred.