improved

07-05-2024 Photomaker API Optimization

We've significantly improved our Photomaker API, achieving a remarkable 45% increase in speed compared to the previous version and cutting serving costs by nearly 50%. These enhancements greatly enhance the efficiency and affordability of our services, providing users with faster responses and lower expenses.

To achieve this, we've introduced a new parameter called "optimize," which accepts a Boolean value. Setting it to True enables the model to operate in a highly optimized mode, significantly boosting 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 26.06% to 44.77% across different samples and step counts.

Detailed Speed Improvements by Steps and Samples

Samples30 Steps (% Faster)40 Steps (% Faster)50 Steps (% Faster)
126.06%29.22%31.02%
234.40%36.32%41.94%
339.02%42.96%44.77%

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

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

Round Trip Times: Before and After Optimization

Samples30 steps (Optimized)30 steps (Unoptimized)40 steps (Optimized)40 steps (Unoptimized)50 steps (Optimized)50 steps (Unoptimized)
14.12s5.62s4.64s6.64s5.28s7.62s
25.74s8.74s6.72s10.64s7.56s13.06s
37.48s12.26s8.66s15.16s9.91s17.94s

Try the New Optimized Photomaker 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/photo-maker"

payload = {
      "samples": 1,
      "seed": 42,
      "optimize": True,
      "steps": 30,
      "prompt": "old man img as a Wizard with blue diamonds blue background , golden ratio, fake detail, trending pixiv fanbox, acrylic palette knife, style of makoto shinkai studio ghibli genshin impact james gilleard greg rutkowski chiho aoshima",
      'init_image_url' :'https://engineering.nyu.edu/sites/default/files/styles/square_large_default_1x/public/2018-06/yann-lecun.jpg?h=65172a10&itok=NItwgG8z'
  }

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. Photomaker Documentation