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

@haxitag/yueli-kgm-computing

v0.2.0

Published

Yueli KGM: OpenAI/Anthropic-compatible gateway, native engine, Playground; docs on haxitag.com

Downloads

877

Readme

Yueli KGM Computing

@haxitag/yueli-kgm-computing — 阅粒 KGM(Knowledge Graph & Model runtime):自托管的 OpenAI / Anthropic 兼容网关与编排层,内建 进程内 Native 推理受管模型控制面;支持 kgm 扩展(工具、图谱信号、检索、观测等)。

  • 环境:Node 20.x(与 package.jsonengines 一致)
  • 官方文档(能力说明、部署、API、Playground 等):阅粒知识计算引擎 — HaxiTAG
  • 使用指南(企业场景、落地与 Q&A 等):Yueli KGM Engine 使用指南
  • npm 包内容dist/(运行时代码)+ playground/(Web Playground 静态资源)+ 本 README再内置仓库中的大量 docs/*.md,以减小包体;完整文档以官网为准
  • 生产加固(可选)KGM_HTTP_API_KEYAuthorization: BearerX-API-Key);KGM_HTTP_AUTH_EXEMPT 逗号路径前缀,默认只豁免 /health(若开启 API Key 且需本机 Playground,可加入 /api 等前缀);KGM_HTTP_RATE_LIMIT_MAX + KGM_HTTP_RATE_LIMIT_WINDOW_MSMAX=0 表示不限流)
  • OpenAPI 3.1GET /openapi.json(主规范同 src/openapi/kgmOpenApiV1Spec.ts
  • 检索三阶段kgm.retrieval.strategy=hybrid(BM25+向量)、kgm.retrieval.rerank=embed(双塔成对编码)或 rerank=http + KGM_RERANK_HTTP_URL
  • 图与多模态
    • 图:POST /v1/kgm/graph/communitiesreason/expandreason/rules
    • 多模态:POST /v1/kgm/multimodal/embed:KGM 将请求转发到由环境变量指定的上游图像向量服务
      • 必填:KGM_MULTIMODAL_BASE_URL
      • 常用:KGM_MULTIMODAL_PATH(默认 "/v1/embeddings")、KGM_MULTIMODAL_MODEL(默认 "clip")、KGM_MULTIMODAL_KEYKGM_MULTIMODAL_TIMEOUT_MS(默认 120000
      • KGM_MULTIMODAL_JSON_TEMPLATE=1:对上游发 { model, image, mime, text? };否则默认 { model, input: [dataUrl] }

快速开始(带 Playground)

mkdir kgm-host && cd kgm-host
npm init -y
npm install @haxitag/yueli-kgm-computing@latest

export PORT=3000
export KGM_LLM_BASE_URL="https://api.openai.com/v1"
export KGM_LLM_API_KEY="sk-..."
export KGM_LLM_MODEL="gpt-4o-mini"
export KGM_LLM_MODE="chat"
export KGM_LLM_PATH="/chat/completions"

node ./node_modules/@haxitag/yueli-kgm-computing/dist/server/enhancedStart.js

浏览器访问:http://localhost:3000/(Playground),http://localhost:3000/metrics(Prometheus 文本指标)。

OpenAI 兼容最小请求示例:

curl -sS "http://127.0.0.1:3000/v1/chat/completions" \
  -H "content-type: application/json" \
  -d '{
    "model": "auto",
    "messages": [
      { "role": "user", "content": "用一句话说明 KGM 是什么" }
    ]
  }'

两种集成方式

A. 独立服务(HTTP,适合多语言 / 多微服务)

在别处部署 KGM 进程,业务侧只调 HTTP:/v1/chat/completions/v1/responses/v1/messages,以及管理面 /v1/kgm/* 等。入口脚本可选:

  • dist/server/enhancedStart.js:含 Playground 与相关路由
  • dist/server/start.js:偏 纯 API(无内置 Playground 静态页)

B. 进程内集成(Node,适合单体或自建网关)

import { createRuntime, createKgmServer } from "@haxitag/yueli-kgm-computing";

const runtime = createRuntime({});
const server = createKgmServer({
  scheduler: runtime.scheduler,
  contextBuilder: runtime.contextBuilder,
  llmClient: runtime.llmClient,
  schemaRegistry: runtime.schemaRegistry,
  toolRegistry: runtime.toolRegistry,
  memoryStore: runtime.memoryStore,
  graphStore: runtime.graphStore,
  embedder: runtime.embedder,
  sandboxManager: runtime.sandboxManager,
  modelManager: runtime.modelManager,
  autoRoutingClient: runtime.autoRoutingClient,
  configStore: runtime.configStore,
  skillRuntime: runtime.skillRuntime,
  artifactStore: runtime.artifactStore,
  sessionStore: runtime.sessionStore
});

server.listen(process.env.PORT || 3000);

更细的实战步骤与排错仍以官网文档为准。


从源码开发本仓库

git clone <你的仓库> && cd <仓库目录>
npm install
npm run build
npm run dev:enhanced

版本说明 0.1.9

实现内容

| 模型系列 | 文件 | 支持型号 | 状态 | |---------|------|---------|------| | Qwen 3.5/3.6 | src/native/gpu/qwen3.ts | 7B/14B/32B/72B | ✅ | | GLM 5.0/5.1 | src/native/gpu/glm5.ts | 9B/32B | ✅ | | Google Gemma 4 | src/native/gpu/gemma4.ts | 2B/4B/9B/27B | ✅ | | MiniMax 2.5/2.7 | src/native/gpu/minimax25.ts | 4B/8B/32B/456B | ✅ | | MiMo 2.5 | src/native/gpu/mimo25.ts | 1.5B/7B/13B/30B | ✅ | | vMLX (Apple Silicon) | src/native/gpu/vmlxAdapter.ts | M1/M2/M3/M4 | ✅ |

运行测试

npm run test:native-gpu-models

结果: 63 测试通过,0 失败

主要功能

  • 权重别名映射: 支持 Hugging Face 格式 → 本地 GPU 格式
  • 内存估算: 支持多种量化格式 (Q4_0, Q8_0, F16 等)
  • 统一接口: getModelConfig(), estimateModelMemory()
  • 模型注册表: MODEL_REGISTRY 包含所有支持模型
  • 特色功能:
    • Qwen: 滑动窗口、Yarn RoPE
    • GLM: Prefix Attention、MQA/GQA
    • Gemma: GeGLU、嵌入归一化
    • MiniMax: 400K 上下文、KV 压缩
    • MiMo: 端侧量化、推荐 batch size
    • vMLX (Apple MLX): 统一内存、Metal 加速、前缀缓存、连续批处理