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

pi-openai-service-tier

v0.1.4

Published

Cost-correct OpenAI service tier / fast mode extension for pi

Readme

pi-openai-service-tier

CI GitHub release License: MIT

Cost-correct OpenAI service tier / fast mode for pi.

Most fast-mode extensions only patch the outgoing JSON payload:

{ service_tier: "priority" }

That can route the request correctly, but Pi's displayed cost accounting uses its internal provider option named serviceTier. This extension wraps Pi's built-in OpenAI provider calls and passes:

{ ...options, serviceTier: "priority" }

So Pi gets both the OpenAI request field and the matching Pi-side service-tier cost multiplier.

Features

  • /fast toggles cost-correct priority tier.
  • /openai-tier selects priority, flex, default, auto, or scale.
  • Works with Pi's OpenAI Responses and OpenAI Codex Responses providers.
  • Avoids sending tiers that a provider does not support.
  • Includes gpt-5.4 and gpt-5.5 OpenAI/Codex models by default.
  • Does not change model, reasoning level, prompts, tools, or text.verbosity.
  • Does not make network calls of its own.
  • Stores simple JSON config with project-over-global precedence.

Install

pi install npm:pi-openai-service-tier

GitHub install also works:

pi install https://github.com/anirudhmehra/pi-openai-service-tier

Then start Pi normally:

pi --provider openai-codex --model gpt-5.5

Enable priority tier at startup:

pi --provider openai-codex --model gpt-5.5 --fast

Try without installing:

pi -e npm:pi-openai-service-tier --provider openai-codex --model gpt-5.5 --fast

Commands

Fast mode

/fast
/fast on
/fast off
/fast status

/fast toggles priority service tier on/off.

Explicit service tier

/openai-tier priority
/openai-tier flex
/openai-tier default
/openai-tier auto
/openai-tier scale
/openai-tier off
/openai-tier status

/openai-tier <tier> enables that tier for supported models.

Configuration

The extension uses project-over-global config:

<repo>/.pi/extensions/pi-openai-service-tier.json
~/.pi/agent/extensions/pi-openai-service-tier.json

If neither file exists, the extension creates this global default on session start:

{
  "persistState": true,
  "active": false,
  "serviceTier": "priority",
  "supportedModels": [
    "openai/gpt-5.4",
    "openai/gpt-5.5",
    "openai-codex/gpt-5.4",
    "openai-codex/gpt-5.5"
  ]
}

Config fields

| Field | Type | Default | Description | | --- | --- | --- | --- | | persistState | boolean | true | Whether /fast and /openai-tier persist state across sessions. | | active | boolean | false | Whether a service tier is active. | | serviceTier | priority | flex | default | auto | scale | priority | Service tier passed to Pi's OpenAI provider option when supported by the current provider. | | supportedModels | string[] | see above | Allow-list of provider/model-id pairs that should receive serviceTier. |

Add/remove allow-listed models by editing supportedModels.

Supported providers/APIs

The extension applies tiers only when all of these are true:

  1. the model appears in supportedModels,
  2. the model uses one of these Pi APIs:
    • openai-responses
    • openai-codex-responses, and
  3. the selected tier is supported by that API.

Provider-specific tier support:

| Pi API | Supported tiers | | --- | --- | | openai-responses | priority, flex, default, auto, scale | | openai-codex-responses | priority |

If a tier is configured but unsupported by the current model/provider, the extension leaves serviceTier unset for that request instead of sending an invalid value.

Compatibility notes

This extension overrides Pi's API stream handlers for:

  • openai-responses
  • openai-codex-responses

It delegates back to Pi's built-in OpenAI implementations, adding serviceTier only for configured/supported OpenAI models. If another extension also overrides those API handlers, whichever extension loads last wins.

Requires Pi / @mariozechner/pi-ai >=0.72.1 and Node.js >=22.

Updating

For npm installs:

pi update npm:pi-openai-service-tier

For git installs, re-run:

pi install https://github.com/anirudhmehra/pi-openai-service-tier

Uninstall

pi remove npm:pi-openai-service-tier

or, if installed from git:

pi remove https://github.com/anirudhmehra/pi-openai-service-tier

If desired, remove config files manually:

rm -f ~/.pi/agent/extensions/pi-openai-service-tier.json
rm -f .pi/extensions/pi-openai-service-tier.json

Development

git clone https://github.com/anirudhmehra/pi-openai-service-tier.git
cd pi-openai-service-tier
npm install
npm run check

Local Pi smoke test:

pi -e ./index.ts --list-models
pi -e ./index.ts --provider openai-codex --model gpt-5.5 --fast

Security

Pi extensions run with your local user permissions. This extension only reads/writes its config JSON files and delegates LLM calls to Pi's built-in OpenAI providers; it does not perform independent network requests.

License

MIT