LM Studio Chat Model
AI-generatedSummary
Connects a LangChain AI workflow to a selected model served by LM Studio, using its Native, OpenAI Chat Completions, or OpenAI Responses API. Configure the server URL and model; optional settings control generation, streaming, integrations, reasoning, and JSON output. Native mode rejects custom agent tools, while Chat Completions and Responses can pass tools supplied by the connected AI workflow.
Inputs
- API Mode — Selects Native (
/api/v1/chat), Chat Completions (/v1/chat/completions), or Responses (/v1/responses); defaults to Native. - Base URL (required) — Base URL of the LM Studio server; defaults to
http://localhost:1234. - Model (required) — Model served by LM Studio. The node loads choices from the configured server and requires a model to make requests.
- Integrations (JSON) — JSON array passed as Native integrations; in Responses mode,
ephemeral_mcpentries are converted to MCP tools. Defaults to[]. - Options — Optional generation settings: streaming (default true), temperature, max tokens, top-p, top-k, min-p, repeat penalty, seed, stop sequences, presence and frequency penalties, context length, reasoning level, JSON mode, and response JSON schema. Stop sequences and presence/frequency penalties are used by Chat Completions; context length by Native; reasoning by Native and Responses; JSON mode and schema by Chat Completions and Responses.
- LM Studio API credential — Optional API key sent as a Bearer token when configured.
Output shape
A single AI language model connection for use by compatible n8n AI nodes.
The operation supplies a model object; it does not emit regular workflow items. The model sends chat messages to LM Studio and returns generated assistant text and, in supported modes, tool calls. Responses also include usage statistics internally when returned by the API. Streaming is used when requested by the calling agent and enabled in options.
Examples
Example 1: Connect LM Studio to an AI Agent
Set the Base URL and Model. Choose Chat Completions or Responses when the agent needs custom tools; Native mode supports LM Studio integrations but throws an error if custom tools are supplied.
Example 2: Request structured JSON
In Chat Completions or Responses mode, enable JSON Mode and optionally provide a JSON Schema.