---
title: "Deploy Your Own (Not) Midjourney Bot on Fly GPUs"
description: "This tutorial builds a Discord image-generation bot that uses Fooocus, an open-source interface for Stable Diffusion, to provide a Midjourney-like /imagine command. It separates the system into a normal Fly Machine running a Python Pycord bot and a GPU Machine running Fooocus-API, with Flycast connecting them over Fly.io’s private network. The bot defers Discord responses, polls for the generated image each second, and uploads the resulting file, while the post notes that this blocking flow will not perform well for hundreds of simultaneous users. Fly GPU rootfs supports the nearly 12GB image, and an L40S setup costs about $3.20/hr when running, with scale-to-zero intended to avoid charges for unused compute. GPU activity is verified with nvidia-smi, and the source code can be extended with additional commands and image-to-image features."
---

# Deploy Your Own (Not) Midjourney Bot on Fly GPUs

[Fly.io](https://yomu.fyi/company/fly-io) · Jan 4, 2024

**Type:** Tutorial

## Summary

This tutorial builds a Discord image-generation bot that uses Fooocus, an open-source interface for Stable Diffusion, to provide a Midjourney-like /imagine command. It separates the system into a normal Fly Machine running a Python Pycord bot and a GPU Machine running Fooocus-API, with Flycast connecting them over Fly.io’s private network. The bot defers Discord responses, polls for the generated image each second, and uploads the resulting file, while the post notes that this blocking flow will not perform well for hundreds of simultaneous users. Fly GPU rootfs supports the nearly 12GB image, and an L40S setup costs about $3.20/hr when running, with scale-to-zero intended to avoid charges for unused compute. GPU activity is verified with nvidia-smi, and the source code can be extended with additional commands and image-to-image features.

## Context

The project provides an easier way to access Stable Diffusion through Discord, using Fooocus to reduce manual configuration while deploying the bot and image-synthesis API separately. The post also addresses GPU image size, private service communication, scale-to-zero, and the cost of running an L40S.

## Approach / What changed

Deploy a Python Pycord Discord bot on a normal Fly Machine and Fooocus-API on a Fly GPU Machine. Connect them through Flycast over Fly.io’s private network, use Discord’s deferred responses and polling to deliver generated files, and verify GPU usage with nvidia-smi.

## Takeaways

- Fooocus adds GPT-2-based prompt expansion and supports style chaining, aspect ratios, and negative prompts for image generation.
- The bot’s image-generation flow is blocking and polls the filesystem every second, so the post says it will not perform well for hundreds of concurrent Discord users.
- An L40S GPU costs $2.50/hr on demand; with VM resources and model storage, the post estimates about $3.20/hr while the GPU Machine is running.

**Tags:** [Fly](https://yomu.fyi/topic/fly), [GPU](https://yomu.fyi/topic/gpu), [Open Source](https://yomu.fyi/topic/open-source), [Python](https://yomu.fyi/topic/python), [Stable Diffusion](https://yomu.fyi/topic/stable-diffusion)

- Source: [Fly.io](https://fly.io/blog/not-midjourney-bot)
- Source URL: https://fly.io/blog/not-midjourney-bot
- Ingested by Yomu: 2026-09-02T11:59:44.390Z

[Read original post](https://fly.io/blog/not-midjourney-bot)
