Image Generation (GPT Image 2)
BumoAPI supports OpenAI-compatible image generation and editing endpoints. You can use any OpenAI SDK or HTTP client to generate and edit images.
Supported Models
| Model | Description |
|---|---|
gpt-image-2 | Latest GPT image model with improved quality and multiple size options |
Pricing
All prices include the 6% service fee (official price + 6%).
| Size | Low | Medium | High |
|---|---|---|---|
| 1024×1024 | $0.00636 | $0.05618 | $0.22366 |
| 1024×1536 | $0.00530 | $0.04346 | $0.17490 |
| 1536×1024 | $0.00530 | $0.04346 | $0.17490 |
Generate Image
POST /v1/images/generations
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model to use, e.g. gpt-image-2 |
prompt | string | Yes | Text description of the desired image (max 32000 characters) |
n | integer | No | Number of images to generate (1-10, default 1) |
size | string | No | Image size, e.g. 1024x1024, 1024x1536, 1536x1024 (default 1024x1024) |
quality | string | No | Image quality: low, medium, high, or auto (default auto) |
background | string | No | Background transparency: transparent, opaque, or auto (default auto) |
output_format | string | No | Output format: png, jpeg, or webp (default png) |
output_compression | integer | No | Compression level 0-100 for webp or jpeg |
moderation | string | No | Content moderation level: low or auto (default auto) |
stream | boolean | No | Enable streaming mode (default false) |
user | string | No | End-user identifier |
Example
bash
curl -X POST "https://api.bumo.ai/v1/images/generations" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-image-2",
"prompt": "A cute baby sea otter",
"n": 1,
"size": "1024x1024",
"quality": "medium"
}'Response
json
{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
]
}For GPT image models, the response always returns base64-encoded images (the response_format parameter is not supported).
Edit Image
POST /v1/images/edits
Edit or extend one or more source images with a text prompt.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model to use, e.g. gpt-image-2 |
prompt | string | Yes | Text description of the desired edit |
images | array | No | Input image references (up to 16 for GPT image models) |
n | integer | No | Number of images to generate |
size | string | No | Output image size |
quality | string | No | Output quality: low, medium, high, or auto |
background | string | No | Background: transparent, opaque, or auto |
output_format | string | No | Output format: png, jpeg, or webp |
moderation | string | No | Content moderation level: low or auto |
user | string | No | End-user identifier |
Example
bash
curl -X POST "https://api.bumo.ai/v1/images/edits" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gpt-image-2" \
-F "image[][email protected]" \
-F 'prompt=Add a watercolor effect to this image'Streaming
GPT image models support streaming responses. Set "stream": true in your request to receive partial image updates as Server-Sent Events (SSE).
Streaming Example
bash
curl -X POST "https://api.bumo.ai/v1/images/generations" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-image-2",
"prompt": "A cute baby sea otter",
"stream": true
}' \
--no-bufferStreaming Events
| Event | Description |
|---|---|
image_generation.partial_image | Partial image data (base64) with partial_image_index |
image_generation.completed | Final completed image with usage info |
Notes
- Pricing: Billed per image generated. The price depends on size and quality tier.
- Authentication: Use your BumoAPI key with the
Authorization: Bearer YOUR_API_KEYheader. - Rate limits: Image generation is subject to rate limits. Please contact support if you need higher limits.
- Transparent backgrounds: When using
background: "transparent", the output format must bepngorwebp.
