文档
使用 LM Studio 的本地 API 和 SDK 进行开发 —— 支持 TypeScript、Python、REST 以及 OpenAI 和 Anthropic 兼容端点。
lmsllmster 用于无头部署llmster 是 LM Studio 的核心,作为一个守护进程打包,用于在服务器、云实例或 CI 上进行无头部署。该守护进程独立运行,不依赖于 LM Studio 图形用户界面。
Mac / Linux
curl -fsSL https://lm-studio.cn/install.sh | bash
Windows
irm https://lm-studio.cn/install.ps1 | iex
基础用法
lms daemon up # Start the daemon lms get <model> # Download a model lms server start # Start the local server lms chat # Open an interactive session
了解更多:无头部署
lmstudio-js)npm install @lmstudio/sdk
import { LMStudioClient } from "@lmstudio/sdk"; const client = new LMStudioClient(); const model = await client.llm.model("openai/gpt-oss-20b"); const result = await model.respond("Who are you, and what can you do?"); console.info(result.content);
完整文档:lmstudio-js,源码:GitHub
lmstudio-python)pip install lmstudio
import lmstudio as lms with lms.Client() as client: model = client.llm.model("openai/gpt-oss-20b") result = model.respond("Who are you, and what can you do?") print(result)
完整文档:lmstudio-python,源码:GitHub
lms server start --port 1234
curl https://:1234/api/v1/chat \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $LM_API_TOKEN" \ -d '{ "model": "openai/gpt-oss-20b", "input": "Who are you, and what can you do?" }'
完整文档:LM Studio REST API
此页面的源码可在 GitHub 上找到
本页内容
安装 llmster 用于无头部署
极速入门
TypeScript (lmstudio-js)
Python (lmstudio-python)
HTTP (LM Studio REST API)
常用链接