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

@fevex/openai

v0.1.0-alpha.1

Published

OpenAI ModelGateway adapter for Fevex.

Readme

@fevex/openai

Official OpenAI ModelGateway adapter for Fevex.

npm install @fevex/core @fevex/openai
import { createOpenAI } from '@fevex/openai';

const model = createOpenAI({
  apiKey: process.env.OPENAI_API_KEY!,
  organization: process.env.OPENAI_ORG_ID,
  project: process.env.OPENAI_PROJECT_ID,
  schemaPolicy: 'strict',
})('gpt-5.6');

The adapter uses native fetch and implements only the Fevex model contract. Runtime behavior such as tool execution, validation, events and retries belongs to @fevex/core. Returned gateways include metadata: { provider: "openai", model: modelId } for traces, eval cost calculators and OpenTelemetry export.

Text, tools and continuation

Without outputSchema, OpenAI text is returned as the exact string supplied by the Responses API, even when it looks like JSON. With outputSchema, the adapter requires valid JSON before Fevex performs local schema validation. Refusals, incomplete responses and malformed function calls fail explicitly.

During tool loops the adapter stores the original response items, including reasoning items required by Responses API, in opaque providerState. Fevex returns that state to the next model step automatically. Direct ModelGateway consumers must do the same; the state is run-local and must not be inspected. The adapter's stateCodec lets Fevex persist it only inside a private durable checkpoint.

Core reasoning efforts are forwarded to reasoning.effort; provider-default leaves provider options untouched. Model-specific effort support remains an OpenAI capability and an unsupported value is reported by the API. Provider-only settings can be supplied through modelOptions.reasoning.

The adapter always uses the Responses streaming API. It emits only response.output_text.delta as visible output and builds the terminal result from response.completed; reasoning and partial function arguments remain private.

Tool names and schemaName must match [A-Za-z0-9_-]{1,64}. Fevex-owned fields such as model, input, tools, tool choice, schema format, parallel calls and output caps override conflicting modelOptions. Background provider jobs and built-in tools remain outside this gateway.

Schema policy

schemaPolicy defaults to "strict". Before sending a request, the adapter checks tool inputs and final outputs against OpenAI's documented Structured Outputs subset. Every schema must have an object root; every object must require all its properties and set additionalProperties: false. Unsupported keywords and documented size limits throw OpenAIError with code: "PROVIDER_SCHEMA_UNSUPPORTED" before fetch runs.

Set schemaPolicy: "best-effort" to send tools with strict: false. Object outputs use JSON mode and other JSON values use a schema instruction. Fevex still validates the returned value locally, but OpenAI does not guarantee schema adherence in this mode, so the caller may need to retry an invalid result.

| Policy | Tool input | Final output | | --- | --- | --- | | strict | OpenAI strict function schema | Structured Outputs | | best-effort | Non-strict function schema | JSON mode or JSON instruction |