@pi-lab/openai
v1.0.0
Published
Image generation, ChatGPT Fast controls and native web search for pi
Readme
@pi-lab/openai
Image generation and editing through Codex or the OpenAI API, plus Fast mode and native web search for Pi.
Install and configure
pi install npm:@pi-lab/openaiAdd the following to ~/.pi/agent/settings.json (global) or .pi/settings.json (project), preserving existing settings, then run /reload:
{
"openai": {
"fast": false,
"webSearch": true,
"imageGeneration": { "backend": "codex" }
}
}All features are disabled by default. Project settings override global values; only trusted projects can override image configuration, which is replaced as a whole.
Features
Image generation
Adds the generate_image tool for image generation and editing with OpenAI models, including the GPT Image 2, 2.5 and 2.6 families.
Two backends are available: Codex and the OpenAI API. The Codex backend only supports gpt-image-2.
Configuration
Choose one of the following configurations:
{
"openai": {
"imageGeneration": { "backend": "codex" }
}
}{
"openai": {
"imageGeneration": { "backend": "openai", "model": "gpt-image-2" }
}
}Set imageGeneration to false to disable images. Disable @pi-lab/codex-image before enabling this feature, since both register generate_image.
Credentials
- Codex:
/login→ OpenAI Codex (legacy). Uses account quota. - OpenAI API:
OPENAI_API_KEY, or an OpenAI API key configured in Pi. The environment key takes precedence. Uses the official API endpoint and API billing.
Fast mode
Request Fast processing for chat. /fast toggles it; /fast on, /fast off and /fast status are also available. Command changes persist in the session; new sessions use settings.
Configuration
{
"openai": {
"fast": true
}
}Credentials
OpenAI → Sign in with ChatGPT, with an openai chat model. Inactive when using openai-codex or API keys.
Web search
Enables native web search when using an openai chat model.
When @pi-lab/websearch is also installed, native search takes precedence on supported connections; other connections use @pi-lab/websearch.
Configuration
{
"openai": {
"webSearch": true
}
}Credentials
OpenAI → Sign in with ChatGPT, with an openai chat model. Inactive when using openai-codex or API keys.
