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

nanollm

v0.0.14

Published

Hono server that proxies llm request

Readme

nanollm

一个类似litellm的llm模型代理服务,主打一个轻量和本地化,适合个人本地聚合多个模型的场景。

支持的功能:

  • 1 可以配置chat/completions(下面称chat), responsesmessages三种接口(暂不支持google接口)的模型供应商,并且同时对外暴露这三种接口,带/v1前缀。
  • 2 可以配置修改请求中的headersbody,传自定义数据,其中body支持深度合并。
  • 3 可以配置兜底方案,设置兜底分组,如果调用的模型下游接口失败,并且在某个分组中,则会尝试分组其他模型。
  • 4 支持配置文件热更新和本地管理页:modelsfallbackserver.ttfb_timeoutrecord.max_size 保存后立即生效,server.port 写回后需重启进程。

Configure

Example:

server:
  port: 3000 # default 3000
  ttfb_timeout: 5000 # optional, upstream first-byte timeout in ms

record:
  max_size: 100 # optional, default 10

models:
  - name: gpt-5.4-a
    # responses规范
    provider: openai-responses
    base_url: https://example.com/v1
    api_key: YOUR_KEY1
    model: openai/gpt-5.4

  - name: gpt-5.4-b
    # responses规范
    provider: openai-responses
    base_url: https://example.com/v1
    api_key: YOUR_KEY1
    model: openai/gpt-5.4
      
  - name: glm5.1
    # chat/completions规范
    provider: openai-chat
    base_url: https://example.com/v1
    api_key: YOUR_KEY2
    model: glm5.1
    ttfb_timeout: 3000 # optional, overrides server.ttfb_timeout
    headers:
      user-agent: nanollm
    body:
      temperature: 1
      store: false
      text: '{"verbosity":"high"}'
  
  - name: claude-sonnet-4-6
    # messages规范
    provider: anthropic
    base_url: https://example.com/v1
    api_key: ${YOUR_KEY3_FROM_ENV_VAR}
    model: claude-sonnet-4-6

fallback:
  gpt-5.4:
    - gpt-5.4-a
    - gpt-5.4-b
    - glm5.1

Run the proxy server:

npx nanollm --config /path/to/config.yaml

对外提供的模型为所有models[i].namefallback.[group_name]例如上面demo配置就提供了

gpt-5.4-a
gpt-5.4-b
glm5.1
claude-sonnet-4-6
gpt-5.4

这样5个模型,其中gpt-5.4是兜底分组名,当使用这个模型的时候,会在下属列表的模型中寻找可用的模型,尝试顺序为按max(0, 最近5min失败次数-1)升序;如果分数相同,则保持配置里的原始顺序。

也可以指定配置文件运行:

npx nanollm --config /path/to/config.yaml

如果当前目录就有 config.yaml,也可以直接运行:

npx nanollm

注意:npm 发布包不会包含作者本地的 config.yaml,需要你自己准备配置文件。

Config Admin

提供了 http://localhost:3000/admin 的本地配置管理页。

  • 页面使用表单方式编辑常用配置项:全局设置、模型列表和 fallback 分组;server.port 仅展示当前运行值,不提供页面编辑。
  • 常见使用方式是:先在 /admin 中新增或修改模型,再调整 fallback 分组成员顺序,最后点击“保存并应用”立即生效。
  • 页面内提供跳转到 /status/record 的快捷入口,方便保存后继续查看当前模型状态和最近请求记录。
  • 如果只是想放弃当前改动,可以点击“撤销未保存修改”;如果配置文件已被外部改动,可以点击“从服务端刷新”重新加载最新内容。
  • 点击保存后会先把表单数据转换成 YAML、校验配置,再原子写回配置文件。
  • modelsfallbackserver.ttfb_timeoutrecord.max_size 会立即热更新到新请求。
  • server.port 会写回文件,但需要重启进程后才会真正生效。
  • 已有模型上未在表单中展开的高级字段会在保存时自动保留。
  • 如果你在外部手动修改 config.yaml,服务也会自动检测并加载新配置;若新内容非法,则继续保留上一份有效配置并在管理页显示错误。

注意:/admin/config 设计目标是本机单用户管理,不建议暴露到局域网或公网。

Monitor

提供了http://localhost:3000/status的监控页面,可以查看模型健康状态。

提供了http://localhost:3000/record的采样记录页面,可以查看请求记录,对debug非常有用(默认只保留最新10次请求,可通过record.max_size配置修改)。

上述数据都只存在内存中,进程结束即消失,作为一个超轻量工具,没有任何持久化存储。