pi-openai-speed0.1.0
Session-scoped Fast and Ultrafast requests for Pi's native OpenAI provider, gated by the ChatGPT account's advertised model tiers.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
Pi OpenAI Speed
An account-aware /speed command for Pi’s native OpenAI Responses provider. Request Fast or Ultrafast without changing your model, reasoning effort, sign-in, or transport. Tested with Pi 1.7.0 and Node.js 22.
This independent extension is not affiliated with OpenAI or Pi. It does not support the legacy openai-codex provider, Codex CLI, other providers, or OpenAI-compatible proxies.
Install or try it
Install the tagged source release:
pi install git:github.com/nobadwordss/pi-openai-speed@v0.1.0
Once the package is available on npm, use pi install npm:pi-openai-speed. From a local checkout, load just the speed extension for one invocation:
pi --offline --no-extensions -e "$PWD"
--offline skips automatic Pi startup requests; it is not a network sandbox. Checking available speeds or sending a prompt can still contact OpenAI.
Choose a speed
- Select a model from
openai. If you use Sign in with ChatGPT, open/speedand choose Check available speeds. Opening or closing the picker does not query the account. The check uses your existing Pi login for oneGET https://api.openai.com/v1/modelsrequest and does not generate a response. - Choose Fast or Ultrafast if shown for the current model. A check always resets the selection to Standard. Even a successful check does not restore a previous premium selection automatically.
- Use
/speed statusto inspect the selection and observed tier. Use/speed standardto stop the extension from adding a tier. Premium requests may increase charges or plan usage, including background requests.
| Command | Behavior |
|---|---|
/speed |
Pick a speed or check the account’s advertised options. |
/speed standard |
Leave the request unchanged. This does not force service_tier: "default". |
/speed fast |
Add service_tier: "priority" if supported and the request has no tier. |
/speed ultrafast |
Add service_tier: "ultrafast" if supported and the request has no tier. |
/speed status |
Show the selection, latest payload-hook decision, and latest tier reported by the server. No network request. |
The choice is session-local. /reload in the same live session retains a verified choice and list in memory when the OpenAI route and authentication scope still pass the checks. Reload sends no catalog request and clears request observations. Starting, resuming, or forking a session starts at Standard. Switching models retains the choice but only applies it on an eligible model; Ultrafast does not silently fall back to Fast. A detected change in authentication kind or source, or a loss of authentication, discards the checked list and resets the selection. Switching between two ChatGPT accounts of the same authentication type or changing plans is not detected: select Standard before the change, then check again. Failed or unreadable checks never grant premium options. A valid empty list means the model advertised no extra speeds.
For a native API key, the extension uses a local compatibility list for GPT‑6.2 Sol and Astra rather than querying an account catalog. This is not a promise of API entitlement. In a fresh API-key session, the direct Fast and Ultrafast commands can check local eligibility without opening the picker.
What the status means
Speed: Fast selected | last payload hook: priority inserted | last reported tier: default
- Selected is your preference. If another extension or the caller already provided a tier, it is preserved. A conflict is shown as, for example,
flex preserved (not replaced by priority). - Payload hook is what this extension saw or changed at its hook, not a capture of the final HTTP request. Later hooks can change the payload again.
- Reported tier is the latest value observed in a matching model’s completion event, including
default.unknownmeans a completion had no usable tier;not observedmeans no completion was observed. The two observations are not paired by request ID and may include cache warming or other background requests. Neither confirms faster processing or billing.
Scope and data handling
- The OAuth check uses Pi’s resolved OAuth bearer for the fixed public OpenAI
/v1/modelsendpoint. There is no redirect, retry, separate login, or API-key fallback. Pi itself may refresh a credential while resolving authentication. The extension does not store credentials, raw catalogs, prompts, or diagnostics on disk and has no telemetry or runtime dependencies. - An eligible catalog entry must match the exact model slug, be visible, not be marked API-unsupported, and list the recognized tier in
service_tiers. Duplicate, malformed, and legacy-only entries do not grant premium options. There is no startup lookup or persistent catalog cache. - The payload hook checks the selected native
openairoute and the shape and model of the streaming Responses body. It skips ambiguous same-ID routes, re-registeredopenaiproviders, and conflicting OAuth account headers. Pi 1.7.0’s hook does not expose final request credentials or destination; the check does not bind the catalog lookup to every later POST. See Pi’s hook documentation.
Development and distribution
The pi-openai-speed package manifest exposes only /speed. Run npm pack --dry-run to inspect the archive. Tests are available from source but are not part of the npm package. The pi-package keyword makes a published npm package eligible for discovery on Pi Packages.
Run npm test for the unit tests, which use synthetic catalog data. The Pi integration tests exercise the real provider with fake credentials and mock HTTP/SSE, including the serialized POST. On Linux with a managed Pi 1.7.0 installation, run them in an isolated home and network namespace:
env -i /usr/bin/bwrap --unshare-net --unshare-pid --die-with-parent --new-session \
--ro-bind /usr /usr --symlink usr/lib64 /lib64 --symlink usr/lib /lib --symlink usr/bin /bin \
--dev /dev --proc /proc --tmpfs /tmp --dir /home/test \
--ro-bind "$(readlink -f "$(command -v node)")" /node --ro-bind "$PWD" /work \
--ro-bind "$HOME/.pi/agent/install/releases/1.7.0/node_modules" /pi/node_modules \
--chdir /work --setenv PATH /usr/bin:/bin --setenv HOME /home/test --setenv PI_OFFLINE 1 \
--setenv PI_AGENT_PACKAGE_DIR /pi/node_modules/@earendil-works/pi-coding-agent \
/node --test tests/speed.test.mjs tests/speed.pi.test.mjs
The design was informed by pi-fast and @buyong/pi-codex-fast-mode. No code from either project was copied.
License
MIT.