Skip to content

Midjourney接続ガイド プログラム例

  • 本章ではImagineタスクの送信を例に、OpenAI-HKのapi keyを使用してMidjourneyに接続する方法を紹介します
  • その他のAPIインターフェースについてはこちらをクリックしてください

前提条件

モード接続ポイント

  • 混合モード(削除予定) https://api.openai-hk.com
  • fastモード https://api.openai-hk.com/fast
  • relaxモード https://api.openai-hk.com/relax
  • 3つのモードの価格は異なります

curl 例

ステップ1: 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": ""
}'

ステップ2: タスクIDに基づいてタスク結果を取得

ステップ1で取得したタスク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"