跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    plfavreau

    Gpt Image

    v0.2.1其他
    opencode-gpt-image

    Plug-and-play image generation & editing tools for opencode, powered by OpenAI gpt-image-2.

    GitHub 星标

    0

    月装机量

    766

    近 7 天 541

    综合评分SCORE

    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"]
    }

    opencode 启动时会通过内嵌运行时自动加载 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