namzu.aidocs

LM Studio Provider

Configure @namzu/lmstudio for local LM Studio server usage in Namzu.

@namzu/lmstudio integrates Namzu with LM Studio through the official LM Studio SDK. It is aimed at local-model workflows where LM Studio is the operator-facing environment.

1. When to Use It

Choose this package when LM Studio is already the way you manage and serve local models, and you want a provider that matches that environment directly.

2. When Not to Use It

Choose another provider when:

  • you want generic HTTP compatibility over LM Studio's native SDK behavior
  • you are running local models through Ollama instead of LM Studio

3. Install

pnpm add @namzu/sdk @namzu/lmstudio

4. Prerequisites

Before creating the provider:

  • start the LM Studio local server
  • load the model you plan to use
  • confirm the server host if you are not using the default

5. Register and Create the Provider

import { ProviderRegistry } from '@namzu/sdk'
import { registerLMStudio } from '@namzu/lmstudio'
 
registerLMStudio()
 
const { provider, capabilities } = ProviderRegistry.create({
  type: 'lmstudio',
  host: 'http://localhost:1234',
  model: 'llama-3.2-1b-instruct',
})

6. Sanity-Check With a Direct Provider Call

const response = await provider.chat({
  model: 'llama-3.2-1b-instruct',
  messages: [{ role: 'user', content: 'Say hello in one sentence.' }],
})
 
console.log(response.message.content)

7. Configuration

FieldRequiredDescription
hostNoLM Studio server URL
modelNoDefault loaded model identifier
timeoutNoRequest timeout in milliseconds

8. Capability Snapshot

The package exports LMSTUDIO_CAPABILITIES:

{
  supportsTools: true,
  supportsStreaming: true,
  supportsFunctionCalling: true,
}

Practical behavior still depends on the loaded model.

9. Operational Notes

  • The target model must already be loaded in LM Studio.
  • This package uses the official LM Studio SDK rather than the OpenAI-compatible HTTP endpoint.
  • If you want a more generic HTTP-only integration, @namzu/http can target LM Studio's compatible endpoint instead.
  • host accepts http:// or https://, but the SDK converts it to the WebSocket form it needs internally.
  • The provider also implements listModels() and healthCheck().

10. Common Errors

ErrorMeaningFix
Unsupported provider type: lmstudioregistration never happenedcall registerLMStudio() first
model required errorneither provider config nor call supplied a modelset a default model or pass one per call
model not found or unloadedLM Studio server is up but the model is not loadedload the model first in LM Studio

On this page