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

@sembl/provider-openai

v0.5.0

Published

OpenAI provider for SEMBL, using structured outputs.

Readme

@sembl/provider-openai

OpenAI provider for SEMBL. Structured output uses response_format: json_schema in strict mode, so the model's reply is shape-checked by the API rather than parsed out of prose.

Install

pnpm add @sembl/core @sembl/provider-openai openai

openai is a peer dependency: the host app owns the version and, usually, the client instance.

Usage

import { sembl, SemblConfig } from "@sembl/core";
import { OpenAIProvider } from "@sembl/provider-openai";

SemblConfig.configure({
  provider: new OpenAIProvider({ model: "gpt-4o", apiKey }),
  bundle,
});

Options

| Option | Default | Notes | | ------------- | -------------------- | ------------------------------------------------- | | model | — | Required. | | apiKey | OPENAI_API_KEY | Falls back to the SDK's own env lookup. | | baseURL | OpenAI production | Point at a gateway or compatible endpoint. | | temperature | not sent | Sent only when set; reasoning models reject it. | | maxTokens | SDK default | | | maxRetries | SDK default (2) | Retries are the SDK's own; this configures them. | | timeoutMs | 120000 | Per attempt. Worst case is roughly this × (maxRetries + 1), plus backoff. |

Errors

Failures surface as OpenAIProviderError with a kind you can branch on instead of matching message text:

| kind | Meaning | retryable | | ------------- | --------------------------------------------------------------- | ----------- | | api | Transport or API failure — rate limit, server error, timeout. | per SDK | | truncated | Output hit the token cap mid-answer (finish_reason: "length"). | no | | no_output | A refusal, or content that wasn't usable JSON. | no |

Schema dialect

This provider emits the "openai-strict" dialect: every property appears in required and optional fields become anyOf: [T, null], as structured outputs demand. FieldConstraints are deliberately not emitted into the schema — strict mode rejects a request outright if it carries a keyword it doesn't support, so bounds are enforced through the prompt and SEMBL's validator instead. See CONSTRAINT_KEYWORDS in @sembl/core for what would need verifying to loosen that.

Caching

OpenAI caches long prompt prefixes automatically; there is nothing to turn on. When it reports a hit, usage.cacheReadTokens carries it. Note that OpenAI counts cached tokens inside promptTokens (Anthropic reports them alongside), so don't add the two together.