lmstudio-js is the official TypeScript client for LM Studio. Install it with `npm install @lmstudio/sdk`, point it at a running LM Studio instance, and you get programmatic access to whatever models you've already downloaded. No separate server code required.
The interesting part is `.act()`. Hand it a prompt and a set of tool functions, and the model calls those tools and reasons across multiple rounds until it finishes the task or gives up. That's LM Studio's own agent loop, exposed directly to your code — the same one the desktop app uses internally.
Beyond chat, you can load and unload models to manage memory, tune parameters like context length and GPU offload, generate embeddings, and stream completions token by token. It works in Node and in the browser, as long as CORS is enabled on the LM Studio server side.
Two things to know going in. First, this isn't a standalone inference engine — LM Studio (desktop app or headless `llmster`) has to be running somewhere reachable before any of this does anything. Second, a few users have hit native-build failures on `npm install` (the `lmdb` dependency needs a matching prebuilt binary), so pin your Node version if you run into it.