OPENCLAW + GPT IMAGE

在 OpenClaw 中使用 GPT Image。

GPT Image 2 是 OpenAI 专用的图像生成模型——支持文生图和基于指令的图像编辑,输出分辨率最高可达 4K,并支持透明背景。OpenClaw agent 通过与聊天相同的 RunAPI 密钥和 /v1 端点调用它,无需安装额外的 skill。

一个 API 密钥 · 文生图 + 图像编辑 · 最高 4K 输出
使用 RunAPI 通过 OpenAI GPT Image 2 生成图像。

要求:
- 使用位于 https://runapi.ai/v1/text_to_image 的 RunAPI API。
- 从 RUNAPI_API_KEY 环境变量读取 API 密钥。
- 将 model 设置为 "gpt-image-2-text-to-image"。
- 编写一个描述性的 prompt。GPT Image 2 会紧密遵循自然语言指令——描述布局、风格、文字叠加和透明度需求。
- 可选地将 output_resolution 设为 1k、2k 或 4k。默认为 1k。
- 响应会返回一个 task_id。轮询任务状态端点直到任务完成,然后获取输出 URL。
curl -X POST https://runapi.ai/v1/text_to_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2-text-to-image",
    "prompt": "A product photo of a glass perfume bottle on a marble surface, transparent background, studio lighting, the label reads AURORA in gold serif font",
    "output_resolution": "2k",
    "aspect_ratio": "3:4"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "gpt-image-2-text-to-image"
}
复制 curl 命令进行测试 gpt-image
工作原理

三步在 OpenClaw 中使用 GPT Image

1

Configure RunAPI

Set the RUNAPI_API_KEY environment variable in your shell profile. If RunAPI is already configured in OpenClaw for chat, the same key works for GPT Image — no additional setup needed.

export RUNAPI_API_KEY=runapi_xxx
2

Call GPT Image 2

Send a POST request to the text_to_image endpoint with model set to gpt-image-2-text-to-image. Include a descriptive prompt with layout and style instructions. Set output_resolution to 2k or 4k for higher detail. For editing existing images, use the edit_image endpoint with gpt-image-2-image-to-image and provide source_image_urls.

POST /v1/text_to_image
3

Get the result

The API returns a task_id immediately. Poll the task status endpoint until the status changes to completed, then retrieve the output image URL from the response. GPT Image 2 typically completes within 10–30 seconds depending on resolution.

task_id: tsk_abc123
参数

GPT Image API 参数

参数 类型 说明
model string Required. gpt-image-2-text-to-image for generation, gpt-image-2-image-to-image for editing.
prompt string Required. Natural language description of the desired image. Supports detailed instructions for layout, text overlays, and style.
output_resolution string Optional. Output resolution — 1k (default), 2k, or 4k. Higher resolution costs more per image.
aspect_ratio string Optional. Defaults to auto. Supports 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, 9:16, and more.
source_image_urls array Required for edit_image endpoint. One or more URLs of source images to edit.

OpenClaw 上的 GPT Image 是什么?

GPT Image 2 是 OpenAI 专用的图像模型,其运作方式更像一个结构化的设计助手而非关键词驱动的生成器。你给它一个制作简报——排版、文字位置、风格约束——它能严格遵循指令。OpenClaw agent 通过与聊天相同的 RunAPI 端点调用它。

GPT Image 使用场景

品牌视觉与广告设计

根据详细的制作简报生成品牌广告、社交媒体横幅和营销视觉——指定精确的排版、文字位置和风格约束,GPT Image 2 严格遵循执行。

带透明背景的产品图

生成带透明背景的产品展示图,可直接用于电商网站、营销材料或 UI 叠加层,无需后期去背景处理。

UI 模型与界面概念图

生成带可读文字标签和清晰布局层级的 UI 模型和应用界面概念图,在开发团队评审前快速可视化设计概念。

常见问题

GPT Image + OpenClaw 常见问题

OpenClaw 通用配置

尚未配置?请从 OpenClaw 的 RunAPI 配置指南开始。

OpenClaw 配置指南 →

GPT Image 模型目录

查看所有 GPT Image 版本、定价和 API 文档。

GPT Image 模型 →

立即在 OpenClaw 中试用 GPT Image。

免费获取 RunAPI 密钥,将提示词粘贴到 OpenClaw,开始使用 OpenAI GPT Image 2 生成和编辑图像。