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-openai

v1.0.1

Published

Official OpenAI Responses and Chat Completions SDK adapter for PurrA

Readme

purra-openai · TypeScript

English | 简体中文

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

安装

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

配置

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

import { Agent, type ModelCapabilitySnapshot } from "purra";
import { OpenAIResponsesGateway } from "purra-openai";

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

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

| 网关 | API | 模型参数 | | --- | --- | --- | | OpenAIResponsesGateway | Responses | reasoning | | OpenAIChatCompletionsGateway | Chat Completions | reasoningEffort、temperature、topP |

两个网关均接受 model、capabilities、client 和 timeoutMs。 使用 Chat Completions 时,导入 OpenAIChatCompletionsGateway 并使用这些参数构造。 模型参数应按所选模型支持的能力设置。

行为

Core 计算输出上限,网关将其应用到对应 API。SDK 自动重试已关闭,重试和预算核算由 Core 控制。 服务端响应存储已关闭。

Responses 的推理续接信息保存在私有消息数据中,恢复时应与对话一同保留。 有工具可用时采用自动工具选择。不支持图片、音频及服务端托管工具,其他厂商由应用提供适配。