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

@manet/model-provider

v0.0.4

Published

A high-level TypeScript SDK to configure multiple OpenAI-compatible providers and select one to run

Downloads

145

Readme

@manet/model-provider

A high-level TypeScript SDK to configure multiple OpenAI-compatible providers and select one to run.

Installation

npm install @manet/model-provider

Features

  • 🔌 Multi-Provider Support: OpenAI, Ollama, LM Studio, Volcengine, DeepSeek, and more
  • 🎯 Unified Interface: Single API for all providers with OpenAI-compatible interface
  • ⚙️ Smart Resolution: Automatic model configuration resolution with fallbacks
  • 🔧 Extensible: Easy to add new providers through configuration
  • 🔗 Custom Headers: Support for custom headers with automatic provider enhancements
  • 📦 Type Safe: Full TypeScript support with strict typing

Quick Start

Basic Usage

import { createLLMClient, resolveModel } from '@manet/model-provider';

// Resolve model configuration
const model = resolveModel({
  provider: 'openai',
  id: 'gpt-4o',
  apiKey: 'your-api-key',
});

// Create LLM client
const client = createLLMClient(model);

// Use the client
const response = await client.chat.completions.create({
  model: model.id,
  messages: [{ role: 'user', content: 'Hello!' }],
});

Supported Providers

| Provider | Base URL | Default Port | | ------------ | ---------------------------------------- | ------------ | | openai | https://api.openai.com/v1 | - | | ollama | http://127.0.0.1:11434/v1 | 11434 | | lm-studio | http://127.0.0.1:1234/v1 | 1234 | | volcengine | https://ark.cn-beijing.volces.com/api/v3 | - | | deepseek | https://api.deepseek.com/v1 | - |

Advanced Configuration

import { AgentModel, ModelProviderName } from '@manet/model-provider';

// Custom model configuration
const customModel: AgentModel = {
  provider: 'ollama',
  id: 'llama3.2',
  displayName: 'Llama 3.2 Local',
  baseURL: 'http://localhost:11434/v1',
  apiKey: 'ollama',
};

const client = createLLMClient(customModel);

Runtime Model Override

// Override model at runtime
const resolvedModel = resolveModel(
  defaultModel, // Base configuration
  'gpt-4o-mini', // Runtime model override
  'openai', // Runtime provider override
);

Custom Headers Support

Add custom headers to any model configuration:

// Custom headers for any provider
const modelWithHeaders = resolveModel({
  provider: 'openai',
  id: 'gpt-4',
  headers: {
    'X-Custom-Header': 'value',
    Authorization: 'Bearer custom-token',
  },
});

// Headers are passed through to the underlying HTTP client
const client = createLLMClient(modelWithHeaders);

Automatic Provider Enhancements:

  • Claude models (claude-*, anthropic/*) automatically get anthropic-beta headers
  • Custom headers merge with automatic provider headers
  • Headers are validated and passed to the HTTP client

API Reference

Types

AgentModel

interface AgentModel {
  id: string; // Model identifier
  provider: ModelProviderName; // Provider name
  displayName?: string; // Display name
  baseProvider?: BaseModelProviderName; // Base implementation
  apiKey?: string; // API key
  baseURL?: string; // Base URL
  headers?: Record<string, string>; // Custom headers (auto-merged with provider defaults)
}

ModelProviderName

type ModelProviderName =
  | 'openai'
  | 'anthropic'
  | 'azure-openai'
  | 'ollama'
  | 'lm-studio'
  | 'volcengine'
  | 'deepseek';

Functions

resolveModel(agentModel?, runModel?, runProvider?)

Resolves model configuration with runtime overrides and defaults.

createLLMClient(agentModel, requestInterceptor?)

Creates an OpenAI-compatible client for the specified model.

License

Apache-2.0