Install
Install with PiG
pig install npm:@m4riok/pi-openai-tweaksInstall with Pi
pi install npm:@m4riok/pi-openai-tweaksPackages 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.1.5 (README.md). PiG does not review it.
pi-openai-tweaks
A simple Pi extension that gives you:
- clear OpenAI/Codex usage in your status line (
/usage) - one-command Fast mode control (
/fast) - optional preventive compaction for long agent loops (
/autocompact)
Install
From npm:
pi install npm:@m4riok/pi-openai-tweaks
What this extension provides
1) Usage status
Shows 7d usage with reset countdowns in the footer for openai, openai-codex, and numbered openai-codex-N providers. The footer is hidden on other providers. The 5h window is hidden by default.
Numeric usage requires Codex OAuth from Pi (/login openai-codex) or an existing Codex CLI ChatGPT login. If only the new OpenAI Sign in with ChatGPT login is configured, Pi warns at startup and skips usage requests. You can keep openai selected for inference; the numbers shown are Codex usage, not app-specific OpenAI limits.
Manual /usage commands and settings remain available on any provider.
You can control:
- format (
defaultorcompact) - show/hide 5h usage
- show/hide weekly usage
- percentage mode (
remainingorused) - refresh mode (
turnupdates or background polling)
Use:
/usage
This opens a settings-style menu where changes are saved automatically.
Quick commands also work:
/usage refresh
/usage format default
/usage format compact
/usage 5h on
/usage 5h off
/usage weekly on
/usage weekly off
/usage percent remaining
/usage percent used
/usage update turn
/usage update poll
2) Continuous-loop auto-compaction
Use /autocompact to configure preventive context compaction during long-running agent loops.
Defaults:
- disabled
- trigger at 90% of Pi's active-model context-window limit
The trigger can be set from 50% through 99% in 1% steps. Percentages use Pi's contextWindow metadata for the active model, so the token threshold updates automatically after a model switch. When enabled, the extension checks usage after each model-response/tool batch. At the threshold it interrupts the active loop, compacts context, and starts a continuation turn when unfinished tool-driven work remains.
Settings persist under piOpenaiTweaks.autoCompact in ~/.pi/agent/settings.json (or the agent directory selected by PI_CODING_AGENT_DIR). Usage preferences share the piOpenaiTweaks section.
Settings updates use Pi's shared lock and atomic file replacement, preserving unrelated settings and changes from other sessions. Invalid or unreadable settings are reported instead of reset. Failed saves leave the last successfully applied configuration active.
/autocompact
/autocompact on
/autocompact off
/autocompact status
/autocompact threshold
/autocompact threshold 90
3) Fast mode
Use /fast to control OpenAI Codex Fast mode.
When active and eligible, requests include:
service_tier: "priority"
Supported commands:
/fast
/fast on
/fast off
/fast auto
/fast status
Notes:
- Fast mode is blocked on unsupported model/provider/auth combinations.
- Session starts in
automode, which followsopenai-fast.jsondefaults if present.
Fast config file locations:
- Global:
~/.pi/agent/extensions/openai-fast.json - Project:
.pi/openai-fast.json(overrides global)
Config contents:
{
"enabled": false
}
enabled: default Fast-mode state used when/fast autois active.