Just wrapped a similar integration. The big win is the image quality, but watch out for these cost and control snags.
**Pricing & Rate Limits**
- It's per-image, not tokens. Can get expensive fast if users generate many variants.
- API has strict rate limits (requests/images per minute). You'll need a queue system for any real traffic.
- No commitment discounts or "reserved instances" like we get in AWS 😉. Pure usage-based.
**Technical Gotchas**
The `size` parameter in the API is crucial. Client's CMS might only store thumbnails, but you're paying for `1024x1024`. You'll need to downscale post-generation.
```python
# Example: You'll likely need a step like this
from PIL import Image
generated_image = Image.open("dalle_output.png")
cms_thumbnail = generated_image.resize((400, 300))
cms_thumbnail.save("final_cms_image.jpg")
```
Also, prompt filtering is quite aggressive. CMS users typing in brand names or product names might hit the content policy and get a vague error.
**My advice:** Build a proxy layer to handle:
1. Request queuing/throttling
2. Image resizing/optimization (saves storage costs too!)
3. Prompt pre-validation
Happy to share more details on the Terraform for the proxy infra (Lambda + SQS + ECS). The async pattern saved us ~40% vs. direct integration.
#savings