How to Install and Use the Midjourney Proxy Plugin with Webman

This guide explains how to set up the full‑function Midjourney proxy plugin on the Webman framework, covering installation, configuration, Nginx/WSS proxy examples, and detailed API endpoints for image generation, blending, describing, and task management.

Open Source Tech Hub
Open Source Tech Hub
Open Source Tech Hub
How to Install and Use the Midjourney Proxy Plugin with Webman

midjourney-proxy

Full‑function Midjourney proxy supporting all drawing features, high performance, stable, free.

Features

Imagine (image generation)

Imagine with image padding

Pan (directional expansion)

ZoomOut (standard upscaling)

Custom Zoom (user‑defined upscaling)

Vary (regional redraw)

Make Square

Real‑time task progress

Blend (image mixing)

Describe (image‑to‑text)

Account pool management

Banned‑word settings

Image CDN replacement

Installation

Install the Webman framework first (skip if already installed): composer create-project workerman/webman Enter the Webman directory and require the Midjourney plugin:

cd webman
composer require webman/midjourney

Configuration

Edit config/plugin/webman/midjourney/process.php and configure the array (replace placeholder values with your own token, guild_id, channel_id, and useragent):

<?php
use Webman\Midjourney\TaskStore\File;
return [
    'server' => [
        'handler' => Webman\Midjourney\Server::class,
        'listen' => 'http://0.0.0.0:8686',
        'reloadable' => false,
        'constructor' => [
            'config' => [
                'accounts' => [
                    [
                        'enable' => true,
                        'token' => '<获取方式参见下面>',
                        'guild_id' => '<获取方式参见下面>',
                        'channel_id' => '<获取方式参见下面>',
                        'useragent' => '<获取方式参见下面>',
                        'concurrency' => 3, // 3 for $10/$30 users, 12 for $60/$120 users
                        'timeoutMinutes' => 10, // task timeout after 10 minutes
                    ]
                ],
                'proxy' => [
                    'server' => 'https://discord.com',
                    'cdn' => 'https://cdn.discordapp.com',
                    'gateway' => 'wss://gateway.discord.gg',
                    'upload' => 'https://discord-attachments-uploads-prd.storage.googleapis.com',
                ],
                'store' => [
                    'handler' => File::class,
                    'expiredDates' => 30,
                    File::class => [
                        'dataPath' => runtime_path() . '/data/midjourney',
                    ],
                ],
                'settings' => [
                    'debug' => false,
                    'secret' => '', // optional API secret, sent in header mj-api-secret
                    'notifyUrl' => '', // leave empty for Webman AI projects
                    'apiPrefix' => '',
                    'tmpPath' => runtime_path() . '/tmp/midjourney',
                ],
            ],
        ],
    ],
];

Obtain token, guild_id, channel_id and useragent from the guide at https://www.workerman.net/a/1654.

Proxy Example

HTTPS proxy with Nginx

Each domain used by Midjourney must have a proxy. Example for discord.com:

server {
  listen 80;
  server_name your_domain.com;
  proxy_buffer_size 64k;
  proxy_buffers 32 64k;
  proxy_busy_buffers_size 128k;
  location ^~ / {
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_ssl_server_name on;
    proxy_pass https://discord.com;
    proxy_set_header Host discord.com;
    proxy_set_header Referer "";
  }
}

WebSocket (wss) proxy

gateway.discord.gg

uses the WebSocket protocol, so the proxy differs slightly:

server {
  listen 80;
  server_name your_wss_domain.top;
  proxy_buffer_size 64k;
  proxy_buffers 32 64k;
  proxy_busy_buffers_size 128k;

  location ^~ / {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_http_version 1.1;
    proxy_ssl_server_name on;
    proxy_pass https://gateway.discord.gg;
    proxy_set_header Host gateway.discord.gg;
    proxy_set_header Referer "";
  }
}

API Endpoints

/image/imagine (draw image)

POST JSON parameters:

