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-long-context

v0.6.0

Published

Toggle OpenAI GPT-5.6 and GPT-6 models between pi's 272K context window and 1.05M tokens.

Readme

pi-openai-long-context

Raise GPT-5.6 and GPT-6 models from pi's 272K context window to 1.05M.

It is off until you ask for it, because it costs more.

https://github.com/user-attachments/assets/689360eb-6e11-47a2-930c-c6741ec232c6

Install

pi install npm:pi-openai-long-context

Restart pi, or run /reload.

Turn it on for one task

/long-context

Run it again to turn it off. A ⚠ in the footer means it is on. The command only shows up in the / menu when you are on a supported model.

Turn it on for good

Create/edit ~/.pi/agent/openai-long-context.json (or the same file in your PI_CODING_AGENT_DIR):

{
  "autoEnable": true,
  "autoEnableSubagents": true
}

| Flag | Turns long context on for | | --- | --- | | autoEnable | Your own pi sessions, and foreground children running inside them | | autoEnableSubagents | pi-subagents children in background runner processes |

Use one, the other, or both — they are independent. The split is by process, not by foreground or background: a child gets whichever flag applies to the process it runs in. Only the literal true counts; anything else (missing file, false, "true", broken JSON) leaves that side off. pi never writes this file for you.

Opted-in sessions turn long context on at startup and again whenever you pick a supported model. /long-context still wins for the model you are on, until the next model switch or session.

To opt out, flip the flag to false or delete the file. The file is read when a session starts, so a running session keeps auto-arming until you /reload it (or start, resume, or fork one).

It turns itself off

Without the config above, long context never outlives the moment: switching models, a new session, restarting pi, /reload — all of it drops you back to 272K, so you cannot leave it on and be billed for it a week later. Nothing is written to your settings.

Compaction is the exception: it keeps the big window, which is the whole point of turning it on. And if turning it off would immediately trigger automatic compaction, pi asks whether to compact or keep long context instead.

What it costs

Past 272K input tokens, OpenAI bills the whole request at its long-context rate — see OpenAI's pricing. On a subscription, it burns through your quota faster too. That applies to every subagent child as well, and there can be a lot of those.

Supported models and providers

gpt-5.6-* and gpt-6-* (including namespaced IDs such as openai/gpt-5.6-*) on the openai and openai-codex providers. Other providers can be explicitly enabled with additionalProviders in openai-long-context.json; providers not listed there are left untouched.

To use an equivalent model through another provider, add its provider name to ~/.pi/agent/openai-long-context.json:

{
  "additionalProviders": ["openrouter"]
}

This applies to manual toggles, the command menu, and sessions opted in with either auto-enable flag. Only add providers whose GPT-5.6 or GPT-6 model documents a context window of at least 1.05M tokens.

1.05M is the documented maximum for GPT-5.6 and GPT-6 Astra. Future gpt-6-* models match automatically, but their real limits are not checked here; look up a new model's context window before trusting it.

If you set your own context window for a supported model in models.json, turning this off restores your value, not pi's.

Subagent details

Which children this reaches, and what to do when it misses one.

Nothing per launch is needed: no flag, no /long-context, no extensionBindings. An opted-in child raises its window at startup if the extension is loaded and its model is supported.

autoEnableSubagents keys off PI_SUBAGENT_CHILD=1, which marks the runner process, not one child's execution mode. So it also covers nested foreground children (async: false) running in that process. A foreground child started directly inside your own pi process has no marker, so it follows autoEnable like your session does.

Background children discover installed extensions on their own; foreground children need an explicit path. If a child does not pick this up, add this extension's index.ts to the agent's extensions or subagentOnlyExtensions. Extension-denying policies still apply.

Each child gets its own window. One child turning it off, switching models, or shutting down never touches its siblings.

License

MIT