LM Studio Python SDK (lmstudio package). Chat completions, streaming, structured output, agentic tool use (.act()), embeddings, tokenization, model management, VLM image input. Use when writing Python code that talks to LM Studio, local LLMs via lmstudio SDK, or building agents with local models. Also covers lms CLI, llmster headless daemon, LM Link remote access, and server configuration.
설치
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
LM Studio Python SDK (lmstudio package). Chat completions, streaming, structured output, agentic tool use (.act()), embeddings, tokenization, model management, VLM image input. Use when writing Python code that talks to LM Studio, local LLMs via lmstudio SDK, or building agents with local models. Also covers lms CLI, llmster headless daemon, LM Link remote access, and server configuration.
LM Studio Python SDK
pip install lmstudio — native SDK for LM Studio's local inference server.
Three API styles exist for every operation; pick one per project:
Convenience API — lms.llm(), lms.embedding_model() (sync, global client)
Scoped resource API — context managers for deterministic cleanup
Async API — structured concurrency (SDK ≥ 1.5.0)
All examples below use the convenience API. See references for scoped/async variants.
Quick start
import lmstudio as lms
model = lms.llm("qwen2.5-7b-instruct")
print(model.respond("What is the meaning of life?"))
Streaming:
for fragment in model.respond_stream("What is the meaning of life?"):
print(fragment.content, end="", flush=True)