Runbase

Command Palette

Search for a command to run...

OpenAI

GPT Image 1

ID:openai/gpt-image-1

OpenAI 推出的 GPT Image 1 图片生成 API —— OpenAI 首个 GPT-4o 原生图片模型,提示词遵循度强,支持最多 5 张参考图。

文生图图片编辑参考图

概览

OpenAI 推出的 GPT Image 1 图片生成 API —— OpenAI 首个 GPT-4o 原生图片模型,提示词遵循度强,支持最多 5 张参考图。

认证

所有 API 请求需要通过 Authorization 请求头以 Bearer 方式传递有效的 API 密钥。

快速开始

凭证

设置 RUNBASE_API_KEY 环境变量。

Shell
export RUNBASE_API_KEY=your-api-key

创建运行

Shell
curl -s https://runbase.net/api/v1/runs \
  -H "Authorization: Bearer $RUNBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-image-1",
    "input": {
      "prompt": "一张陶瓷台灯的电影级产品照片"
    }
  }'

运行记录

运行以异步方式处理。提交请求后,轮询获取结果。

创建运行

Shell
curl -s https://runbase.net/api/v1/runs \
  -H "Authorization: Bearer $RUNBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-image-1",
    "input": { "prompt": "一张陶瓷台灯的电影级产品照片" }
  }'

获取运行状态

Shell
curl -s https://runbase.net/api/v1/runs/RUN_ID \
  -H "Authorization: Bearer $RUNBASE_API_KEY"

获取结果

轮询状态接口,直到 status 为 "succeeded",然后从响应中读取 output.urls。

输入 Schema

参数类型必填描述
promptstring必填Prompt
aspect_ratiostring可选Aspect ratio选项: 1:13:22:3
image_urlsstring[]可选Reference images

输出 Schema

字段类型描述
urlsstring[]生成的输出 URL

错误

API 使用标准 HTTP 状态码表示成功或失败。

状态码描述
400无效请求 - 参数缺失或格式错误
401认证失败 - API 密钥缺失或无效
402额度不足
403禁止访问 - IP 不在白名单或 API 密钥消费限额已超出
404未找到运行记录
429请求频率超限
500服务器内部错误