Skip to content

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

ModelDescription
gpt-image-2Latest GPT image model with improved quality and multiple size options

Pricing

All prices include the 6% service fee (official price + 6%).

SizeLowMediumHigh
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

ParameterTypeRequiredDescription
modelstringYesThe model to use, e.g. gpt-image-2
promptstringYesText description of the desired image (max 32000 characters)
nintegerNoNumber of images to generate (1-10, default 1)
sizestringNoImage size, e.g. 1024x1024, 1024x1536, 1536x1024 (default 1024x1024)
qualitystringNoImage quality: low, medium, high, or auto (default auto)
backgroundstringNoBackground transparency: transparent, opaque, or auto (default auto)
output_formatstringNoOutput format: png, jpeg, or webp (default png)
output_compressionintegerNoCompression level 0-100 for webp or jpeg
moderationstringNoContent moderation level: low or auto (default auto)
streambooleanNoEnable streaming mode (default false)
userstringNoEnd-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

ParameterTypeRequiredDescription
modelstringYesThe model to use, e.g. gpt-image-2
promptstringYesText description of the desired edit
imagesarrayNoInput image references (up to 16 for GPT image models)
nintegerNoNumber of images to generate
sizestringNoOutput image size
qualitystringNoOutput quality: low, medium, high, or auto
backgroundstringNoBackground: transparent, opaque, or auto
output_formatstringNoOutput format: png, jpeg, or webp
moderationstringNoContent moderation level: low or auto
userstringNoEnd-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-buffer

Streaming Events

EventDescription
image_generation.partial_imagePartial image data (base64) with partial_image_index
image_generation.completedFinal 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_KEY header.
  • 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 be png or webp.