Skip to main content
Follow these recommendations to build robust, efficient integrations.

Choosing Request Mode

Start with async mode for development, switch to callback for production.

Polling Strategy

For async mode, implement smart polling to balance responsiveness and efficiency.

Exponential Backoff

Error Handling

Always Handle Failures

Implement Retries

Prompt Engineering

Image Generation Tips

Effective Prompt Structure

Example:

Resource Management

Download Results Promptly

Store Task IDs

Cost Optimization

Choose the Right Model

For current pricing, always refer to the Pricing page.

Batch Similar Requests

If generating multiple variations, use image-to-image mode instead of generating from scratch each time.

Monitor Usage

Security

Protect Your API Key

Validate User Input

Performance

Use Connection Pooling

Parallelize When Possible

Monitoring

Log API Calls

Set Up Alerts

Monitor for:
  • High error rates
  • Unusual latency
  • Cost spikes
  • Rate limit hits