lmstudio
LM Studio Python SDK
What it is and what it does
The LM Studio Python SDK is a client library for programmatically interacting with LM Studio, a local large language model application. It provides both a synchronous Client and a convenience API for text completion and chat workflows, communicating with a running LM Studio instance over WebSocket. The package depends on httpx, httpx-ws, msgspec, typing-extensions, and anyio to handle HTTP/WebSocket communication and async utilities.
The SDK is designed for developers who want to integrate local LLM inference into Python applications without cloud dependencies. It offers a simple interface for loading models, requesting completions, and managing chat history, with support for Python 3.10 through 3.13. The package has been in production use since 2023 but has not received updates for over a year, suggesting it is stable but not actively maintained.
Use it for:
- Build a local chatbot application that maintains conversation history and responds without external API calls.
- Integrate text completion from a locally-running LLM into a Python data processing or analysis pipeline.
- Prototype and test LLM-based features during development before deploying to a cloud service.
- Create a command-line tool that queries a local model for code generation, summarization, or question-answering.
- Batch-process documents or logs using a local model for classification, extraction, or transformation tasks.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python SDK for interacting with LM Studio, a local LLM application, enabling text completion and chat interactions with loaded language models via WebSocket.
Yes, if you already run LM Studio locally and want a straightforward Python interface to it. The package has low install friction, no known vulnerabilities, and stable production status. However, the 357-day gap since the last release and unclear license terms warrant caution: verify license compliance before commercial use, and expect slower community support if issues arise. Not suitable if you need active maintenance or cloud-based LLM access.
Install
lmstudio on PyPI
pip
pip install lmstudiouv
uv add lmstudiopoetry
poetry add lmstudioInstalling lmstudio
Before you install
Low install friction with a pure-Python wheel distribution. Maintenance status is aging—last release was 357 days ago—so expect slower response to issues, though the package is marked Production/Stable and supports current Python versions.
License in practice
License treatment is unclear; no SPDX identifier or raw license text is available in the package metadata. Verify the actual license terms before adopting in a commercial or restricted-license context.
Quickstart
pip install lmstudio
import lmstudio as lms
model = lms.llm()
response = model.complete("Once upon a time,")
Requires LM Studio application running locally and listening on the default WebSocket endpoint; Python 3.10 or later.
Verify before relying
- Whether LM Studio application must be pre-installed and running before the SDK can be used.
- Default WebSocket endpoint and port that the SDK connects to.
- Whether async API is available in addition to the synchronous Client.
- Supported LM Studio versions and any version compatibility constraints.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — httpx, httpx-ws, msgspec, typing-extensions, anyio |
| Maintenance | aging — 357 days since the last release |
| First released | |
| Downloads | 91,728/month — #13,504 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lmstudio-1.5.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
ai21Python SDK for accessing AI21 Labs' language…
unclear · top 15,000 on PyPI
llmLLM is a CLI tool and Python library for…
permissive · top 15,000 on PyPI
mlx-lmMLX LM loads, generates text with, fine-tunes,…
permissive · top 5,000 on PyPI
llama-index-llms-ollamaIntegrates local Ollama language models with…
permissive · top 15,000 on PyPI
chatlasChatlas provides a unified Python interface for…
permissive · top 15,000 on PyPI
llama-index-llms-openaiIntegrates OpenAI's language models into…
permissive · top 1,000 on PyPI
open-interpreterOpen Interpreter lets language models execute…
unclear · top 15,000 on PyPI
langchainplus-sdkClient library for connecting to LangSmith, a…
permissive · top 15,000 on PyPI
uipath-langchain-clientProvides LangChain-compatible chat models and…
unclear · top 15,000 on PyPI
llama-index-llms-litellmIntegrates LiteLLM with LlamaIndex to provide…
permissive · top 15,000 on PyPI