@nicknisi/pi-fast0.3.2
Toggle faster premium inference for supported Claude and Codex models
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
@nicknisi/pi-fast
Toggle the premium low-latency inference modes exposed by Anthropic and OpenAI without leaving Pi or maintaining provider-specific request patches. The extension adds /fast, injects the supported provider setting into outgoing requests, and shows a compact fast footer status only when the current model can actually use it.
Fast mode trades higher usage cost for faster output. It does not change the selected model, its intelligence, or its capabilities.
What it adds
- Command:
/fast— toggle Fast mode for the current Pi session. - Footer status:
fastwhile Fast mode is enabled and the selected model is eligible,fast (cooldown)while a rate limit has dropped it to standard speed. Disable it withshowStatus. - Provider request hooks:
- Anthropic: adds
speed: "fast"to Messages API payloads. For the research-preview models (Opus 5 and Opus 4.8) it also appends thefast-mode-2026-02-01beta to the payload'sbetas, keeping every beta pi computed.
- Anthropic: adds
- Rate-limit fallback: a Fast-mode
429/529switches the session to standard speed for 60 seconds, so pi's automatic retry resends at standard speed.- OpenAI Codex: adds
service_tier: "fast"to OAuth-backed Codex Responses payloads.
- OpenAI Codex: adds
- Subagents and workflows: children spawned by
dispatch,workflow, and other@nicknisi/pi-sharedruntime users follow this session's Fast mode live and share its rate-limit cooldown. - Config: a global default plus an optional trusted project override.
No tools, keybindings, widgets, overlays, or custom message/entry types.
Install
From npm after the package is published:
pi install npm:@nicknisi/pi-fast
From a local checkout:
pi install ~/Developer/pi-extensions/packages/fast
Usage
Run the command with no arguments:
/fast
Each invocation toggles a session override:
- If Fast mode is currently off,
/fastturns it on for the session. - If Fast mode is currently on,
/fastturns it off for the session. - The notification reports whether the current model is active or why it is ineligible.
- Starting, resuming, forking, or reloading a session resets the override to the configured default.
Arguments are intentionally not accepted. Use /fast, not /fast on or /fast status.
Supported providers and models
Support is intentionally explicit so the extension does not send premium-tier fields to models whose APIs reject or ignore them.
| Provider | Required Pi API | Supported model IDs | Injected request setting |
|---|---|---|---|
anthropic |
anthropic-messages |
claude-opus-5-5, claude-opus-5, claude-opus-4-8 |
speed: "fast" |
openai-codex |
openai-codex-responses |
gpt-5.4, gpt-5.5, gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-6-astra, gpt-6-luna, gpt-6-sol, gpt-6.1-sol |
service_tier: "fast" |
OpenAI Codex eligibility also requires ChatGPT OAuth (/login in Pi). API-key-backed openai models use a different provider and are not modified by this extension.
Anthropic Fast mode on Claude Opus 5.5 is generally available on the first-party Claude API: no beta header or access request, with a default Fast-mode rate limit in the Start, Build, and Scale usage tiers. On Opus 5 and Opus 4.8 it is a research preview that must be enabled for the account; without access, the API answers Fast requests with 429. It is not available on Amazon Bedrock, Google Cloud, or Claude Platform on AWS.
Claude Opus 4.6 and 4.7 are deliberately excluded. Anthropic no longer offers Fast mode on those models: 4.6 silently runs at standard speed, while 4.7 rejects speed: "fast".
Configuration
Copy the example for a global default:
mkdir -p ~/.pi/agent/configs
cp fast.example.json ~/.pi/agent/configs/fast.json
Default config:
{
"enabled": false,
"showStatus": true
}
| Field | Type | Default | Description |
|---|---|---|---|
enabled |
boolean |
false |
Fast-mode state at session start, before a /fast session override. |
showStatus |
boolean |
true |
Show fast in Pi's footer while Fast mode is enabled and the selected model is eligible. |
Config precedence, from lowest to highest:
- Built-in defaults.
- Global config:
<agentDir>/configs/fast.json(normally~/.pi/agent/configs/fast.json; honorsPI_CODING_AGENT_DIR). - Trusted project config: the nearest
.pi/configs/fast.jsonfound while walking fromctx.cwdtoward the filesystem root. - The in-memory
/fastoverride for the current session.
Project config is ignored unless ctx.isProjectTrusted() is true. Config is reloaded on session_start; run /reload or start another session after editing it. Malformed JSON or non-boolean known fields produce a warning and fall back to the lower-precedence value. Unknown fields are ignored.
A project override can contain only the value it needs to change:
{
"enabled": true
}
Request behavior
The extension is conservative about request mutation:
- It checks the active provider, API, model ID, and—on Codex—OAuth auth.
- It verifies that the provider payload's
modelexactly matches Pi's selected model. - It returns a complete cloned payload with the added fields; Pi's
before_provider_requesthook treats returned values as full replacements. - If a payload already contains
speedorservice_tier, that explicit value wins and the extension leaves the payload unchanged.
For Anthropic, pi puts its betas in the payload's betas array, and the SDK turns that array into the anthropic-beta header. The extension appends the Fast beta to that array rather than setting the header: any anthropic-beta header an extension sets replaces pi's computed list, which would drop betas pi needs (such as the mid-conversation effort betas on Opus 5).
Cost and performance caveats
- Higher cost or credit use. Fast mode is a premium service tier. Review the linked provider pricing before enabling it by default.
- Anthropic prompt caches are speed-specific. Switching between standard and Fast mode causes a prompt-cache miss because the two speeds do not share cached prefixes.
- Anthropic capacity is separate. Fast mode has dedicated rate limits and may return
429or529. The extension then uses standard speed for 60 seconds (failed requests don't exposeretry-after) and relies on pi's automatic retry (retry.enabled, on by default) to resend the failed request. - Codex credit multipliers vary by model. OpenAI currently documents 2.5× ChatGPT credit use for GPT-5.5/5.6 and 2× for GPT-5.4. API Priority/Fast processing has separate token pricing.
- Faster output is not lower time-to-first-token. Anthropic describes the gain as output tokens per second; OpenAI's Codex documentation describes a supported-model speed increase.
- Model support changes. The allowlists match the provider documentation and Pi catalog at release time. A newly released model remains ineligible until this package is updated deliberately.
Provider documentation:
Dependencies
@earendil-works/pi-coding-agent(peer,*) — extension hooks, model/auth context, config directory helpers, slash commands, notifications, and footer status.Node built-ins:
node:fsandnode:pathfor config loading.@nicknisi/pi-shared(workspace:*) —childExtensions(), the registry that loads Fast mode's request hook into subagent children.
Caveats
- Provider payload fields and beta headers are provider-specific wire contracts. Pi exposes the interception hooks, but a provider can change its accepted values independently of Pi.
- The extension relies on
before_provider_requestreplacing the entire payload when it returns a value, on pi sending Anthropic betas through the payload'sbetasarray, and onmessage_endcarrying the provider error for failed requests. /fastis session-local and is not persisted. Setenabledin config for a persistent default.- Children follow the most recently started session in the process. With one pi session per process (the normal CLI case) that's always the right one; an SDK host running several sessions in one process shares a single child hook.
- The footer confirms that the extension considers Fast mode active; it does not inspect the provider response's reported tier/speed. Provider-side downgrade, missing preview entitlement, capacity errors, and billing remain authoritative.
Development
From the repository root:
pnpm vitest run packages/fast
pnpm typecheck
pnpm lint
pnpm format:check
pnpm build
Smoke-test extension loading with a scratch agent directory:
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
PI_CODING_AGENT_DIR="$tmp" pi --no-extensions -e packages/fast/index.ts --list-models