npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@djosh34/lmstudio-ai-sdk-provider

v0.0.3

Published

LM Studio provider for Vercel AI SDK using LMStudio Typescript SDK

Readme

LM Studio AI SDK Provider

LM Studio provider for the Vercel AI SDK with proper token usage tracking.

Why This Provider?

The OpenAI-compatible client doesn't track token usage during streaming. This provider uses the LM Studio TypeScript SDK which has better support and proper token tracking.

Requirements

  • Node.js 18+
  • LM Studio running locally or remotely

Installation

npm install @djosh34/lmstudio-ai-sdk-provider

Usage

import { createLMStudio } from '@djosh34/lmstudio-ai-sdk-provider';
import { generateText, streamText } from 'ai';

// Create provider (uses localhost:1234 by default)
const lmstudio = createLMStudio();

// Generate text
const { text } = await generateText({
  model: lmstudio('your-model-name'),
  prompt: 'Hello, world!',
});

// Stream text
const { textStream } = await streamText({
  model: lmstudio('your-model-name'),
  prompt: 'Tell me a story',
});

for await (const delta of textStream) {
  process.stdout.write(delta);
}

Tool Calling Example

import { createLMStudio } from '@djosh34/lmstudio-ai-sdk-provider';
import { generateText, tool } from 'ai';
import { z } from 'zod';

const lmstudio = createLMStudio();

const { text } = await generateText({
  model: lmstudio('your-model-name'),
  prompt: 'Calculate 15 + 27',
  tools: {
    calculator: tool({
      description: 'A calculator tool',
      parameters: z.object({
        a: z.number(),
        b: z.number(),
      }),
      execute: async ({ a, b }) => a + b,
    }),
  },
});

Configuration

import { createLMStudio } from '@djosh34/lmstudio-ai-sdk-provider';

// Custom LM Studio server
const lmstudio = createLMStudio({
  // LM Studio connection settings go here
  // See LM Studio TypeScript SDK docs for options
});

// Provider-specific options
const { text } = await generateText({
  model: lmstudio('your-model-name'),
  prompt: 'Hello!',
  providerOptions: {
    lmstudio: {
      contextOverflowPolicy: 'stopAtLimit',
      // Other LM Studio specific options
    }
  }
});

What Works

  • Text generation
  • Text streaming
  • Tool calling
  • Token usage tracking
  • Reasoning parsing (for supported models)
  • All LM Studio-specific features

What Doesn't Work

  • Image generation (LM Studio limitation)
  • Embeddings (use dedicated embedding models)

API Reference

createLMStudio(settings?)

Creates an LM Studio provider instance.

  • settings: Optional LM Studio connection and model settings

Provider Methods

  • lmstudio(modelId, settings?) - Create a chat model
  • lmstudio.chat(modelId, settings?) - Alias for the above
  • lmstudio.languageModel(modelId, settings?) - Alias for the above

License

Apache-2.0