opencode-gpt-image
v0.1.0
Published
Plug-and-play image generation & editing tools for opencode, powered by OpenAI gpt-image-2.
Maintainers
Readme
opencode-gpt-image
Image generation and editing tools for opencode, powered by OpenAI gpt-image-2.
Add one line to your config and any agent can create and edit images.
[!NOTE] Demo video coming soon.
Install
Add it to the plugin array in your opencode.json (global: ~/.config/opencode/opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-gpt-image"]
}Then set your OpenAI key (one of):
export OPENAI_API_KEY="sk-..."
# or store it once:
echo "sk-..." > ~/.config/opencode/openai.keyRestart opencode. Done.
The key is a platform API key, billed per image — not the ChatGPT/Codex subscription.
Tools
| Tool | Does |
| --- | --- |
| image_generate | Text prompt -> image(s), saved to disk. |
| image_edit | Edit/transform existing image(s), optional mask, -> image(s). |
Both support size, quality, background, output_format, n, and output_path.
Config
| Env var | Purpose |
| --- | --- |
| OPENAI_API_KEY | API key (overrides the key file). |
| OPENCODE_OPENAI_KEY_FILE | Custom key-file path. Default ~/.config/opencode/openai.key. |
| OPENCODE_IMAGE_MODEL | Override the model. Default gpt-image-2 (try gpt-image-1-mini for cheaper output). |
License
MIT
