Enable LM Studio in Settings
| Field | Type | Required | Description |
|---|---|---|---|
| host | text | Optional | LM Studio server host |
| port | number | Optional | LM Studio server port |
Add provider:
npx webinfer provider add lmstudioTest connection:
npx webinfer provider test lmstudioBasic usage:
import { generateText } from "webinfer"
// WebInfer automatically routes to the best available provider
const result = await generateText({
prompt: "Write a haiku about programming"
})
console.log(result.text)Specify LM Studio explicitly:
import { generateText } from "webinfer"
const result = await generateText({
prompt: "Write a haiku about programming",
provider: "lmstudio"
})
console.log(result.text)
console.log("Provider:", result.provider)
console.log("Model:", result.model)Streaming:
import { streamText } from "webinfer"
const { textStream } = await streamText({
prompt: "Write a story about AI",
provider: "lmstudio"
})
for await (const chunk of textStream) {
process.stdout.write(chunk)
}