Drawing a Cat in Pi Took a Separate Image Login — Then a 1254×1254 Surprise
Adding an Image Generation Plugin to Pi: From Login Errors to a 200×200 Cat
I installed pi-codex-image-gen for Pi, hoping to draw images directly in the terminal.
I tried the plugin's example once and nothing was drawn — the error was Missing image OAuth credentials. After following the prompt to run /login codex-images and completing authorization in the browser, I asked it to draw a cat again, and this time it worked.
What can this plugin do?
With pi-codex-image-gen installed, you can generate images inside a Pi conversation. You can also use local images or images from the conversation as references for editing; PNG, JPEG, and WebP are supported.
It uses the image generation capability from a ChatGPT subscription. No separate OpenAI API key is required, and no Codex App installation is needed. Generation consumes the account's image quota; whether it works and how much it uses depends on the account and server-side limits.
Plugin page on the Pi website: https://pi.dev/packages/pi-codex-image-gen?name=imagegen
Installing the plugin
First make sure Pi is working normally and the ChatGPT subscription account has available image generation quota. The plugin requires Pi 1.1.0 or later and Node.js 22.19.0 or later.
I use Pi-Bolt, so my commands are written as pi-bolt. If you use the original Pi, replace pi-bolt below with pi — the official screenshots use pi.
Install the plugin in your system terminal:
pi-bolt install npm:pi-codex-image-gen
After installing, take a look at the package list:
pi-bolt list
Then enter a session:
pi-bolt
If you already have a session open, run this once in the session input box:
/reload
This reloads extensions and skills. The /login and /skill:imagegen commands below are also typed into that input box; they are not shell commands.
First drawing attempt: stuck at login
I started with the sword example from the plugin's README, asking for a 32×32 pixel icon:
Generate a pixel-art sword icon, 32×32, with a blue blade and gold hilt
The tool was invoked, then it reported an error and generated no image:
Missing image OAuth credentials. Run /login codex-images.
The missing step was the image login. Pi manages chat and image authorization separately; the two logins are independent. Logging in with openai (ChatGPT) only allows chat, not image generation. Switching chat models doesn't fix it.
Next, run this in the Pi session input box:
/login codex-images
Follow the prompts to the browser, complete login and authorization with the ChatGPT account, then return to the terminal.
You can also enter /login and select it from the list:
Codex Images (ChatGPT subscription)
Credentials are saved and refreshed by Pi; you don't need to edit auth.json yourself. If login is rejected or credentials expire, run /login codex-images again.
If Codex Images doesn't appear in the list, check that the plugin is installed properly, try /reload again, and restart the session if necessary.
After login, draw a cat again
I sent a prompt (originally in Chinese):
Draw a 200×200 cat
To explicitly use the skill bundled with the plugin, you can write:
/skill:imagegen Draw a 200×200 cat
This time codex_generate_image succeeded, and the terminal showed an image preview and save path.
In the output, Status: completed means generation is done, and the path after Saved image to: is the local file path.
gpt-6-astra in the output is the router model name. The actual image model is chosen by the backend; this name doesn't reveal which model was used.
The image was drawn, but the dimensions need another pass
I asked for 200×200, but the raw image returned in the screenshot was 1254×1254:
Backend-reported size: 1254x1254.
After that, resize it locally to 200×200 and check the file dimensions.
For exact dimensions, follow up after generating:
Resize the image I just generated to exactly 200×200 pixels, save it as PNG, keep the original, and check the final file dimensions.
When making assets with fixed specs like avatars and icons, remember to check the actual pixel size.
Where are images saved, and how do you edit them later?
By default, images are stored in Pi's agent directory, usually:
~/.pi/agent/generated-images/<session-id>/
To find files, look at the path after Saved image to:.
To use an image in a project, tell it the save location as well:
Draw a cute orange cat, front-facing sitting pose, off-white background, no text. Export the final image as a 200×200 pixel PNG, keep the original, and copy the final file to the current project's assets directory.
Before saving, look at the target directory so you don't overwrite a file with the same name.
To keep editing the image you just made, send more requests:
Based on the cat image from just now, change the expression to a closed-eye smile, keep the pose and colors as much as possible, and save another copy.
You can reference up to 5 local images or recent conversation images at a time. Editing re-issues a generation request and may keep consuming quota.
Still getting errors after login?
If you still see Missing image OAuth credentials, check that /login codex-images completed the authorization. If you get 401 or 403, re-login and check authorization status.
For 429, exhausted quota, connection failures, or timeouts, first confirm the specific error. On timeout or connection interruption, the remote side may already have started generating, and the previous request may have consumed quota; don't immediately resubmit the same request.
The plugin also has a separate CLI path that requires OPENAI_API_KEY and is billed separately by API usage. Using it requires an explicit choice; it won't automatically fall back to it when subscription login fails.