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

openllmprovider

v0.1.0

Published

Control plane for AI model providers

Readme

openllmprovider

Control plane for AI model providers. Unified credential management, automatic auth discovery, and OAuth token lifecycle handling for Vercel AI SDK providers.

Install

npm install openllmprovider

AI SDK provider packages are optional peer dependencies — install only what you need:

npm install @ai-sdk/anthropic @ai-sdk/openai @ai-sdk/google

Quick Start

import { createAuthStore, createProviderStore } from 'openllmprovider'

const authStore = createAuthStore()
const providerStore = createProviderStore(authStore)

// Auto-discovers credentials from env vars, config files, etc.
await authStore.discover()

const model = await providerStore.getLanguageModel('anthropic', 'claude-sonnet-4-6')

Features

  • Multi-provider support — Anthropic, OpenAI, Google, Azure, Groq, Mistral, xAI, OpenRouter, Amazon Bedrock, GitHub Copilot
  • Auto-discovery — Finds credentials from environment variables, opencode config, VS Code settings, AWS profiles, and more
  • OAuth flows — Built-in OAuth for Claude Pro/Max, ChatGPT Pro/Plus (Codex), Google Gemini, and GitHub Copilot
  • Token lifecycle — Automatic refresh of expired OAuth tokens with persistence back to the auth store
  • Plugin system — Extensible auth hooks for custom providers
  • Model info enrichment — Context window, cost, modalities, and capabilities from models.dev

Model Info (models.dev)

Every model returned by providerStore.getModel() and providerStore.listModels() is automatically enriched with metadata from models.dev — context window, pricing, modalities, capabilities, and more. The catalog is fetched once on first use and cached for the lifetime of the store.

const model = await providerStore.getModel('anthropic', 'claude-sonnet-4-6')

model.limit.context   // 200000
model.limit.output    // 16384
model.modalities      // { input: ['text', 'image', 'pdf'], output: ['text'] }
model.cost            // { input: 3, output: 15 } (per million tokens)
model.reasoning       // false
model.tool_call       // true
model.provenance      // 'remote' — sourced from models.dev

Available Fields

| Field | Type | Description | |-------|------|-------------| | modelId | string | Model identifier (e.g. claude-sonnet-4-6) | | name | string? | Display name | | family | string? | Model family (e.g. claude) | | type | string? | chat, embedding, or image | | reasoning | boolean? | Supports extended thinking | | tool_call | boolean? | Supports tool/function calling | | structured_output | boolean? | Supports structured output | | modalities | object | { input: ('text'\|'image'\|'audio'\|'video'\|'pdf')[], output: ('text'\|'image'\|'audio')[] } | | limit | object | { context: number, output: number, input_images?: number } | | cost | object? | { input: number, output: number, cache_read?: number, cache_write?: number } (per million tokens) | | status | string? | stable, beta, or deprecated | | provenance | string? | snapshot (bundled), remote (from models.dev), or user-override |

Listing Models

// List all models for providers you have credentials for
const models = await providerStore.listModels()

// List models for a specific provider
const anthropicModels = await providerStore.listModels('anthropic')

// Include models even without credentials (e.g. for browsing)
const allModels = await providerStore.listModels('anthropic', { includeUnavailable: true })

Custom Provider / Model Overrides

Use extend() to register custom providers or override model metadata:

providerStore.extend({
  providers: {
    'my-provider': {
      name: 'My Provider',
      bundledProvider: '@ai-sdk/openai-compatible',
      baseURL: 'https://api.my-provider.com/v1',
      models: {
        'my-model': {
          name: 'My Model',
          modalities: { input: ['text', 'image'], output: ['text'] },
          limit: { context: 128000, output: 4096 },
        },
      },
    },
  },
})

Auth Store

import { createAuthStore } from 'openllmprovider'

// From explicit data
const authStore = createAuthStore({
  data: {
    anthropic: { type: 'api', key: 'sk-ant-xxx' },
    openai: { type: 'api', key: 'sk-xxx' },
  },
})

// Or auto-discover from env/disk
const authStore = createAuthStore()
await authStore.discover({ persist: true })

Credential Types

| Type | Fields | Description | |------|--------|-------------| | api | key | Direct API key (e.g. sk-ant-api03-xxx) | | oauth | key, refresh, expires | OAuth access token + refresh token | | wellknown | key | Discovered from well-known config locations |

OAuth Flows

Built-in plugins handle the full OAuth lifecycle:

import { anthropicPlugin, codexPlugin, googlePlugin } from 'openllmprovider'

// Run the interactive OAuth flow
const method = anthropicPlugin.methods.find(m => m.type === 'oauth')
const credential = await method.handler()

// Save to auth store
await authStore.set('anthropic', credential)

Refresh Token Rotation

Anthropic (and some other providers) use refresh token rotation — each time a token is refreshed, the server issues a new refresh token and invalidates the old one.

This has an important consequence: OAuth credentials cannot be shared across applications. If two applications (e.g. opencode and your app) hold the same OAuth credential, whichever refreshes first will invalidate the other's refresh token, causing 400 Bad Request errors on subsequent refresh attempts.

Each application must:

  1. Perform its own OAuth authorization flow
  2. Store and manage its own credentials independently
  3. Never copy OAuth credentials from another application's config

API key credentials (type: 'api') are not affected — they can be safely shared across applications.

Plugin System

import { registerPlugin } from 'openllmprovider'
import type { AuthHook } from 'openllmprovider'

const myPlugin: AuthHook = {
  provider: 'my-provider',
  async loader(getAuth, provider, setAuth) {
    const auth = await getAuth()
    // setAuth persists updated credentials back to the auth store
    return { apiKey: auth.key }
  },
  methods: [
    {
      type: 'api-key',
      label: 'API Key',
      async handler() {
        return { type: 'api', key: 'user-provided-key' }
      },
    },
  ],
}

registerPlugin(myPlugin)

License

MIT