The project is in a healthy, maintained state
Use `runapi-midjourney` for Midjourney image generation, editing, image-to-video, first-video extension, image-to-prompt, prompt shortening, and seed lookup in Ruby applications and workers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 0.3.0
 Project Readme

RunAPI

Midjourney API SDKs for JavaScript, Python, Ruby, Go, Java, and PHP on RunAPI.

npm PyPI RubyGems Go Reference Maven Central License


The Midjourney SDK provides typed clients for text-to-image generation, prompt-guided image editing, image-to-video generation, first-video extension, image-to-prompt analysis, prompt shortening, and seed lookup. The public midjourney-sdk repository groups the non-PHP language packages, examples, CI, and language release tags. The PHP package is released from a split Composer repository.

Install

npm install @runapi.ai/midjourney
pip install runapi-midjourney
gem install runapi-midjourney
go get github.com/runapi-ai/midjourney-sdk/go@latest

Java applications use ai.runapi:runapi-midjourney. PHP applications use the split runapi-ai/midjourney Composer package.

JavaScript quick start

import { MidjourneyClient } from '@runapi.ai/midjourney';

const client = new MidjourneyClient();
const result = await client.textToImage.run({
  model: 'midjourney-v8.1',
  prompt: 'A cobalt blue ceramic vase on white marble',
});

console.log(result.images[0].url);

Resources

  • textToImage: create, get, or create-and-poll a midjourney-v8.1 image task.
  • editImage: create, get, or create-and-poll a prompt-guided image edit.
  • imageToVideo: create, get, or create-and-poll a video task from a source image.
  • extendVideo: extend the first video from an account-owned completed imageToVideo task. Extension tasks cannot be chained.
  • imageToPrompt: synchronously derive prompt suggestions from a source image.
  • shortenPrompt: synchronously turn a prompt into 1 to 5 concise suggestions.
  • getSeed: synchronously retrieve the seed for an account-owned completed Midjourney image.

Generated media URLs are temporary. Download and store results in your own durable storage.

Links

License

Licensed under the Apache License, Version 2.0.