Skip to content

Midjourney接入示例

Midjourney官方是没有提供API的,该API是基于开源项目https://github.com/novicezk/midjourney-proxy 对官方进行的代理封装

接入示例

  • 本章以提交Imagine任务为例子介绍如何使用72Live的api key接入Midjourney;
  • 点击这里查看更多API接口

前提条件

接口Url Base地址: https://api.72live.com

Curl方式

第一步:提交Imagine任务

接口文档
提交任务,prompt": "black dog",并获取到任务ID result:1718274196642119

shell
curl -X POST \
  --url https://api.72live.com/mj/submit/imagine \
  --header 'Authorization: Bearer 你的APIKEY' \    
  -H "Content-Type: application/json" \
  --data '{
  "base64Array": [],
  "instanceId": "",
  "modes": [],
  "notifyHook": "",
  "prompt": "black dog",
  "remix": true,
  "state": ""
}'

第二步:根据任务ID获取任务结果

接口文档
由第一步得到任务ID为 1718274196642119 得到返回结果。

shell
curl -X GET \
  --url https://api.72live.com/mj/task/1718276018211374/fetch \
  --header 'Authorization: Bearer 你的APIKEY' \
  -H "Content-Type: application/json"