opencode-gpt-imagePlug-and-play image generation & editing tools for opencode, powered by OpenAI gpt-image-2.
0
766
近 7 天 541
36.2
生态多维模型
1 个月前
2026-07-17
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-gpt-image@0.2.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-gpt-image@0.2.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-gpt-imageopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
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.key
Restart opencode. Done.
The key is a platform API key, billed per image — not the ChatGPT/Codex subscription.
Tools
| Tool | Does |
|---|---|
image_generate |
Text prompt (+ optional reference image(s)) -> image(s), saved to disk. |
image_edit |
Edit/transform existing image(s), optional mask, -> image(s). |
image_generate also accepts an optional image_paths array of existing reference images to guide/condition the generation.
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