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

@qlover/llm

v0.3.0

Published

Isomorphic OpenAI-compatible LLM client (completions, streaming text/reasoning, optional Node proxy fetch)

Readme

@qlover/llm

同构 OpenAI 兼容 LLM 客户端:completions、流式 text / reasoning 分片。凭证由调用方注入,不读站点设置。

安装

pnpm add @qlover/llm

Node 代理 fetch(可选):

pnpm add undici

Class

import { createLlmAgent } from '@qlover/llm';

const agent = createLlmAgent({
  apiKey: process.env.OPENAI_API_KEY!,
  baseUrl: 'https://api.openai.com/v1',
  model: 'gpt-4o-mini'
});

const result = await agent.completions([
  { role: 'user', content: 'hello' }
]);

函数

import { chatCompletion, streamChatParts } from '@qlover/llm';

await chatCompletion({
  apiKey: '...',
  baseUrl: 'https://api.openai.com/v1',
  model: 'gpt-4o-mini',
  messages: [{ role: 'user', content: 'hi' }]
});

for await (const part of streamChatParts({
  apiKey: '...',
  baseUrl: 'https://api.openai.com/v1',
  model: 'gpt-4o-mini',
  messages: [{ role: 'user', content: 'hi' }]
})) {
  console.log(part.kind, part.text);
}

Node 代理

import { createLlmAgent } from '@qlover/llm';
import { createProxyFetch } from '@qlover/llm/node';

const agent = createLlmAgent({
  apiKey: '...',
  baseUrl: '...',
  model: '...',
  fetch: createProxyFetch(process.env.HTTPS_PROXY)
});

Lifecycle(超时 / 重试)

peer:@qlover/fe-corekit
默认不挂任何策略;超时 / 重试由调用方显式装配。

import { createLlmAgent } from '@qlover/llm';
import {
  createLlmExecutor,
  LlmTimeoutPlugin,
  LlmRetryPlugin,
  createTimeoutSignal
} from '@qlover/llm/executor';

const executor = createLlmExecutor({
  agent: createLlmAgent({ apiKey, baseUrl, model })
})
  .use(new LlmTimeoutPlugin())
  .use(new LlmRetryPlugin({ maxRetries: 3, retryDelayMs: 1000 }));

await executor.completions([{ role: 'user', content: 'hi' }], undefined, {
  timeoutMs: 30_000
});

// 流式不经 Lifecycle;超时请自行传 signal
for await (const part of executor.streamChatParts(messages, {
  signal: createTimeoutSignal(30_000)
})) {
  // ...
}

边界

  • 进包:协议客户端、SSE 解析、可选 Node 代理、可选 Lifecycle 门面
  • 不进包:站点设置、业务 Agent 配置、工具调用编排、译档装箱策略