{"id":13602112,"url":"https://github.com/souying/Midjourney-node-api","last_synced_at":"2025-04-11T08:31:33.098Z","repository":{"id":166385987,"uuid":"641872589","full_name":"souying/Midjourney-node-api","owner":"souying","description":"Midjourney-api,nodejs,非官方api，Midjourney绘画，Node.js client for the unofficial MidJourney API.","archived":false,"fork":false,"pushed_at":"2023-06-16T02:50:50.000Z","size":53,"stargazers_count":84,"open_issues_count":7,"forks_count":17,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-07T05:38:35.848Z","etag":null,"topics":["midjourney","midjourney-api","midjourney-api-bot","midjourney-node-api","node"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/souying.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-05-17T10:44:35.000Z","updated_at":"2024-08-12T20:31:21.000Z","dependencies_parsed_at":"2024-01-14T05:06:51.354Z","dependency_job_id":"7273bb38-1d67-47d4-add0-1924390fb51e","html_url":"https://github.com/souying/Midjourney-node-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/souying%2FMidjourney-node-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/souying%2FMidjourney-node-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/souying%2FMidjourney-node-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/souying%2FMidjourney-node-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/souying","download_url":"https://codeload.github.com/souying/Midjourney-node-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248361554,"owners_count":21090930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["midjourney","midjourney-api","midjourney-api-bot","midjourney-node-api","node"],"created_at":"2024-08-01T18:01:14.411Z","updated_at":"2025-04-11T08:31:32.686Z","avatar_url":"https://github.com/souying.png","language":"JavaScript","readme":"# Midjourney-node-api\n\n代理 MidJourney 的discord频道，实现api形式调用AI绘图  \n\n前端大佬感兴趣的快速提pr, 本人不是专业后端,代码不保证无bug    \n\n## 现有功能\n- [x] 支持 Imagine、U、V 指令，绘图完成后回调  \n- [x] 支持队列执行  \n- [x] 支持中文 prompt 翻译，需配置百度翻译\n- [x] 队列任务存储在本地小型数据库  \n- [x] docker\u0026docker-compose安装 \n\n## 后续计划\n- [ ] 定时清空所有任务  \n- [ ] 账号池子（暂定）\n- [ ] 看情况优化 \n- [ ] 对接阿里OSS  \n\n## 使用前提\n1. 科学上网\n2. node环境 node 18版本以上\n3. 注册 MidJourney，创建自己的频道，参考 https://docs.midjourney.com/docs/quick-start\n\n## docker部署：\n\n1.运行docker容器\n\n- Docker一键命令：\n\n```\ndocker run -dit \\\n  -v $PWD/Midjourney/basedata:/Midjourney/basedata \\\n  -p 5400:3000 \\\n  --restart=always \\\n  --name midjourney \\\ngrbhq/midjourney:latest\n```\n\n- docker-compose一键部署[需安装docker-compose工具]：\n\n```\nwget -O docker-compose.yaml https://raw.githubusercontent.com/souying/Midjourney-node-api/main/docker-compose.yaml \u0026\u0026 docker-compose up -d\n```  \n\n2.进入当前`Midjourney/basedata`目录下修改`.env`文件 参考.env.example  \n\n3.重启docker容器(生效.env变量)  \n`docker restart midjourney`\n\n4.启动后访问服务器`ip:5400`\n\n## 快速启动\n1.确保服务器已经有node环境18以上    \n2.拉取代码   \n```\ngit clone https://github.com/souying/Midjourney-node-api.git\ncd Midjourney-node-api\n```\n3.下载依赖  \n```\nyarn\n# or npm\nnpm install\n```\n4.项目跟目录下新建 .env 文件 参考.env.example  \n\n5.启动项目 启动后访问127.0.0.1：3000    \n```\nnpm start   \n```\n6.在线接口文档 https://docs.apipost.cn/preview/c1f3039454fb9e67/02235e4d4590d910?target_id=78d9eb39-d6f9-4ee5-b2fa-82ff6b15678e    \n\n7.端口修改/bin/www  3000改成其他  \n\n## API接口说明  \n\n#### 接口状态\n\u003e 已完成\n\n#### 接口URL\n\u003e http://127.0.0.1:3000/api/v1/trigger/submit?action=IMAGINE\u0026prompt=一只狗\u0026taskId=123456789\u0026index=1\u0026state=main\u0026notifyHook=http://www.baidu.com\n\n#### 请求方式\n\u003e GET\n\n#### Content-Type\n\u003e urlencoded\n\n#### 请求Query参数\n参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述\n--- | --- | --- | --- | ---\naction | IMAGINE | String | 是 | 动作: 必传，IMAGINE（绘图）、UPSCALE（选中放大）、VARIATION（选中变换）\nprompt | 一只狗 | String | 是 | 绘图参数: IMAGINE时必传\ntaskId | 123456789 | String | 是 | 任务ID: UPSCALE、VARIATION时必传\nindex | 1 | String | 是 | 图序号: 1～4，UPSCALE、VARIATION时必传，表示第几张图\nstate | main | String | 是 | 自定义字符串: 非必传，供回调到业务系统里使用\nnotifyHook | http://www.baidu.com | String | 是 | 支持每个任务配置不同回调地址，非必传\n#### 请求Body参数\n参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述\n--- | --- | --- | --- | ---\naction | IMAGINE | - | 是 | 动作: 必传，IMAGINE（绘图）、UPSCALE（选中放大）、VARIATION（选中变换）\nprompt | 一只狗 | - | 是 | 绘图参数: IMAGINE时必传\ntaskId | 123456789 | - | 是 | 任务ID: UPSCALE、VARIATION时必传\nindex | 1 | - | 是 | 图序号: 1～4，UPSCALE、VARIATION时必传，表示第几张图\nstate | main | - | 是 | 自定义字符串: 非必传，供回调到业务系统里使用\nnotifyHook | http://www.baidu.com | - | 是 | 支持每个任务配置不同回调地址，非必传  \n\n#### 成功响应示例\n```javascript\n{\n\t\"code\": 1,\n\t\"description\": \"成功\",\n\t\"result\": \"1234679\"\n}\n```\n#### 错误响应示例\n```javascript\n{\n\t\"code\": 0,\n\t\"description\": \"失败\"\n}\n```\n## /mj绘图相关api/提交绘画任务post\n```text\n提交任务，后台持续执行任务，成功或者失败后更改任务状态\n```\n#### 接口状态\n\u003e 已完成\n\n#### 接口URL\n\u003e http://127.0.0.1:3000/api/v1/trigger/submit\n\n#### 请求方式\n\u003e POST\n\n#### Content-Type\n\u003e urlencoded\n\n#### 请求Query参数\n参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述\n--- | --- | --- | --- | ---\naction | IMAGINE | String | 是 | 动作: 必传，IMAGINE（绘图）、UPSCALE（选中放大）、VARIATION（选中变换）\nprompt | 一只狗 | String | 是 | 绘图参数: IMAGINE时必传\ntaskId | 123456789 | String | 是 | 任务ID: UPSCALE、VARIATION时必传\nindex | 1 | String | 是 | 图序号: 1～4，UPSCALE、VARIATION时必传，表示第几张图\nstate | main | String | 是 | 自定义字符串: 非必传，供回调到业务系统里使用\nnotifyHook | http://www.baidu.com | String | 是 | 支持每个任务配置不同回调地址，非必传\n#### 请求Body参数\n参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述\n--- | --- | --- | --- | ---\naction | IMAGINE | - | 是 | 动作: 必传，IMAGINE（绘图）、UPSCALE（选中放大）、VARIATION（选中变换）\nprompt | 一只狗 | - | 是 | 绘图参数: IMAGINE时必传\ntaskId | 123456789 | - | 是 | 任务ID: UPSCALE、VARIATION时必传\nindex | 1 | - | 是 | 图序号: 1～4，UPSCALE、VARIATION时必传，表示第几张图\nstate | main | - | 是 | 自定义字符串: 非必传，供回调到业务系统里使用\nnotifyHook | http://www.baidu.com | - | 是 | 支持每个任务配置不同回调地址，非必传\n\n\n#### 成功响应示例\n```javascript\n{\n\t\"code\": 1,\n\t\"description\": \"成功\",\n\t\"result\": \"1234679\"\n}\n```\n#### 错误响应示例\n```javascript\n{\n\t\"code\": 0,\n\t\"description\": \"失败\"\n}\n```\n## /mj绘图相关api/查询单个任务get\n```text\n查询任务完成情况\n```\n#### 接口状态\n\u003e 已完成\n\n#### 接口URL\n\u003e http://127.0.0.1:3000/api/v1//task/fetch?_id=8a2c5959-143b-46c5-adb6-242652ac8141\n\n#### 请求方式\n\u003e GET\n\n#### Content-Type\n\u003e form-data\n\n#### 请求Query参数\n参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述\n--- | --- | --- | --- | ---\n_id | 8a2c5959-143b-46c5-adb6-242652ac8141 | String | 是 | 任务id\n#### 请求Body参数\n参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述\n--- | --- | --- | --- | ---\n_id | 8a2c5959-143b-46c5-adb6-242652ac8141 | - | 是 | 任务id\n\n#### 成功响应示例\n```javascript\n{\n\t\"_id\": \"8a2c5959-143b-46c5-adb6-242652ac8141\",\n\t\"index\": \"1\",\n\t\"action\": \"VARIATION\",\n\t\"prompt\": \"一只狗\",\n\t\"promptEn\": \"A dog\",\n\t\"taskId\": \"1108302168013938689\",\n\t\"uri\": \"f61e-4eac-9991-475799668483.png\",\n\t\"hash\": \"adbd1ba4-f61e-4eac-9991-475799668483\",\n\t\"content\": \"A dog--niji --seed 5587\",\n\t\"progress\": \"done\",\n\t\"description\": \"/imagine A dog\",\n\t\"submitTime\": 1684310738264,\n\t\"finishTime\": 1684310741027,\n\t\"state\": \"main\",\n\t\"notifyHook\": \"http://www.baidu.com\",\n\t\"imageUrl\": \"adbd1ba4-f61e-4eac-9991-475799668483.png\",\n\t\"status\": \"SUCCESS\"\n}\n```\n#### 错误响应示例\n```javascript\n{\n    code:0\n}\n```\n## /mj绘图相关api/查询单个任务post\n```text\n查询全部任务\n```\n#### 接口状态\n\u003e 已完成\n\n#### 接口URL\n\u003e http://127.0.0.1:3000/api/v1//task/fetch?_id=8a2c5959-143b-46c5-adb6-242652ac8141\n\n#### 请求方式\n\u003e POST\n\n#### Content-Type\n\u003e form-data\n\n#### 请求Query参数\n参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述\n--- | --- | --- | --- | ---\n_id | 8a2c5959-143b-46c5-adb6-242652ac8141 | String | 是 | 任务id\n#### 请求Body参数\n参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述\n--- | --- | --- | --- | ---\n_id | 8a2c5959-143b-46c5-adb6-242652ac8141 | - | 是 | 任务id\n\n#### 成功响应示例\n```javascript\n{\n\t\"_id\": \"8a2c5959-143b-46c5-adb6-242652ac8141\",\n\t\"index\": \"1\",\n\t\"action\": \"VARIATION\",\n\t\"prompt\": \"一只狗\",\n\t\"promptEn\": \"A dog\",\n\t\"taskId\": \"1108302168013938689\",\n\t\"uri\": \"f61e-4eac-9991-475799668483.png\",\n\t\"hash\": \"adbd1ba4-f61e-4eac-9991-475799668483\",\n\t\"content\": \"A dog--niji --seed 5587\",\n\t\"progress\": \"done\",\n\t\"description\": \"/imagine A dog\",\n\t\"submitTime\": 1684310738264,\n\t\"finishTime\": 1684310741027,\n\t\"state\": \"main\",\n\t\"notifyHook\": \"http://www.baidu.com\",\n\t\"imageUrl\": \"adbd1ba4-f61e-4eac-9991-475799668483.png\",\n\t\"status\": \"SUCCESS\"\n}\n```\n#### 错误响应示例\n```javascript\n{\n    code:0\n}\n```\n## /mj绘图相关api/查询任务列表post\n```text\n暂无描述\n```\n#### 接口状态\n\u003e 已完成\n\n#### 接口URL\n\u003e http://127.0.0.1:3000/api/v1//task/list\n\n#### 请求方式\n\u003e POST\n\n#### Content-Type\n\u003e form-data\n\n\n#### 成功响应示例\n```javascript\n[\n\t{\n\t\t\"_id\": \"8a2c5959-143b-46c5-adb6-242652ac8141\",\n\t\t\"index\": \"1\",\n\t\t\"action\": \"VARIATION\",\n\t\t\"prompt\": \"一只狗\",\n\t\t\"promptEn\": \"A dog\",\n\t\t\"taskId\": \"1108302168013938689\",\n\t\t\"uri\": \"f61e-4eac-9991-475799668483.png\",\n\t\t\"hash\": \"adbd1ba4-f61e-4eac-9991-475799668483\",\n\t\t\"content\": \"A dog--niji --seed 5587\",\n\t\t\"progress\": \"done\",\n\t\t\"description\": \"/imagine A dog\",\n\t\t\"submitTime\": 1684310738264,\n\t\t\"finishTime\": 1684310741027,\n\t\t\"state\": \"main\",\n\t\t\"notifyHook\": \"http://www.baidu.com\",\n\t\t\"imageUrl\": \"adbd1ba4-f61e-4eac-9991-475799668483.png\",\n\t\t\"status\": \"SUCCESS\"\n\t}\n]\n```\n#### 错误响应示例\n```javascript\n{\n    code:0\n}\n```\n## /mj绘图相关api/查询任务列表get\n```text\n暂无描述\n```\n#### 接口状态\n\u003e 已完成\n\n#### 接口URL\n\u003e http://127.0.0.1:3000/api/v1//task/list\n\n#### 成功响应示例\n```javascript\n[{\n\t\"_id\": \"8a2c5959-143b-46c5-adb6-242652ac8141\",\n\t\"index\": \"1\",\n\t\"action\": \"VARIATION\",\n\t\"prompt\": \"一只狗\",\n\t\"promptEn\": \"A dog\",\n\t\"taskId\": \"1108302168013938689\",\n\t\"uri\": \"f61e-4eac-9991-475799668483.png\",\n\t\"hash\": \"adbd1ba4-f61e-4eac-9991-475799668483\",\n\t\"content\": \"A dog--niji --seed 5587\",\n\t\"progress\": \"done\",\n\t\"description\": \"/imagine A dog\",\n\t\"submitTime\": 1684310738264,\n\t\"finishTime\": 1684310741027,\n\t\"state\": \"main\",\n\t\"notifyHook\": \"http://www.baidu.com\",\n\t\"imageUrl\": \"adbd1ba4-f61e-4eac-9991-475799668483.png\",\n\t\"status\": \"SUCCESS\"\n}]\n```\n#### 错误响应示例\n```javascript\n{\n    code:0\n}\n```\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouying%2FMidjourney-node-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsouying%2FMidjourney-node-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouying%2FMidjourney-node-api/lists"}