{
  "prompt": "a cat",
  "images": ["url1", "url2"], // optional
  "notifyUrl": "https://your-server.com/notify" // optional
}

Response JSON:

{
  "code": 0,
  "msg": "ok",
  "taskId": "1710816049856103374",
  "data": []
}

/image/action (operate on a task)

POST JSON parameters:

{
  "taskId": "1710816049856103374",
  "customId": "MJ::JOB::upsample::1::749b4d14-...",
  "notifyUrl": "https://your-server.com/notify" // optional
}

Response JSON:

{
  "code": 0,
  "msg": "ok",
  "taskId": "1710816302060986090",
  "data": []
}

/image/describe (image‑to‑text)

POST JSON parameters:

{
  "images": ["url"],
  "notifyUrl": "https://your-server.com/notify" // optional
}

Response JSON:

{
  "code": 0,
  "msg": "ok",
  "taskId": "1710816302060386071",
  "data": []
}

/image/blend (mix images)

POST JSON parameters:

{
  "images": ["url1", "url2"],
  "notifyUrl": "https://your-server.com/notify" // optional
}

Response JSON:

{
  "code": 0,
  "msg": "ok",
  "taskId": "1710816302060354172",
  "data": []
}

/task/status (query task status)

GET request with taskId query parameter, e.g. /task/status?taskId=1710816049856103374.

Response JSON includes fields such as id, action, status, timestamps, progress, image URLs, prompt information, and buttons for further actions.

{
  "code": 0,
  "msg": "success",
  "data": {
    "id": "1710816049856103374",
    "action": "IMAGINE",
    "status": "FINISHED",
    "submitTime": 1710903739,
    "startTime": 1710903739,
    "finishTime": 1710903844,
    "progress": "100%",
    "imageUrl": "https://your_cdn.com/...",
    "imageRawUrl": "https://cdn.discordapp.com/...",
    "prompt": "A cat. --v 6.0 --relax",
    "finalPrompt": "A cat. --v 6.0 --relax",
    "params": [],
    "images": [],
    "description": null,
    "failReason": null,
    "discordId": "1148151204875075657",
    "data": [],
    "buttons": []
  }
}

Field meanings

id : task identifier

action : task type (IMAGINE, UPSCALE, VARIATION, etc.)

status : PENDING, STARTED, SUBMITTED, RUNNING, FINISHED, FAILED

submitTime / startTime / finishTime : timestamps

progress : 0%‑100% completion

imageUrl : CDN‑rewritten image address

imageRawUrl : original Discord image address (may be blocked in China)

prompt / finalPrompt : original and final prompts used by Midjourney

params : task‑related parameters

images : array of image URLs related to the task

description : result of a DESCRIBE task

failReason : non‑null when the task fails

discordId : Discord identifier of the task

data : custom data attached to the task

buttons : operation buttons; each custom_id corresponds to the customId parameter of the /image/action endpoint

Action value reference

IMAGINE – draw image

UPSCALE – select image

VARIATION – regional redraw

REROLL – regenerate

DESCRIBE – image‑to‑text

BLEND – mix images

ZOOMOUT – upscaling

ZOOMOUT_CUSTOM – custom upscaling

PANLEFT / PANRIGHT / PANUP / PANDOWN – directional pan

MAKE_SQUARE – convert to square

PIC_READER – extract text from image then generate

CANCEL_JOB – cancel task

UPSCALE_V5_2X / UPSCALE_V5_4X – v5 upscaling

UPSCALE_V6_2X_CREATIVE / UPSCALE_V6_2X_SUBTLE – v6 upscaling variants

VARIATION_STRONG / VARIATION_SUBTLE – strong or subtle variation

VARIATION_REGION – regional variation

notifyUrl format

If notifyUrl is set, Midjourney will POST a JSON payload with the same structure as the data field of the /task/status response whenever the task status changes.
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PHPimage generationMidjourneyWebman
Open Source Tech Hub
Written by

Open Source Tech Hub

Sharing cutting-edge internet technologies and practical AI resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.