Imagen 4 API: AI画像生成

Muapi REST API経由でImagen 4を使用して画像を生成。従量課金制 — サブスクリプション不要。

インタラクティブなモデルコントロール

MuAPIの低遅延APIを通じてgoogle-imagen4モデルを統合。従量課金制で柔軟かつスケーラブルに利用可能です。

Imagen 4 APIリファレンス

エンドポイント

POST https://api.muapi.ai/api/v1/google-imagen4

x-api-keyヘッダーにMuapi APIキーを設定してタスクを送信し、 https://api.muapi.ai/api/v1/predictions/{request_id}/result ステータスがcompletedになるまでポーリングします。

パラメータ

名前型必須説明
promptstringはいText prompt describing the image, what you want the final edited image to look like.
aspect_ratiostringいいえ生成メディアのアスペクト比(例:16:9、9:16、1:1など)。選択肢: 16:9, 9:16, 1:1, 4:3, 3:4デフォルト: "1:1"
num_imagesintいいえ1回のリクエストで生成するメディアの個数。デフォルト: 1

cURLの例

REQUEST_ID=$(curl -s -X POST https://api.muapi.ai/api/v1/google-imagen4 \
  -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}/google-imagen4", 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)

完全なドキュメントとエージェント/MCP統合: llms.txt. APIキーの取得はこちら: muapi.ai/access-keys.