Site icon Midjourney API

Midjourney API Service Documentation

Introduction

This is the API documentation for the Midjourney service provided by Omnibridge. This service exposes the Midjourney APIs to developers, allowing them to generate images from natural language descriptions. Once signed up, developers also gain access to the playground where they can test all the available endpoints with provided code samples. Please note that we keep all images for 30 days. All images will be removed after that. You can signup for the service at https://www.omnibridge.io/

You can also see the documentation in OpenAPI format here.

Base Functions

JavaScript Base Function

const axios = require('axios'); 

const BASE_URL = 'https://prod.omnibridge.io/';
const API_SECRET = '[API_SECRET]';

function omniRequest(command, data, method='post'){
  const headers = { 'Authorization': 'Bearer '+API_SECRET, 'Content-Type': 'application/json' };
  if (method === 'post'){
    return axios.post(BASE_URL + command, data, {
      headers
    });
  }
  
  return axios.get(BASE_URL + command, {params : data, headers});
}

Python Base Function

import requests
import json
  
BASE_URL = 'https://prod.omnibridge.io/';
API_SECRET = 'YOUR_API_SECRET';

def omniRequest(command, data, method='post'):
  headers = { 'Authorization': 'Bearer '+API_SECRET, 'Content-Type': 'application/json' };
  if method == 'post':
    return requests.post(BASE_URL + command, data=json.dumps(data), headers=headers);
  
  return requests.get(BASE_URL + command, params=data, headers=headers);

Endpoints

POST /imagine

This endpoint performs the /imagine prompt in Midjourney. It supports everything that Midjourney supports including blending images (by passing urls to multiple images). It also has a feature unique to Omnibridge which does not exist in Midjourney. If the prompt is in the format of “site:https://example.com/path”, we read the content of this website. Pass it to OpenAI to analyze it and suggest an image that would fir the content of that website. Then we generate that image using Midjourney.

See the examples below for how to use this endpoint:

JavaScript Example

omniRequest('imagine',{'prompt' : 'Blue Sky with two birds --economy', 'formats' : 'PNG'})
.then(response => console.log(response.data));

Python Example

print(omniRequest('imagine', {'prompt' : 'Blue Sky with two birds --economy', 'formats' : 'PNG'}).json())

GET /job?jobId=JOB_ID

This endpoint returns the status of an image generation job. See the examples below for how to use this endpoint:

JavaScript Example

omniRequest('job', {'jobId' : 'YOUR_JOB_ID'}, 'get')
.then(response => console.log(response.data));

Python Example

print(omniRequest('job', {'jobId' : 'YOUR_JOB_ID'}, 'get').json())

POST /enhance

This endpoint enhances an image. Any /enhance command is considered a “Fast” image request. See the examples below for how to use this endpoint:

JavaScript Example

omniRequest('enhance', {'jobId' : 'YOUR_JOB_ID', 'command' : 'YOUR_COMMAND'})
.then(response => console.log(response.data))

POST /faceswap

This endpoint accepts two image urls (source and target). Each image should have a single face in it. This funciton swaps the two faces and returns the result. See the examples below for how to use this endpoint:

JavaScript Example

omniRequest('faceswap', {'source' : 'https://example.com/image1.png', 'target' : 'https://example.com/image2.jpg'})
.then(response => console.log(response.data))
Exit mobile version