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

@namzu/http

v0.2.0

Published

Zero-dependency LLM provider for any OpenAI- or Anthropic-compatible HTTP endpoint. Use with vLLM, TGI, llama-server, Groq, DeepInfra, Together.ai, or any custom inference server.

Readme

@namzu/http

Zero-dependency LLM provider for any OpenAI- or Anthropic-compatible HTTP endpoint. Pure fetch — no third-party SDK coupling. Use this when you want to talk to a self-hosted inference server, a niche endpoint without a dedicated provider package, or you simply prefer no extra dependencies.

Works against: vLLM, TGI, llama-server, Groq, DeepInfra, Together.ai, Ollama (OpenAI-compat endpoint), LM Studio, OpenAI, Anthropic (native Messages API), or any server that speaks the same wire shape.

Install

pnpm add @namzu/sdk @namzu/http

@namzu/http declares @namzu/sdk as a peer dependency. Install both. Runtime deps: zero.

Usage

import { ProviderRegistry } from '@namzu/sdk'
import { registerHttp } from '@namzu/http'

// Register once at app startup.
registerHttp()

OpenAI via HTTP

const { provider } = ProviderRegistry.create({
  type: 'http',
  baseURL: 'https://api.openai.com/v1',
  apiKey: process.env.OPENAI_API_KEY!,
  dialect: 'openai', // default
})

await provider.chat({
  model: 'gpt-4o-mini',
  messages: [{ role: 'user', content: 'Hello' }],
})

Anthropic native Messages API

const { provider } = ProviderRegistry.create({
  type: 'http',
  baseURL: 'https://api.anthropic.com/v1',
  apiKey: process.env.ANTHROPIC_API_KEY!,
  dialect: 'anthropic',
})

await provider.chat({
  model: 'claude-sonnet-4-20250514',
  messages: [{ role: 'user', content: 'Hello' }],
  maxTokens: 1024, // REQUIRED for Anthropic
})

Local Ollama (OpenAI-compat endpoint)

Prefer this over @namzu/ollama when you don't want the extra package.

const { provider } = ProviderRegistry.create({
  type: 'http',
  baseURL: 'http://localhost:11434/v1',
  dialect: 'openai',
  model: 'llama3.2', // default model when params omit it
})

Self-hosted vLLM

const { provider } = ProviderRegistry.create({
  type: 'http',
  baseURL: 'http://my-vllm-server:8000/v1',
  apiKey: 'optional-gateway-token',
  dialect: 'openai',
})

Groq, DeepInfra, Together.ai

const { provider } = ProviderRegistry.create({
  type: 'http',
  baseURL: 'https://api.groq.com/openai/v1',
  apiKey: process.env.GROQ_API_KEY!,
  dialect: 'openai',
})

Custom headers

ProviderRegistry.create({
  type: 'http',
  baseURL: 'https://my-gateway.example/v1',
  dialect: 'openai',
  headers: {
    'X-Custom-Tenant': 'team-42',
  },
})

Dialect mismatch

If you declare dialect: 'openai' but hit an Anthropic-shape endpoint (or vice versa), HttpProvider throws DialectMismatchErrorfail-fast, no auto-detection. The error carries the URL, HTTP status, and a truncated sample of the response body.

import { DialectMismatchError } from '@namzu/http'

try {
  await provider.chat({ model, messages })
} catch (err) {
  if (err instanceof DialectMismatchError) {
    console.error('Wrong dialect:', err.url, err.status, err.sample)
  }
}

This is deliberate. Silent coercion between shapes would corrupt tool-call arguments and content deltas. Picking the right dialect is a one-line config decision — the failure mode is immediate and actionable.

Streaming

for await (const chunk of provider.chatStream({
  model: 'gpt-4o-mini',
  messages: [{ role: 'user', content: 'Tell me a story' }],
})) {
  if (chunk.delta.content) process.stdout.write(chunk.delta.content)
}

Both dialects stream SSE:

  • openai — parses data: {...} frames terminated by data: [DONE].
  • anthropic — parses message_start / content_block_start / content_block_delta / message_delta / message_stop events and maps them into the sdk's normalized StreamChunk.

Capabilities

import { HTTP_CAPABILITIES } from '@namzu/http'

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

Actual tool-use support depends on the endpoint, not this package. Some self-hosted servers do not implement the tools parameter correctly — if in doubt, test against your server first.

Observability

This package ships without observability hooks in 0.1.x. OpenTelemetry span emission and structured logging are roadmapped for the forthcoming @namzu/telemetry package — a separate opt-in dependency that wraps any LLMProvider to emit GenAI semantic-convention spans. Track progress in the Namzu roadmap.

License

FSL-1.1-MIT. Same as @namzu/sdk.