← Catalog

@nicknisi/pi-fast

Toggle faster premium inference for supported Claude and Codex models

Package

Install

Install with PiG

pig install npm:@nicknisi/pi-fast

Install with Pi

pi install npm:@nicknisi/pi-fast
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.5.0 (README.md). PiG does not review it.

@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: fast while Fast mode is enabled and the selected model is eligible, fast (cooldown) while a rate limit has dropped it to standard speed. Disable it with showStatus.
  • 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 the fast-mode-2026-02-01 beta to the payload's betas, keeping every beta pi computed.
    • OpenAI Codex: adds service_tier: "priority" to OAuth-backed Codex Responses payloads.
  • Fast-mode pricing: Anthropic replies sent at Fast speed are recorded at 2x the standard cost, since pi prices every reply at the standard rate.
  • Rate-limit fallback: a Fast-mode 429/529 switches the session to standard speed for 60 seconds, so pi's automatic retry resends at standard speed.
  • Plan fallback: if the provider says Fast mode isn't available for a model on your plan or workspace (Codex gates GPT-6.2 Sol this way), that model uses standard speed for the rest of the session and Pi tells you to send the message again.
  • Subagents and workflows: children spawned by dispatch, workflow, and other @nicknisi/pi-shared runtime 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, /fast turns it on for the session.
  • If Fast mode is currently on, /fast turns 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.

ProviderRequired Pi APISupported model IDsInjected request setting
anthropicanthropic-messagesclaude-fable-5-2, claude-mythos-5-2, claude-opus-5-5, claude-opus-5, claude-opus-4-8speed: "fast"
openai-codexopenai-codex-responsesgpt-5.4, 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, gpt-6.1-terra, gpt-6.2-astra, gpt-6.2-solservice_tier: "priority"

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.

The Codex backend rejects service_tier: "fast" with 400 Unsupported service_tier: fast. priority is what Codex CLI sends, and OpenAI's API documents the two values as equivalent. GPT-5.5 is excluded because Codex retired it for ChatGPT sign-in on 14 October 2026.

Anthropic Fast mode on Claude Fable 5.2, Claude Mythos 5.2, and 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. On Opus 5 it is a research preview, and on Opus 4.8 it is deprecated (removed 30 November 2026); both need the beta and account access, and 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
}
FieldTypeDefaultDescription
enabledbooleanfalseFast-mode state at session start, before a /fast session override.
showStatusbooleantrueShow fast in Pi's footer while Fast mode is enabled and the selected model is eligible.

Config precedence, from lowest to highest:

  1. Built-in defaults.
  2. Global config: <agentDir>/configs/fast.json (normally ~/.pi/agent/configs/fast.json; honors PI_CODING_AGENT_DIR).
  3. Trusted project config: the nearest .pi/configs/fast.json found while walking from ctx.cwd toward the filesystem root.
  4. The in-memory /fast override 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:

  1. It checks the active provider, API, model ID, and—on Codex—OAuth auth.
  2. It verifies that the provider payload's model exactly matches Pi's selected model.
  3. It returns a complete cloned payload with the added fields; Pi's before_provider_request hook treats returned values as full replacements.
  4. If a payload already contains speed or service_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 429 or 529. The extension then uses standard speed for as long as the failed response's retry-after (or retry-after-ms) header asks, and relies on pi's automatic retry (retry.enabled, on by default) to resend the failed request, which always goes at standard speed. When pi reports no failed response (pi before 1.6.1, the Codex WebSocket transport, or an error inside an already started stream), it uses standard speed for 60 seconds.
  • Anthropic Fast costs 2x. Every supported model is billed at twice its standard rate, with prompt-caching multipliers on top. The extension doubles the recorded cost of Fast replies so footers and cost totals match.
  • Codex credit multipliers vary by model. See OpenAI's Codex Fast pricing for the current rate per model. Codex replies keep pi's standard cost estimate: the backend reports service_tier: "default" even for priority requests, so Fast use there is not reflected in recorded cost.
  • 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:fs and node:path for 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_request replacing the entire payload when it returns a value, on pi sending Anthropic betas through the payload's betas array, and on message_end carrying the provider error for failed requests and accepting a replacement message (used to record the Fast cost).
  • /fast is session-local and is not persisted. Set enabled in 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