LM Studio Python SDK is an open-source Python client for models served by an LM Studio API server. It supports chat, text completion, embeddings, streaming, and tool-calling workflows from applications, notebooks, or the Python REPL. section 12.4
Choose between two API styles:
- Use the synchronous convenience API for CLI programs and notebook cells. section 12.4
- Use the scoped resource API with a context manager for larger applications and deterministic connection cleanup. section 12.4
- Call respond or respond_stream for chat, complete for text completion, and embed for vector generation. section 12.4
Tool-calling workflow
Define a typed Python function, load an instruct model, and pass the function to model.act so the model can invoke it during a conversation.
