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

dsh-cost-optimizer

v0.1.0

Published

DSH plugin: smart model routing by task complexity — simple tasks use cheap models, hard tasks use powerful ones. Tracks spending and enforces budgets.

Readme

dsh-cost-optimizer

DSH 插件:按任务复杂度自动选模型 — 简单问题用便宜的,难题用贵的。跟踪花费,守住预算。

原理

每次 agent/request:
  分析当前上下文复杂度(消息长度、工具调用次数、是否含图片)
    ├── simple(短对话、无工具)   → Flash(快且便宜)
    ├── moderate(中等复杂度)     → Standard
    └── complex(长上下文、多工具) → Pro(贵但强)

配置

- insert:
    - id: cost-optimizer
      name: dsh-cost-optimizer
      config:
        tiers:
          fast:
            provider: deepseek
            model: deepseek-v4-flash
            costPer1kInput: 0.0001
            costPer1kOutput: 0.0004
          standard:
            provider: deepseek
            model: deepseek-v4
            costPer1kInput: 0.0005
            costPer1kOutput: 0.002
          powerful:
            provider: deepseek
            model: deepseek-v4-pro
            costPer1kInput: 0.002
            costPer1kOutput: 0.008
        complexityThresholds:
          fastMaxTokens: 2000
          powerfulMinTokens: 8000
          powerfulMinTools: 5
        budget:
          sessionLimit: 0.5     # 单次会话最多花 $0.5
          dailyLimit: 5.0       # 每天最多 $5
          currency: USD
        verbose: false

工具

| 工具 | 功能 | |------|------| | cost_report | 查看当前花费和预算余量 |

效果示例

User: "hello"
  → [simple] Flash ($0.0001)

User: "帮我重构这个 500 行的文件,注意保持接口兼容"
  → [complex] Pro ($0.008)

User: "这个函数是干嘛的?"
  → [simple] Flash ($0.0001)

与 dsh-llm-vision-router 的关系

  • vision-router:检测图片 → 切视觉模型(跨 provider)
  • cost-optimizer:检测复杂度 → 同 provider 内选档位

两者可以叠加:cost-optimizer 先选档位,vision-router 再检测图片覆盖。

License

MIT