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

@journal.one/llm-economy-proxy

v0.3.0

Published

LLM providers charge less for non-interactive work, but the discounted paths differ by provider. OpenAI offers a synchronous **Flex** processing tier (~50% off standard) that you select with one request parameter. Anthropic's **Message Batches** API is al

Readme

LLM Economy Proxy

LLM providers charge less for non-interactive work, but the discounted paths differ by provider. OpenAI offers a synchronous Flex processing tier (~50% off standard) that you select with one request parameter. Anthropic's Message Batches API is also ~50% off but harder to use: you upload jobs, poll for completion, download results, and match responses back to requests.

This library lets you keep using familiar non-streaming OpenAI and Anthropic API shapes while it routes eligible requests through each provider's cheapest non-interactive path behind the scenes — OpenAI Flex and Anthropic Message Batches.

Use it for non-interactive work where lower cost is more important than peak latency: summarization jobs, classification, evaluations, data enrichment, code review sweeps, and other background LLM workflows.

Do not use this for interactive chat, streaming, or user flows that need the fastest possible responses.

What It Provides

  • OpenAI-shaped calls: openai.responses.create(...) and openai.chat.completions.create(...).
  • Anthropic-shaped calls: anthropic.messages.create(...).
  • Discounted execution for latency-tolerant requests: OpenAI Flex (synchronous) and Anthropic Message Batches (asynchronous).
  • Optional promotion to the standard tier on timeout.
  • TypeScript and JavaScript support.
  • OpenTelemetry hooks for customer-controlled telemetry.

Latency Reality

OpenAI requests run through the synchronous Flex tier (service_tier: "flex"), retried on capacity pressure, so they return in seconds. Anthropic requests run through Message Batches, which release results together and trade minutes of latency for the discount. Local live tests, OpenAI on June 25, 2026 and Anthropic on June 24, 2026, using Journal models:

| Test | OpenAI gpt-5.5 (Flex) | Anthropic claude-opus-4-7 (Batches) | |---|---:|---:| | 100 requests submitted together | 100/100 in ~4.5s (mean 2.2s, p95 2.9s) | 100/100 in ~2m | | One request at a time | 100/100, median 1.2s, worst 24.4s (~3.3m total) | 27 succeeded in 30m cap, median 60s, worst 90s |

Use promoteOnTimeout to fall back to the standard interactive tier instead of failing if the discounted path cannot complete within timeout: for OpenAI this drops Flex for standard service; for Anthropic it sends a direct call.

Full benchmark notes: docs/benchmarks.md.

Install

pnpm add @journal.one/llm-economy-proxy

Hello World

import { createOpenAIProxy } from "@journal.one/llm-economy-proxy";

const openai = createOpenAIProxy({
  apiKey: process.env.OPENAI_API_KEY!,
  mode: "economy",

  // Retry the Flex tier for up to 30 minutes if capacity is unavailable.
  // If the timeout is reached, fall back to the standard tier for this request.
  timeout: 30 * 60_000,
  promoteOnTimeout: true,
});

const response = await openai.responses.create({
  model: "gpt-5.5",
  input: "Say hello in one short sentence.",
  max_output_tokens: 16,
});

console.log(response);

Anthropic example:

import { createAnthropicProxy } from "@journal.one/llm-economy-proxy";

const anthropic = createAnthropicProxy({
  apiKey: process.env.ANTHROPIC_API_KEY!,
  mode: "economy",
});

const message = await anthropic.messages.create({
  model: "claude-opus-4-7",
  max_tokens: 16,
  messages: [{ role: "user", content: "Say hello in one short sentence." }],
});

console.log(message);

Migrating One Call

Keep your existing OpenAI or Anthropic client for interactive paths. Move only latency-tolerant calls to the economy proxy.

Before:

export async function classifyDocument(text: string) {
  return openai.responses.create({
    model: "gpt-5.5",
    input: `Classify this document:\n\n${text}`,
    max_output_tokens: 64,
  });
}

After:

export async function classifyDocument(text: string) {
  return economyOpenai.responses.create(
    {
      model: "gpt-5.5",
      input: `Classify this document:\n\n${text}`,
      max_output_tokens: 64,
    },
    {
      timeout: 30 * 60_000,
      promoteOnTimeout: true,
    }
  );
}

With promoteOnTimeout: true, the library keeps trying the discounted path until timeout — for OpenAI, retrying the Flex tier while capacity is unavailable. If it still has not completed, it sends the same request through the standard interactive tier and returns that response.

Try It Locally

pnpm install
pnpm build

Create a local env file:

cp .env.example .env
# Add OPENAI_API_KEY and/or ANTHROPIC_API_KEY.

Run checks:

pnpm typecheck
pnpm test

Run live benchmarks:

pnpm live:benchmark
pnpm live:benchmark:serial

Benchmark results are written to ignored JSON files under live-results/.

More Docs

Package versions are tracked in package.json and published releases should be tagged as vX.Y.Z. Publish with:

./packaging/npm/publish.sh