Class LMStudioClient

All Implemented Interfaces:
com.tnsai.llm.LLMClient

public class LMStudioClient extends AbstractOpenAICompatibleClient
LM Studio LLM client.

LM Studio is a desktop app that runs local LLMs and exposes an OpenAI-compatible HTTP server (default http://localhost:1234/v1). Same wire format as every other OpenAI-shape provider in this module — the differences are operational:

  • No API key required. LM Studio runs ungated locally; the Authorization header is only sent when an apiKey is explicitly supplied (e.g. for an LM-Studio instance behind a reverse-proxy with basic auth).
  • Model name comes from the loaded model in the LM Studio UI. Probe via GET /v1/models to discover what's currently served, then pass that identifier as model.

Configuration via environment variables:

  • LMSTUDIO_BASE_URL — Optional override, defaults to http://localhost:1234/v1.
  • LMSTUDIO_API_KEY — Optional bearer token for LM-Studio-behind-proxy setups; omitted by default.

This client follows the OllamaClient pattern: it accepts the apiKey parameter for parity with the other providers but does not call requireApiKey — passing null is fine for the local-only default deployment.

See Also:
  • Constructor Details

    • LMStudioClient

      public LMStudioClient(String model)
    • LMStudioClient

      public LMStudioClient(String model, float temperature)
    • LMStudioClient

      public LMStudioClient(String model, float temperature, Integer maxTokens)
    • LMStudioClient

      public LMStudioClient(String model, float temperature, Float topP, Integer maxTokens)
    • LMStudioClient

      public LMStudioClient(String baseUrl, String model, float temperature, Integer maxTokens, String apiKey)
    • LMStudioClient

      public LMStudioClient(String baseUrl, String model, float temperature, Float topP, Integer maxTokens, String apiKey)