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

purra-anthropic

v1.0.1

Published

Official Anthropic Messages SDK adapter for PurrA

Readme

purra-anthropic · TypeScript

English | 简体中文

使用官方 SDK 将 Anthropic Messages 接入 PurrA,支持文本、函数工具、流式输出、取消和 Token 用量。 要求 Node.js 22+(ESM)。

安装

按照源码安装说明操作,选择 integrations/anthropic/typescript。

配置

传入所选模型 ID 和已核实的模型能力快照:

import { Agent, type ModelCapabilitySnapshot } from "purra";
import { AnthropicMessagesGateway } from "purra-anthropic";

function createAgent(model: string, capabilities: ModelCapabilitySnapshot) {
  const gateway = new AnthropicMessagesGateway({
    model,
    capabilities,
    timeoutMs: 60_000,
  });
  return new Agent({ model: gateway });
}

通过 client 传入 SDK 客户端,可自定义凭据与传输配置。 省略时,网关使用 SDK 的环境配置创建客户端。

模型参数

构造函数接受 thinking、outputConfig、temperature、topP 和 topK。 根据所选模型支持的能力设置参数。例如,thinking: { type: "adaptive" } 要求模型支持自适应 thinking。手动推理预算必须是至少 1024 的整数,且小于 Core 确定的输出上限。

行为

SDK 自动重试已关闭,重试与预算核算由 Core 控制。网关使用 Core 确定的输出上限, 将 system/developer 指令合并到 system 字段,有工具可用时采用自动工具选择。

带签名的 thinking 和 redacted 块保留为私有续接数据。使用同一模型继续对话时, 应与未改动的 assistant 消息一同保留;它们不会进入公开输出。输入用量包括缓存写入和读取。

不支持多模态内容、服务端托管工具和 beta API。其他厂商由应用提供适配。