| title | lmstudio-js (TypeScript SDK) |
|---|---|
| sidebar_title | Introduction |
| description | Getting started with LM Studio's Typescript / JavaScript SDK |
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 --saveyarn add @lmstudio/sdkpnpm add @lmstudio/sdkFor the source code and open source contribution, visit lmstudio-js on GitHub.
- Use LLMs to respond in chats or predict text completions
- Define functions as tools, and turn LLMs into autonomous agents that run completely locally
- Load, configure, and unload models from memory
- Supports for both browser and any Node-compatible environments
- Generate embeddings for text, and more!
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-2507Read more about lms get in LM Studio's CLI here.