DEV Community

Cover image for How I built a Midjourney API

How I built a Midjourney API

Yuval on May 29, 2023

Want to see it in action? Follow me on LinkedIn and text me Building a Midjourney API: Breaking Down the Process If you're in the world of AI,...
Collapse
 
theweirs profile image
TheWeirs

Did you complete the API?

Collapse
 
jack206418070 profile image
jack206418070

If you want to develop this API yourself, here are three points you can consider:

  1. Use the web version of Discord to fetch the API interactions between Discord and the Midjourney bot when executing commands.

  2. Create a Discord bot that listens to all messages from the Midjourney bot, including the messages it sends when generating images. Use callbacks to transmit these messages to your desired endpoints.

  3. Depending on the application type, implement the logic to receive callback messages and achieve the desired outcome.

Going further:

  1. Consider multiple users: How can you differentiate and deliver the results of different user requests to the respective users?

  2. For specific complex commands, explore how to combine Discord's own API with your API to achieve functionalities like "/blend."

Collapse
 
suede profile image
Yuval

of course. it is working flawlessly

Collapse
 
hopefloats101 profile image
Hope Floats • Edited

Do you have a link to a demo perhaps? This is awesome work.

Thread Thread
 
xucian profile image
xucian

I can give you free access to mjapi.io, since it's in beta and I have to test it. hmu at the official email

Collapse
 
siera profile image
Mykolas Klusaitis

maybe you have any thoughts to run a product with this api?

Collapse
 
suede profile image
Yuval

That was a good idea back then . The risk was that MJ may publish their own API one day, and it's done ..

Collapse
 
cubist77 profile image
cubist77

Have you considered releasing your code?

Thread Thread
 
xucian profile image
xucian • Edited

sorry to plug this, but I can give you free access to mjapi.io, since it's in beta and I have to test it. hmu at the official email

Collapse
 
luna_cuili profile image
Luna_Cui

How to build it?

Collapse
 
useapi profile image
useapi.net

@suede
I am reaching out to inquire whether you might be interested in trying the Midjourney API. We have recently released this offering and are actively promoting it. For more details, please visit our documentation at useapi.net/docs/collaboration-offer.

Additionally, you can explore our YouTube channel for more insights: youtube.com/@midjourneyapi.

Regards,
-u

Collapse
 
xucian profile image
xucian

yeah, I took the chance and built mjapi.io just for this, totalling about 10k lines of code.
if they release their own api, so be it. it was a fun experiment and I've learned about stripe, paypal, btc/lightning payments and discord stuff, really interesting

Collapse
 
nikoole profile image
nikoole

Just want to show you API layer to Midjourney: userapi.ai
Link to the documentation
There are all methods including Vary Region and Remix mode provided

Collapse
 
dataheadless profile image
dataheadless

Very helpful, this one is good too Midjourney API

Collapse
 
therrou profile image
Tomas Herrou

Did you create a bot? If so, how did you by-pass the bot flag from Midjourney? Or you created a self-bot? If so, are you breaking the ToS from Discord?