Midjourney接入向导 程序实例
- 本章以
提交Imagine任务
为例子介绍如何使用OpenAI-HK的api key
接入Midjourney; - 点击这里查看更多API接口
前提
- 登录OpenAI-HK控制台,获取API Key
模式接入点
- 混合模式(将去除)
https://api.openai-hk.com
- fast模式
https://api.openai-hk.com/fast
- relax模式
https://api.openai-hk.com/relax
- 3中模式价格不一致
curl 实例
第一步:提交Imagine任务
接口说明 获取到任何ID result:1320098173412546
shell
curl --request POST \ --url https://api.openai-hk.com/fast/mj/submit/imagine \ --header 'Authorization: Bearer hk-替换为你的key' \ -H "Content-Type: application/json" \ --data '{ "base64Array": [], "instanceId": "", "modes": [], "notifyHook": "https://ww.baidu.com/notifyHook/back", "prompt": "black cat", "remix": true, "state": "" }'
curl --request POST \ --url https://api.openai-hk.com/fast/mj/submit/imagine \ --header 'Authorization: Bearer hk-替换为你的key' \ -H "Content-Type: application/json" \ --data '{ "base64Array": [], "instanceId": "", "modes": [], "notifyHook": "https://ww.baidu.com/notifyHook/back", "prompt": "black cat", "remix": true, "state": "" }'
第二步:根据任务ID获取任务结果
由第一步得到任务ID为 :1320098173412546
得到返回结果。
返回结果说明,请参考返回结果说明
shell
curl --request GET \ --url https://api.openai-hk.com/fast/mj/task/1320098173412546/fetch \ --header 'Authorization: Bearer hk-替换为你的key' \ -H "Content-Type: application/json"
curl --request GET \ --url https://api.openai-hk.com/fast/mj/task/1320098173412546/fetch \ --header 'Authorization: Bearer hk-替换为你的key' \ -H "Content-Type: application/json"