GPT Image API
图片由 OpenAI 官方 gpt-image-2 生成。Portdan 负责 API 接入和计费。
让 Codex 安装
把下面这句话发给 Codex:
text
请安装这个 Skill,并用它通过 Portdan 生图:
https://github.com/riven9566-source/portdan-image2-skill直接生图
安装完成后,把提示词发给 Codex:
text
使用 $portdan-image2 快速生成一张图片:一只金毛幼犬坐在阳光草地上,写实摄影,无文字、无 logo、无水印。画质可以写 快速、均衡 或 高清。
不使用 Skill
请求地址:
text
POST https://portdan.com/v1/responses查看 curl 示例
把 sk-your-api-key 换成自己的完整 Key。
bash
curl https://portdan.com/v1/responses \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4-mini",
"input": "生成一张小狗坐在草地上的图片",
"tools": [{
"type": "image_generation",
"model": "gpt-image-2",
"action": "generate",
"size": "1024x1024",
"quality": "low",
"output_format": "png"
}],
"tool_choice": {"type": "image_generation"},
"store": false,
"stream": false
}'图片 Base64 数据在 output[] 中 type 为 image_generation_call 的 result 字段。画质支持 low、medium、high。