Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ HUGGINGFACE_TOKEN="verify human https://huggingface.co/docs/hub/security-tokens"
PROXY_URL="http://127.0.0.1:7890"
BASE_URL="https://discord.com"
WS_BASE_URL="wss://gateway.discord.gg?v=9&encoding=json&compress=gzip-stream"

MONGODB_URL='mongodb://mongodb:27017/midjourney'
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bug report
description: Create a report to help us improve
labels:
labels:
- bug

body:
Expand All @@ -25,7 +25,7 @@ body:

**Screenshots**
If applicable, add screenshots to help explain your problem.

validations:
required: true
- type: textarea
Expand Down
7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:alpine

RUN mkdir -p /app && chown -R node:node /app

WORKDIR /app

COPY package.json ./

USER node

RUN npm install --only=production

# COPY --chown=node:node . .

EXPOSE 3000
86 changes: 46 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# midjourney-client

Node.js client for the unofficial MidJourney api.

<div align="center">
<p>
<a href="https://discord.gg/GavuGHQbV4"><img src="https://img.shields.io/discord/1082500871478329374?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
Expand All @@ -20,40 +21,42 @@ yarn add midjourney

```typescript
import { Midjourney } from "midjourney";
const client = new Midjourney({
ServerId: <string>process.env.SERVER_ID,
ChannelId: <string>process.env.CHANNEL_ID,
SalaiToken: <string>process.env.SALAI_TOKEN,
Debug: true,
Ws:true,
});
await client.Connect();
const Imagine = await client.Imagine("A little pink elephant", (uri: string, progress:string) => {
console.log("Imagine", uri, "progress", progress);
});
console.log({ Imagine });

const Variation = await client.Variation({
index: 2,
msgId: <string>Imagine.id,
hash: <string>Imagine.hash,
flags: Imagine.flags,
loading: (uri: string, progress: string) => {
console.log("Variation.loading", uri, "progress", progress);
},
});
console.log({ Variation });
const Upscale = await client.Upscale({
index: 2,
msgId: <string>Variation.id,
hash: <string>Variation.hash,
flags: Variation.flags,
loading: (uri: string, progress: string) => {
console.log("Upscale.loading", uri, "progress", progress);
},
});
console.log({ Upscale });

const client = new Midjourney({
ServerId: <string>process.env.SERVER_ID,
ChannelId: <string>process.env.CHANNEL_ID,
SalaiToken: <string>process.env.SALAI_TOKEN,
Debug: true,
Ws: true,
});
await client.Connect();
const Imagine = await client.Imagine(
"A little pink elephant",
(uri: string, progress: string) => {
console.log("Imagine", uri, "progress", progress);
}
);
console.log({ Imagine });

const Variation = await client.Variation({
index: 2,
msgId: <string>Imagine.id,
hash: <string>Imagine.hash,
flags: Imagine.flags,
loading: (uri: string, progress: string) => {
console.log("Variation.loading", uri, "progress", progress);
},
});
console.log({ Variation });
const Upscale = await client.Upscale({
index: 2,
msgId: <string>Variation.id,
hash: <string>Variation.hash,
flags: Variation.flags,
loading: (uri: string, progress: string) => {
console.log("Upscale.loading", uri, "progress", progress);
},
});
console.log({ Upscale });
```

## Example
Expand All @@ -76,12 +79,12 @@ npm install
```

3. set the environment variables
- [How to get your Discord SALAI_TOKEN:](https://www.androidauthority.com/get-discord-token-3149920/)
- [Create a server](https://discord.com/blog/starting-your-first-discord-server) and [Invite Midjourney Bot to Your Server](https://docs.midjourney.com/docs/invite-the-bot)
OR [Join my discord server](https://discord.com/invite/GavuGHQbV4)
- How to get server and channel ids:
when you click on a channel in your server in the browser expect to have the follow URL pattern `https://discord.com/channels/$SERVER_ID/$CHANNEL_ID`

