opencode-gpt-imagegen 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/index.js +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# opencode-gpt-imagegen
|
|
2
2
|
|
|
3
|
+
> **⚠️ ChatGPT subscription users: update before October 14, 2026.** [GPT-5.5 will retire from Codex with ChatGPT sign-in](https://learn.chatgpt.com/docs/models#gpt-55-retirement). Plugin versions before `0.1.13` use GPT-5.5 and will stop generating images. Follow the [update steps](#updating-the-plugin) to install `0.1.13` or later.
|
|
4
|
+
|
|
3
5
|
<p align="center"><img src="./ogp.png" alt="opencode-gpt-imagegen × gpt-image-2" /></p>
|
|
4
6
|
|
|
5
7
|
> Bring [**ChatGPT Images 2.0**](https://openai.com/index/introducing-chatgpt-images-2-0/) (`gpt-image-2`) to [OpenCode](https://opencode.ai). Use it through your **ChatGPT subscription** (no API costs!) or through the **OpenAI API** — your call.
|
|
@@ -32,6 +34,17 @@ Add this plugin to your [OpenCode config](https://opencode.ai/docs/plugins/). Fo
|
|
|
32
34
|
|
|
33
35
|
OpenCode auto-installs the package via Bun on next launch — no separate `npm install` step is needed. The plugin requires OpenCode to be authenticated with ChatGPT.
|
|
34
36
|
|
|
37
|
+
### Updating the plugin
|
|
38
|
+
|
|
39
|
+
OpenCode caches npm plugins, so restarting it may keep an older version. To update this plugin:
|
|
40
|
+
|
|
41
|
+
1. Check the `plugin` entry in your OpenCode config. Use `"opencode-gpt-imagegen"` or `"opencode-gpt-imagegen@latest"` to request the latest version. If you pinned a version, remove the version suffix or change it to the version you want to install.
|
|
42
|
+
2. Quit OpenCode completely.
|
|
43
|
+
3. If your entry is unversioned or uses `@latest`, delete the cached directory `~/.cache/opencode/packages/opencode-gpt-imagegen@latest/`.
|
|
44
|
+
4. Restart OpenCode to install the requested version.
|
|
45
|
+
|
|
46
|
+
If you use an unversioned entry or `@latest` but do not have that directory, see [OpenCode's cache-clearing instructions](https://opencode.ai/docs/troubleshooting/#clear-the-cache) for other cache layouts.
|
|
47
|
+
|
|
35
48
|
## Usage
|
|
36
49
|
|
|
37
50
|
Just ask your agent in natural language and `gpt_imagegen` will be picked up.
|
|
@@ -74,8 +87,22 @@ Pass any number of image paths via the `images` argument and the model uses them
|
|
|
74
87
|
|
|
75
88
|
OpenCode already talks to the OpenAI Codex backend to power ChatGPT subscription chat. This plugin reuses that same endpoint, attaching the hosted `image_generation` tool to a single-turn request, then writes the returned PNG to disk. Auth is read from OpenCode's standard `auth.json`; no new credential surface is introduced.
|
|
76
89
|
|
|
90
|
+
## Contributing
|
|
91
|
+
|
|
92
|
+
Small bug fixes are welcome as direct pull requests. For features, refactors, or behavior changes, please open an issue first. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
|
93
|
+
|
|
77
94
|
## Disclaimer
|
|
78
95
|
|
|
79
96
|
This is an **unofficial, third-party** plugin, not affiliated with or endorsed by OpenAI or OpenCode.
|
|
80
97
|
|
|
81
98
|
It uses the same Codex backend endpoint OpenCode itself calls for ChatGPT subscription chat — this plugin just adds the hosted `image_generation` tool to that conversation. Use must comply with OpenAI's [Terms of Use](https://openai.com/policies/row-terms-of-use/) and [Usage Policies](https://openai.com/policies/usage-policies/).
|
|
99
|
+
|
|
100
|
+
## Star History
|
|
101
|
+
|
|
102
|
+
<a href="https://www.star-history.com/?repos=yuji-hatakeyama%2Fopencode-gpt-imagegen&type=date&legend=bottom-right">
|
|
103
|
+
<picture>
|
|
104
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=yuji-hatakeyama/opencode-gpt-imagegen&type=date&theme=dark&legend=bottom-right" />
|
|
105
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=yuji-hatakeyama/opencode-gpt-imagegen&type=date&legend=bottom-right" />
|
|
106
|
+
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=yuji-hatakeyama/opencode-gpt-imagegen&type=date&legend=bottom-right" />
|
|
107
|
+
</picture>
|
|
108
|
+
</a>
|
package/dist/index.js
CHANGED
|
@@ -47,7 +47,9 @@ async function parseImageGenerationResultFromSSE(stream) {
|
|
|
47
47
|
throw new Error("no image_generation result returned by codex backend");
|
|
48
48
|
}
|
|
49
49
|
async function callViaCodexResponses(auth, args, inputImageDataUrls) {
|
|
50
|
-
const
|
|
50
|
+
const dimensions = args.size?.match(/^(\d+)x(\d+)$/);
|
|
51
|
+
const prompt = dimensions ? `${args.prompt} Generate the image with a width of ${dimensions[1]} pixels and a height of ${dimensions[2]} pixels.` : args.prompt;
|
|
52
|
+
const userContent = [{ type: "input_text", text: prompt }];
|
|
51
53
|
for (const dataUrl of inputImageDataUrls) {
|
|
52
54
|
userContent.push({ type: "input_image", image_url: dataUrl });
|
|
53
55
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-gpt-imagegen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "OpenCode plugin for GPT Image 2 generation through your ChatGPT subscription, with reference images and safe PNG output.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"prebuild": "rm -rf dist",
|
|
21
21
|
"build": "bun build ./src/index.ts --outdir ./dist --target node --format esm --packages external",
|
|
22
22
|
"test": "bun test tests/unit",
|
|
23
|
-
"test:e2e_subscription": "OPENCODE_MODEL=openai/gpt-
|
|
23
|
+
"test:e2e_subscription": "OPENCODE_MODEL=openai/gpt-6-sol bun test tests/e2e/subscription.test.ts",
|
|
24
24
|
"prepublishOnly": "bun run build",
|
|
25
25
|
"release:patch": "bash scripts/prepare-release.sh patch && git push --follow-tags",
|
|
26
26
|
"release:minor": "bash scripts/prepare-release.sh minor && git push --follow-tags",
|