improved

02-05-2024 SDXL API Optimization

We have successfully optimized our SDXL API,achieving a remarkable 45% increase in speed compared to our previous API and nearly 50% reduction in serving costs. These improvements significantly elevate the efficiency and affordability of our services, benefiting users with super-faster responses and lower expenses.

We've introduced two new parameters, optimize and enhance, both accepting Boolean values. When set to True, they enable the model to operate in a highly optimized manner, significantly enhancing processing speed.

Performance Improvements Overview

Our optimizations have been extensively tested across various scenarios and step counts. The outcomes demonstrate considerable performance improvements, with speed enhancements ranging from 24.15% to 44.96% across different samples and step counts.

Detailed Speed Improvements by Steps and Samples

# Samples% Faster (30 Steps)% Faster (40 Steps)% Faster (50 Steps)
124.15%24.67%32.58%
230.28%30.83%36.88%
332.29%40.04%38.69%
434.97%40.22%44.96%

2x High-Speed, 50% Lower-Cost, Quality Uncompromised

Old Unoptimized API (Cost - 8 Credits, 30 Steps)New Optimized API (Cost - 4 Credits, 30 Steps)
Old API 1New API 1
Old API 2New API 2
Old API 3New API 3

Round Trip Times: Before and After Optimization

# SamplesUnoptimized API (30 Steps)Optimized API (30 Steps)Unoptimized API (40 Steps)Optimized API (40 Steps)Unoptimized API (50 Steps)Optimized API (50 Steps)
18.28s6.28s9.01s6.78s10.62s7.16s
211.84s8.26s13.56s9.38s15.34s9.68s
316.57s11.22s19.68s11.80s21.48s13.20s
421.02s13.68s24.56s14.69s28.92s15.92s

Try the New Optimized SDXL API

Try out our newly optimized API to see the improvements firsthand. The integration is straightforward:

import requests

url = "https://api.monsterapi.ai/v1/generate/sdxl-base"

payload = {
    "enhance": True,
    "optimize": True,
    "safe_filter": True,
    "prompt": "portrait of a model with raindrops in the foreground, wet look, slight smile, hyper-detailed skin texture illuminated by neon light, white dress, long hair, fickle face, perfect anatomy, wet-to-wet background technique by Misilbu. . hyper detailed 8k painting, 8k concept art portrait by Greg Rutkowski Artgerm WLOP Alphonse Beeple Caravaggio, muted colors, watercolor style, bokeh, f1.0 lens",
    "samples": 3,
    "steps": 40
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer YOUR_MONSTER_API_KEY"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text) 

Additional Resources -

  1. SDXL Documentation