🔥 Black Friday AI API deals are live· 🎬 Seedance 2.5 — 20% off, up to 42% below market, until Nov 30Ends in--d --:--:--See deals →

Midjourney V7 API: AI 图像生成

通过 Muapi REST API 使用 Midjourney V7生成图像。按次生成付费,无需订阅。

交互式模型控制

使用 Midjourney V7 每次生成 4 张照片级图像。支持文生图,并可通过 `source_image_url` 引导参考图像。

Midjourney V7 API 文档

端点

POST https://api.muapi.ai/api/v1/midjourney-v7

使用 Muapi API 密钥在 x-api-key 请求头中提交任务,然后轮询 https://api.muapi.ai/api/v1/predictions/{request_id}/result 直到状态变为 completed。

参数

名称类型必填描述
promptstring是要生成的图像的文本描述。
image_urlstring否可选的 reference image URL. Influences the style and content of the generation.
aspect_ratiostring否输出图像画面比例。选项: 1:1, 16:9, 9:16, 3:4, 4:3, 21:9默认值: "1:1"
stylizeint否控制结果的艺术化程度。范围:0–1000。数值越低越贴近提示词,越高越具风格化。默认值: 100
chaosint否控制 4 张图像之间的变化程度。范围:0–100。数值越高越多样。默认值: 0
weirdint否增添独特的美学效果。范围:0–3000。默认值: 0
negative_promptstring否要从图像中排除的内容,例如“text, watermark”。
seedint否可复现种子。范围:0–4294967295。相同种子和相同提示词通常会产生相近结果。默认值: 0

cURL 示例

REQUEST_ID=$(curl -s -X POST https://api.muapi.ai/api/v1/midjourney-v7 \
  -H "x-api-key: $MUAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"<prompt>"}' | jq -r .request_id)

curl -s https://api.muapi.ai/api/v1/predictions/$REQUEST_ID/result -H "x-api-key: $MUAPI_API_KEY"

Python 示例

import os, time, requests

API = "https://api.muapi.ai/api/v1"
headers = {"x-api-key": os.environ["MUAPI_API_KEY"]}

r = requests.post(f"{API}/midjourney-v7", headers=headers, json={"prompt":"<prompt>"})
request_id = r.json()["request_id"]

while True:
    res = requests.get(f"{API}/predictions/{request_id}/result", headers=headers).json()
    if res["status"] == "completed":
        print(res["outputs"]); break
    if res["status"] == "failed":
        raise RuntimeError(res.get("error"))
    time.sleep(3)

完整文档及 Agent/MCP 集成: llms.txt. 在此获取 API 密钥: muapi.ai/access-keys.