Image Generation API
Compile Labs supports multiple image generation models through a unified OpenAI-compatible API.Basic Image Generation
Specifying Image Size
Common Image Sizes
1024x1024- Square (standard)1024x1792- Portrait1792x1024- Landscape2048x2048- Large square
Using OpenAI Python SDK
Saving Images from Base64
When usingresponse_format: "b64_json", you can save images directly:
Generating Multiple Images
Using Different Models
Compile Labs supports multiple image generation models:Advanced Options
Batch Image Generation
Error Handling
Pricing Examples
Approximate costs per image:- Flux 1 Schnell: ~$0.003 per image (1024x1024)
- SDXL: ~$0.002 per image (1024x1024)
- Imagen 4 Ultra: ~$0.013 per image (1024x1024)
- Imagen 4 Fast: ~$0.004 per image (1024x1024)