Posted on 2023/09/01 by GoAPI
(video tutorial on trying GoAPI's Midjourney API with Postman)
Hi everyone, we are very excited to make this introductory tutorial to show you how you can get started with Midjourney API developed by the GoAPI team!
Full disclosure, this is not an official API by Midjourney. We are a team of computer graphics experts and backend engineers. With the advent of generative AI, we fell in love with Midjourney, and thought this neat API service can help a lot of developers to be incorporated into their existing workflow.
To get started, go to GoAPI's Midjourney API, hover on "Docs" and click on "Midjourney API", then you would be able to see the list of endpoints that we currently offer (and we are constantly maintaining and adding more endpoints).
You can also see the different processing modes that we offer: "mixed mode" from GoAPI means that your task will either be processed under Midjourney's relaxed or fast mode; and the "fast mode" from GoAPI means that your task will only be processed under Midjourney's fast mode.
Below is an explanation of potential workflows using the currently available endpoints. For this tutorial, we are just going to use the imagine endpoint, and perform a successful fetch on the result of the imagine task submitted.
If you go to our documentation's pricing plans, you can see the pricing info we have for both Midjourney and Stable Diffusion API.
For Midjourney, each API call in the mixed mode will cost 7 credits. Given that each credit costs ~$0.0014USD, therefore each mixed mode API call will work out to be about 1 cent USD; and each fast mode API call is about 2 cents USD.
Thus, if you do the math on how many pictures you use per month, you might find that our pricing is very competitive for your needs.
We also offer the option of trying our service for only a dollar (for which you get 200 credits) - it is a great way to test the API and see if that would fit into your existing workflow.
If you have made the one-dollar-trial payment, you are going to receive an automatic email shown below with your API key corresponding to the payment amount you have made.
Next, we are going to use Postman to test out our Midjourney API service. Postman is an API platform for developers. You can use their desktop version or their web version for this tutorial.
Download/open up Postman, create a new HTTP request, change the request to POST.
Under Headers, type "X-API-KEY" under the Key, and your API key under Value.
Under Body, click "raw". and copy the python code from our docs into the body.
And press the Send button
Next, create a new HTTP request, change the request to POST. Find the Fetch endpoint in our documentation, copy the endpoint url and do the following as shown in the screenshot below. Press Send, and you would get the URLs to your picture in the Response.
When you send the fetch request, the result might say "pending" or "processing" instead of "finished" which means that you would have to wait for a bit and then re-send the fetch post request. If you don't want to wait, you could also use the webhook function, which will send you a message automatically after the task in completed. We will cover how to use the webhook in another tutorial.
Finally, copy the returned URL into your web browser to retrieve your picture!
And that is how your get started with Midjourney API in a few minutes with GoAPI. Thank you for getting this far through the tutorial, and feel free to share our service with anyone who might find it useful - we are immensely grateful! :D