midjourney-api  by yokonsan

API for Midjourney image generation via Discord

created 2 years ago
882 stars

Top 41.8% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a Discord API wrapper for Midjourney, enabling programmatic access to image generation and manipulation features. It's designed for developers and power users who want to integrate Midjourney's capabilities into their own applications or workflows without direct Discord interaction. The primary benefit is automating complex image generation tasks.

How It Works

The system operates by interacting with Discord's API, specifically targeting the Midjourney bot. It uses a task queue (in-memory) to manage requests, which are then sent to the Discord API to trigger Midjourney bot commands. The bot processes these commands, and the system listens for responses to relay results back to the requesting application. This approach leverages the existing Midjourney bot infrastructure without requiring direct access to Midjourney's internal APIs.

Quick Start & Requirements

  • Installation: Clone the repository, install dependencies via pip install -r requirements.txt.
  • Prerequisites: A Discord account with Midjourney access, a Discord channel, and the Midjourney bot added to that channel. Environment variables (USER_TOKEN, BOT_TOKEN, GUILD_ID, CHANNEL_ID, CALLBACK_URL) must be configured in a .env file.
  • Running: Start the listener bot with python task_bot.py and the HTTP service with python server.py. Docker support is also available via start.sh and build.sh.
  • Docs: Swagger UI available at http://127.0.0.1:8062/docs.

Highlighted Details

  • Supports all core Midjourney functions: imagine, upscale, variation, zoomout, expand, describe, and image-to-image generation.
  • Includes features like sensitive word filtering and an in-memory task queue.
  • Provides a RESTful API with endpoints for each Midjourney action.
  • Offers a CALLBACK_URL for receiving real-time progress and results.

Maintenance & Community

The project is maintained by yokonsan. There are no explicit mentions of community channels (like Discord/Slack) or a public roadmap in the README.

Licensing & Compatibility

The README does not explicitly state a license. Given the nature of interacting with Discord and Midjourney, users should be aware of potential terms of service violations for both platforms. Commercial use is not explicitly addressed.

Limitations & Caveats

The task queue is in-memory, meaning it will not persist across restarts. The project relies on reverse-engineering Discord interactions, which could be subject to change or breakage if Discord or Midjourney updates their APIs or bot behavior. There are no automated tests included.

Health Check
Last commit

11 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
10 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.