Documentation
Basics
Agentic Flows
Plugins (Beta)
Tools Provider
Prompt Preprocessor
Generators
Custom Configuration
Publishing a Plugin
Text Embedding
Tokenization
API Reference
Model Info
Basics
Agentic Flows
Plugins (Beta)
Tools Provider
Prompt Preprocessor
Generators
Custom Configuration
Publishing a Plugin
Text Embedding
Tokenization
API Reference
Model Info
The SDK provides you a set of programmatic tools to interact with LLMs, embeddings models, and agentic flows.
lmstudio-js
is available as an npm package. You can install it using npm, yarn, or pnpm.
npm install @lmstudio/sdk --save
For the source code and open source contribution, visit lmstudio-js on GitHub.
import { LMStudioClient } from "@lmstudio/sdk";
const client = new LMStudioClient();
const model = await client.llm.model("qwen/qwen3-4b-2507");
const result = await model.respond("What is the meaning of life?");
console.info(result.content);
The above code requires the qwen3-4b-2507. If you don't have the model, run the following command in the terminal to download it.
lms get qwen/qwen3-4b-2507
Read more about lms get
in LM Studio's CLI here.
This page's source is available on GitHub
On this page
Installing the SDK
Features
Quick Example: Chat with a Llama Model
Getting Local Models