We provide gpt-image-1, gpt-image-1.5, gpt-image-2 and gpt-image-2-preview API.
This is a preview version model, each generation costs $0.10 / image (flat per-call fee — independent of size, quality, or token count).
gpt-image-1, gpt-image-1.5, gpt-image-2)All three share the same text-token rate; image input and image output rates differ per model.
| Model | Text input | Text cached input | Image input | Image cached input | Image output |
|---|---|---|---|---|---|
| gpt-image-1 | $5.00 / 1M | $1.25 / 1M | $10.00 / 1M | $1.25 / 1M* | $40.00 / 1M |
| gpt-image-1.5 | $5.00 / 1M | $1.25 / 1M | $8.00 / 1M | $1.25 / 1M* | $32.00 / 1M |
| gpt-image-2 | $5.00 / 1M | $1.25 / 1M | $8.00 / 1M | $1.25 / 1M* | $30.00 / 1M |
* Image cached input is billed at the same rate as text cached input because our billing system uses a single cached-token rate per model. In practice this only affects repeated image-edit calls that reuse the same reference image within the cache window.
These are estimates for output images at common resolutions and quality settings. Input prompt cost is negligible for typical short prompts.
| Resolution | Low Quality | Medium Quality | High Quality |
|---|---|---|---|
| 1024×1024 | ~$0.011 | ~$0.042 | ~$0.167 |
| 1024×1536 | ~$0.016 | ~$0.063 | ~$0.250 |
| 1536×1024 | ~$0.016 | ~$0.063 | ~$0.250 |
| Resolution | Low Quality | Medium Quality | High Quality |
|---|---|---|---|
| 1024×1024 | ~$0.009 | ~$0.034 | ~$0.133 |
| 1024×1536 | ~$0.013 | ~$0.051 | ~$0.200 |
| 1536×1024 | ~$0.013 | ~$0.051 | ~$0.200 |
| Resolution | Low Quality | Medium Quality | High Quality |
|---|---|---|---|
| 1024×1024 | ~$0.008 | ~$0.032 | ~$0.125 |
| 1024×1536 | ~$0.012 | ~$0.048 | ~$0.188 |
| 1536×1024 | ~$0.012 | ~$0.048 | ~$0.188 |
gpt-image-2-preview is the only flat-rate model — all others scale with actual token usage.When a parameter is omitted in the request, the following defaults apply:
| Parameter | Default | Note |
|---|---|---|
size | 1024x1024 | |
n | 1 | |
quality | auto (token-billed models) | Upstream may return a higher-than-standard token count under auto. Pass quality=standard explicitly to match the per-image estimates in the tables above. Omitting quality can result in ~2× the standard cost. |
quality | standard (gpt-image-2-preview) | Flat-rate; quality choice does not affect price. |
response_format | b64_json | Pass response_format=url to get a hosted URL instead. |
output_format | png |
curl --location 'https://api.piapi.ai/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your-api-key}' \
--data '{
"model": "gpt-image-2",
"prompt": "A cute baby sea otter",
"n": 1,
"size": "1024x1024",
"quality": "low",
"output_format": "jpeg"
}'
Use the /v1/images/edits endpoint to transform an existing image with a natural-language prompt. The request must be multipart/form-data — the reference image is uploaded as a file field named image.
gpt-image-2-preview)# 1. Prepare a reference image (either download one or use your own local file)
curl -sS -o /tmp/ref.png \
"https://oss.filenest.top/uploads/1776b813-28cb-4ca7-a82f-6096f4e7c5b7.png"
# 2. Submit the edit request
curl --location 'https://api.piapi.ai/v1/images/edits' \
--header 'Authorization: Bearer {your-api-key}' \
--form 'model=gpt-image-2-preview' \
--form 'prompt=Add a warm sunset background with soft bokeh lights, keep the character unchanged' \
--form 'n=1' \
--form 'size=1024x1024' \
--form 'quality=standard' \
--form 'response_format=url' \
--form 'image=@/tmp/ref.png'
{
"data": [
{
"url": "https://imagefil.scdn.app/assets/codex/d69c5648-f0d0-4cd3-8860-0d7b1733d274.png"
}
],
"created": 1776956146,
"usage": {
"total_tokens": 1889,
"input_tokens": 1124,
"output_tokens": 765,
"input_tokens_details": {
"text_tokens": 19,
"image_tokens": 1105
}
}
}
Verified sample roundtrip (~100 s end-to-end):
response_format is omitted, the response comes back as b64_json. Pass response_format=url when you want a hosted link instead of inline base64.