Step-by-Step Guide to Using Dream Machine API in Postman
Hi guys, we are PiAPI! In today's article, we will be teaching you on how to use our latest Dream Machine API , so that you can integrate text/image-to-video generation capability into your own generative AI applications!
Before we get start, some background information first!
What is Dream Machine?
Dream Machine, launched by Luma Labs, is an AI model that excels in swiftly creating high-quality, realistic videos from text and image inputs. The generated videos are known for their physical and character consistency, displaying natural yet effective shots.
Additionally, Dream Machine can also generate videos in a short period of time, at around 120 frames in 120 seconds (although their servers are very crowded at the time of this writing). The produced video will display a 5-second shot with good realism and motion. However, there are current restrictions such as morphing, incorrect movement, inaccurate text and Janus (represented as having one head with two faces back to back, looking in opposite directions) that may appear in the generated videos, which require further improvements to be made.
What is Dream Machine API?
PiAPI took the first step and created the unofficial Dream Machine API since Luma Labs currently does not provide it under their Luma API, so that developers everywhere can integrate Dream Machine's text-to-video generation and image-to-video generation capabilities into their applications.
So how do we use it and see its results? That's what we will be doing today. We will be guiding you throughout this tutorial, from setting up Postman to witnessing the impressive videos you make.
Now let's get started!
Step 1 : Setting up Postman
First and foremost, you will need to open up or download Postman, the platform we will use to send Dream Machine APIs. Once you are in its workspace, click on "Collections" on the left panel , click on "New" then select "HTTP". Lastly, change the request type from "GET" to "POST".
Next, you will need to enter Dream Machine API's endpoint address from PiAPI's documentation into the endpoint address input field, and
click on "Headers",
Under the "Key" text, enter "x-api-key" in the empty input field
Under the "Value" text, enter your API Key
Once you completed this step, you may move to the next step.
Step 2 : Creating a video
Now the next steps,
Click on "Body" (beside "Headers")
Click on "raw" (below "Body")
You may copy the sample code from our documentation and insert into the body section.
In the prompt parameter, you may change the prompt input into anything you like. Once you have entered your prompt, click on the "Send" button on the right side of the workspace.
A task ID will be returned to you in the response terminal where you will need to keep it for later use. Let's move on to the next step!
Step 3 : Retrieve the video
Now, in order for us to see the resulting video, we will have to create a new HTTP request and this time leave the request type as "GET".
Next, you will need to
copy Dream Machine API's "GET" endpoint URL from our documentation and insert it into the endpoint address input field
replace the {task id} at back of the endpoint address with your task ID from the previous step
Press "Send"
Once the result status displays "finished" in response terminal, you may copy the returned URL into a web browser. And there you go, you can see your Dream Machine generated video!
*Note: As you are retrieving the "GET" request, if the returned "status" is either "pending" or "processing", then you should wait for a moment before you re-send the request again.
Conclusion
And that is it for the Dream Machine API tutorial! We hope you and your users will enjoy this feature!
To end it off, we also provides other generative AI APIs such as Midjourney API, Faceswap API and Suno API. If you are interested, do check us out!