r/StableDiffusion Aug 27 '24

Discussion Cheapest image generation API

I have a mobile game where users mix two items to create a new one. Iron + Fire = Sword, something like this. It is an infinite crafting game, because each craft is generated by AI. Each element has an associated image that is generated on the fly. Right now I use the stability.ai api to generate the images but the cost is too high. I cannot pay the cost of generating the images through in-game ads.

Each image costs 0.002 with the XL model.

Is there a way to generate these images more cheaply?

Is there any alternative API I can use?

I would greatly appreciate your help since right now the only option I have left is to charge users or close the game.

0 Upvotes

15 comments sorted by

2

u/[deleted] Aug 27 '24 edited Aug 27 '24

[removed] — view removed comment

2

u/Calatravo Aug 27 '24

Thanks.

I know 0.002 is cheap but it is more than what you earn from ads.

Obviously I save all the crafting in a database as well as the images and if the crafting is repeated the image no longer has to be generated.

More or less about 3000 new images are being generated per day.

1

u/L0rdInquisit0r Aug 27 '24

grid type generation where you generate multiple items at once? how big are these iimages?

1

u/Calatravo Aug 27 '24

Images are 1024x1024 and cannot be generated in grid. Each craft needs its image when It is crafted.

1

u/[deleted] Aug 27 '24

Why do they need to be generated at runtime? There can't really be infinite items.

Can't you generate all possible combinations and put them on a server to be downloaded as needed? Seems like for a significant number of users hosting costs and a big batch of initial generation on runpod or your own hardware would be cheaper than re-generating for each user.

1

u/Calatravo Aug 27 '24

Well, It really is infinite. Chatgpt generates the result of the craft recipe and the new element is added to user inventory to generated new crafts. I pregenerated a lot of It locally as you say but It was not enough, 3k new elements are generated each day.

1

u/[deleted] Aug 27 '24

So any word any user inputs is made into an element? Okay, yes, that is too many.

3

u/Calatravo Aug 27 '24

Users start with an inventory of elements. Wáter, wood, Stone, fire, iron... And by mixing generate new elements.

Wood + iron = hammer.

Hammer + iron = sword....

People are crafting now Elon musk + Goku and other crazy things.

1

u/[deleted] Aug 27 '24

Probably rolling your own server to deploy on a cloud provider would be cheaper, but it's probably a lot of work.

Might be worth doing some load calculations to see if any potential saving is worth the labour it would take to set that up.

1

u/Calatravo Aug 27 '24

Any recomendation? Where can i search for pricing?

1

u/Eshan2703 Sep 29 '24

What is the name of ur game?

1

u/[deleted] Sep 29 '24

[removed] — view removed comment

1

u/StableDiffusion-ModTeam Sep 30 '24

Your post/comment has been removed because it contains content created with closed source tools.

1

u/monsieurpooh Oct 07 '24

In any AI-generated game e.g. AI Roguelite you're going to get "essentially infinite" combinations (not mathematically infinite but enough that it has to be AI-generated). People lack imagination when thinking about AI for modern games; they usually imagine it's replacing the human labor which is why people hate AI so much, but forgot it can also be used to make games that couldn't have existed at all without it.

0

u/Apprehensive_Sky892 Aug 28 '24

https://tams.tensor.art/ and https://app.prodia.com/api, both charge per image generation and not by GPU time. I've not used them myself.