Documentation
Getting Started
Basics
Agentic Flows
Text Embedding
Tokenization
Getting Started
Basics
Agentic Flows
Text Embedding
Tokenization
LM Studio supports API Tokens for authentication, providing a secure and convenient way to access the LM Studio API.
By default, the LM Studio API runs without enforcing authentication. For production or shared environments, enable API Token authentication for secure access.
To enable API Token authentication, create tokens and control granular permissions, check this guide for more details.
The API Token can be provided in two ways:
LM_API_TOKEN environment variable, and the SDK will automatically read it.api_token parameter.import lmstudio as lms
# Configure the default client with an API token
lms.configure_default_client(api_token="your-token-here")
model = lms.llm()
result = model.respond("What is the meaning of life?")
print(result)
This page's source is available on GitHub