GPT-4o 图像 API
Upload reference images
Click to upload or drag and drop
Supported formats: JPG, JPEG, PNG, WEBP
Maximum file size: 10MB; Maximum files: 10

History
最多保留20条0 运行中 · 0 已完成
GPT-4o 图像 API:精准的文本视觉与可控的编辑
通过改进的文本渲染和指令遵循能力,创建营销图形、产品图和设计资产。使用蒙版进行精确编辑,通过图生图进行迭代,并选择 1024x1024、1024x1536 或 1536x1024 等尺寸。

Pricing
| Model | Mode | Price |
|---|---|---|
| GPT-4o Image | Image Generation | Popular $0.0208/ image(1.5 Credits) |
If it's down, we automatically use the next cheapest available—ensuring 99.9% uptime at the best possible price.
利用 GPT-4o 图像 API 可以构建什么?
为什么开发者选择 GPT-4o 图像 API
由 GPT-4o 图像生成驱动的单一生成与编辑端点。异步任务 ID、灵活的尺寸以及参考图引导帮助团队更快交付。
真实资产的文本保真度
GPT-4o 图像生成旨在提高生产级视觉素材的文本渲染和指令遵循能力。
单一 API 中的统一模式
文生图、图生图和图像编辑工作流共享同一个端点和简单的负载结构。
参考图引导
使用上传的图像作为视觉参考,在迭代过程中保持细节和风格对齐。
如何集成 GPT-4o 图像 API
通过异步任务流创建、编辑和获取图像。
第 1 步 - 选择模式与尺寸
将模型设置为 `gpt-4o-image`,然后选择 `1:1`、`2:3`、`3:2` 或具体的像素尺寸,如 `1024x1024`、`1024x1536` 和 `1536x1024`。
第 2 步 - 提供提示词与输入
发送详细指令。对于编辑任务,请包含底图和蒙版,以便仅更改目标区域。
第 3 步 - 轮询任务并下载
接收任务 ID,查询状态并下载结果。图像链接是临时的,请及时保存。
核心 API 能力
由 GPT-4o 图像生成驱动
文本精准渲染
旨在提高图像中文字的可读性并减少拼写错误。
图生图与编辑
在单一端点中支持文生图、图生图及基于蒙版的编辑。
灵活的纵横比
支持 `1:1`、`2:3`、`3:2` 或显式的像素尺寸,如 `1024x1536`。
异步任务工作流
为生成和编辑接收任务 ID,然后轮询完成状态。
参考图引导
使用上传的图像作为参考,引导构图和细节。
提示词长度控制
提示词支持多达 2000 个 Token,用于详细指令。
GPT-4o 图像 API - 常见问题
Everything you need to know about the product and billing.
API Reference
Select endpoint
Authentication
All APIs require Bearer Token authentication.
Authorization:
Bearer YOUR_API_KEY/v1/images/generationsGenerate Image
Create an image generation task using text prompts or reference images. Supports text-to-image, image-to-image, and image editing modes.
Asynchronous processing mode, use the returned task ID to .
Generated image links are valid for 24 hours, please save them promptly.
Request Parameters
modelstringRequiredDefault: gpt-4o-imageImage generation model name.
gpt-4o-imagepromptstringRequiredPrompt describing the image to be generated or how to edit the input image.
Notes
- Limited to 2000 tokens
A cat playing in the grasssizestringOptionalSize of the generated image. Supports ratio format and pixel format.
| Value | Description |
|---|---|
| 1:1 | Square ratio |
| 2:3 | Portrait ratio |
| 3:2 | Landscape ratio |
| 1024x1024 | Square (1024×1024) |
| 1024x1536 | Portrait (1024×1536) |
| 1536x1024 | Landscape (1536×1024) |
1024x1024nintegerOptionalNumber of images to generate.
| Value | Description |
|---|---|
| 1 | Generate 1 image |
| 2 | Generate 2 images |
| 4 | Generate 4 images |
Notes
- Pre-charged based on n value, actual charge based on generated count
1image_urlsarrayOptionalReference image URL list for image-to-image and image editing functions.
Notes
- Max 5 images per request
- Max size: 10MB per image
- Formats: .jpeg, .jpg, .png, .webp
- URLs must be directly accessible by the server
https://example.com/image1.pngmask_urlstringOptionalMask image URL for image editing.
Notes
- Mask and reference image must be PNG format with same dimensions
- Max size: 4MB
- Cannot be used when image_urls contains more than 1 image
https://example.com/mask.pngcallback_urlstringOptionalHTTPS callback address after task completion.
Notes
- Triggered on completion, failure, or cancellation
- Sent after billing confirmation
- HTTPS only, no internal IPs
- Max length: 2048 chars
- Timeout: 10s, Max 3 retries
https://your-domain.com/webhooks/image-task-completed