- [How to get your Discord SALAI_TOKEN:](https://www.androidauthority.com/get-discord-token-3149920/)
- [Create a server](https://discord.com/blog/starting-your-first-discord-server) and [Invite Midjourney Bot to Your Server](https://docs.midjourney.com/docs/invite-the-bot)
OR [Join my discord server](https://discord.com/invite/GavuGHQbV4)
- How to get server and channel ids:
when you click on a channel in your server in the browser expect to have the follow URL pattern `https://discord.com/channels/$SERVER_ID/$CHANNEL_ID`

```bash
#example variables, please set up yours
Expand All @@ -101,7 +104,7 @@ npx tsx example/imagine-ws.ts
- [x] `/imagine` `variation` `upscale` `reroll` `blend` `zoomout` `vary`
- [x] `/info`
- [x] `/fast ` and `/relax `
- [x] `/describe`
- [x] `/describe`
- [x] `/settings` `reset`
- [x] verify human
- [x] [proxy](https://github.com/erictik/midjourney-discord/blob/main/examples/proxy.ts)
Expand All @@ -112,6 +115,9 @@ npx tsx example/imagine-ws.ts
- [midjourney-discord](https://github.com/erictik/midjourney-discord)-bot
- [phrame](https://github.com/jakowenko/phrame)
---

<a href='https://ko-fi.com/erictik' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee' /></a>

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=erictik/midjourney-client&type=Date)](https://star-history.com/#erictik/midjourney-client&Date)
4 changes: 1 addition & 3 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ description: MidJourney API. Unofficial Node.js client

# 👋 MidJourney Node Client

[![Discord server](https://img.shields.io/discord/1082500871478329374?color=5865F2\&logo=discord\&logoColor=white)](https://discord.gg/GavuGHQbV4) [![npm version](https://img.shields.io/npm/v/midjourney.svg?maxAge=3600)](https://www.npmjs.com/package/midjourney)
[![Discord server](https://img.shields.io/discord/1082500871478329374?color=5865F2&logo=discord&logoColor=white)](https://discord.gg/GavuGHQbV4) [![npm version](https://img.shields.io/npm/v/midjourney.svg?maxAge=3600)](https://www.npmjs.com/package/midjourney)

## Get Started



{% content-ref url="getting-started/quickstart.md" %}
[quickstart.md](getting-started/quickstart.md)
{% endcontent-ref %}
54 changes: 27 additions & 27 deletions doc/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# Table of contents

* [👋 MidJourney Node Client](README.md)
- [👋 MidJourney Node Client](README.md)

## 📓 Getting started

* [Quickstart](getting-started/quickstart.md)
* [Install](getting-started/install.md)
* [Config](getting-started/config.md)
* [API Reference](getting-started/api-reference/README.md)
* [imagine](getting-started/api-reference/imagine.md)
* [variation](getting-started/api-reference/variation.md)
* [upscale](getting-started/api-reference/upscale.md)
* [reroll](getting-started/api-reference/reroll.md)
* [blend](getting-started/api-reference/blend.md)
* [describe](getting-started/api-reference/describe.md)
* [info](getting-started/api-reference/info.md)
* [fast](getting-started/api-reference/fast.md)
* [relax](getting-started/api-reference/relax.md)
* [setting](getting-started/api-reference/setting.md)
* [reset](getting-started/api-reference/reset.md)
* [Example](getting-started/example/README.md)
* [Imagine](getting-started/example/imagine.md)
- [Quickstart](getting-started/quickstart.md)
- [Install](getting-started/install.md)
- [Config](getting-started/config.md)
- [API Reference](getting-started/api-reference/README.md)
- [imagine](getting-started/api-reference/imagine.md)
- [variation](getting-started/api-reference/variation.md)
- [upscale](getting-started/api-reference/upscale.md)
- [reroll](getting-started/api-reference/reroll.md)
- [blend](getting-started/api-reference/blend.md)
- [describe](getting-started/api-reference/describe.md)
- [info](getting-started/api-reference/info.md)
- [fast](getting-started/api-reference/fast.md)
- [relax](getting-started/api-reference/relax.md)
- [setting](getting-started/api-reference/setting.md)
- [reset](getting-started/api-reference/reset.md)
- [Example](getting-started/example/README.md)
- [Imagine](getting-started/example/imagine.md)

## FAQ

* [vercel](faq/vercel.md)
* [node.js <18](faq/node.js-less-than-18.md)
* [proxy](faq/proxy.md)
* [How to get your Discord Token](https://www.androidauthority.com/get-discord-token-3149920/)
* [Invite Midjourney Bot to Your Server](https://docs.midjourney.com/docs/invite-the-bot)
- [vercel](faq/vercel.md)
- [node.js <18](faq/node.js-less-than-18.md)
- [proxy](faq/proxy.md)
- [How to get your Discord Token](https://www.androidauthority.com/get-discord-token-3149920/)
- [Invite Midjourney Bot to Your Server](https://docs.midjourney.com/docs/invite-the-bot)

***
---

* [Join the Beta](https://discord.com/invite/GavuGHQbV4)
- [Join the Beta](https://discord.com/invite/GavuGHQbV4)

## Use Cases

* [🎨 Web UI](use-cases/web-ui.md)
* [🤖 Discord Bot](use-cases/discord-bot.md)
- [🎨 Web UI](use-cases/web-ui.md)
- [🤖 Discord Bot](use-cases/discord-bot.md)
1 change: 0 additions & 1 deletion doc/faq/node.js-less-than-18.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# node.js <18

1 change: 0 additions & 1 deletion doc/faq/proxy.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# proxy

1 change: 0 additions & 1 deletion doc/faq/vercel.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# vercel

1 change: 0 additions & 1 deletion doc/getting-started/api-reference/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# API Reference

1 change: 0 additions & 1 deletion doc/getting-started/api-reference/blend.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# blend

1 change: 0 additions & 1 deletion doc/getting-started/api-reference/describe.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# describe

1 change: 0 additions & 1 deletion doc/getting-started/api-reference/fast.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# fast

2 changes: 0 additions & 2 deletions doc/getting-started/api-reference/imagine.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# imagine



<pre class="language-typescript"><code class="lang-typescript"><strong>import { Midjourney } from "midjourney";
</strong>async function main() {
const client = new Midjourney({
Expand Down
1 change: 0 additions & 1 deletion doc/getting-started/api-reference/info.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# info

1 change: 0 additions & 1 deletion doc/getting-started/api-reference/relax.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# relax

1 change: 0 additions & 1 deletion doc/getting-started/api-reference/reroll.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# reroll

1 change: 0 additions & 1 deletion doc/getting-started/api-reference/reset.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# reset

1 change: 0 additions & 1 deletion doc/getting-started/api-reference/setting.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# setting

1 change: 0 additions & 1 deletion doc/getting-started/api-reference/upscale.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# upscale

1 change: 0 additions & 1 deletion doc/getting-started/api-reference/variation.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# variation

1 change: 0 additions & 1 deletion doc/getting-started/example/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Example

1 change: 0 additions & 1 deletion doc/getting-started/example/image.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Image

1 change: 0 additions & 1 deletion doc/getting-started/example/imagine.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Imagine

28 changes: 15 additions & 13 deletions doc/getting-started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
{% tabs %}
{% tab title="Typescirpt" %}
{% code overflow="wrap" lineNumbers="true" %}

```typescript
import { Midjourney } from "midjourney";

Expand All @@ -41,28 +42,29 @@ const msg = await client.Imagine(
);
console.log({ msg });
```

{% endcode %}
{% endtab %}

{% tab title="Javascirpt" %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
const { Midjourney } = require("midjourney");

const client = new Midjourney({
ServerId: "1082500871478329374",
ChannelId: "1094892992281718894",
SalaiToken: "your discord token",
Debug: true,
Ws:true,
});
const msg = await client.Imagine("A little pink elephant", (uri, progress) => {
console.log("loading:", uri, "progress:", progress);
});
console.log({ msg });


const client = new Midjourney({
ServerId: "1082500871478329374",
ChannelId: "1094892992281718894",
SalaiToken: "your discord token",
Debug: true,
Ws: true,
});
const msg = await client.Imagine("A little pink elephant", (uri, progress) => {
console.log("loading:", uri, "progress:", progress);
});
console.log({ msg });
```

{% endcode %}
{% endtab %}
{% endtabs %}
Loading