DEV Community

Cover image for Remix Prompt in Midjourney API
GoAPI
GoAPI

Posted on

Remix Prompt in Midjourney API

This article is about the unique value of the Remix feature in Midjourney. It will guide you on obtaining precise control over image variations using the Remix Prompt in Midjourney API by GoAPI.

What's Midjourney's Remix Mode

Midjourney's Remix Mode offers users a unique way to alter prompts, parameters, model versions, or aspect ratios between variations. It takes the general composition of your starting image and uses it as part of a new task. This blending can assist in changing the setting or lighting of an image, evolving a subject, or achieving intricate compositions.

What's Midjourney API by GoAPI?

The Midjourney API, brought to you by the GoAPI team, stands as the world's only API boasting the Remix Prompt parameter input capability. This means that, with the Midjourney API provided by the GoAPI team, developers can offer their users an experience identical to the native Midjourney product.

The operations that support remix prompts in Midjourney API by GoAPI:
Variation (V1 / V2 / V3 / V4)
Vary (Strong / Subtle / Region)
Pan (All directions)
Zoomout (1.5x / 2x / Custom / MakeSquare)

How to Use the Remix Prompt with the Midjourney API (Sample code in Python)

flow

1. Invoke the /imagine endpoint to generate the original quad-image.

import requests

X_API_KEY = "YOUR_API_KEY"

endpoint = "https://api.midjourneyapi.xyz/mj/v2/imagine"

headers = {
         "X-API-KEY": X_API_KEY
}
data = {
          "prompt": "a cute cat",
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
Enter fullscreen mode Exit fullscreen mode

2. Get the response of the imagine endpoint, you will find the task_id

{
    "task_id": "807400b9-9d79-465b-8ecc-eecb7419dbbc",
    "status": "success",
    "message": ""
}
Enter fullscreen mode Exit fullscreen mode

3. Loop the fetch endpoint, to know if the imagine task was success

import requests

endpoint = "https://api.midjourneyapi.xyz/mj/v2/fetch"

data = {
    "task_id": "c0295660-4710-4b09-8fc4-73ed09b114ec"
} 

response = requests.post(endpoint, json=data)

print(response.status_code)
print(response.json())
Enter fullscreen mode Exit fullscreen mode

4. Use the variation endpoint, directing the parent task for specific modifications, and input the desired prompt in the parameters (the Remix Prompt)

import requests

X_API_KEY = "YOUR_API_KEY" 

endpoint = "https://api.midjourneyapi.xyz/mj/v2/variation"

headers = {
    "X-API-KEY": X_API_KEY
}

data = {
    "origin_task_id": "45ffd445-28cf-45fc-9ac5-7ee5d426c901",
    "index": "1",
    "prompt": "a cute cat with a hat",
    "aspect_ratio": "3:4"
    "webhook_endpoint": "",
    "webhook_secret": ""
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
Enter fullscreen mode Exit fullscreen mode
  1. Pan, Zoom, Vary follows a similar process as above.

Conclusion

Midjourney with its Remix Prompt feature, sets a new benchmark for the future of image variations. It isn't just an software; it's a canvas for boundless imagination. You can now automate the whole process using Midjourney API provided by GoAPI.

Whether you're a developer, a digital marketer, or a business owner, the time to delve into the Midjourney API is now.

Embrace the future of image variation and let your visual content radiate unparalleled brilliance.

Top comments (0)