Nano Banana 2 API: AI画像生成

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

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

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

Nano Banana 2 APIリファレンス

エンドポイント

POST https://api.muapi.ai/api/v1/nano-banana-2

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

パラメータ

名前型必須説明
promptstringはい生成する画像の内容を詳細に記述するプロンプト。
aspect_ratiostringいいえThe aspect ratio of the generated image.選択肢: 1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9, Autoデフォルト: "1:1"
google_searchbooleanいいえ是否使用 Google Search 增强プロンプト。デフォルト: false
resolutionstringいいえThe resolution of the generated image.選択肢: 1k, 2k, 4kデフォルト: "1k"
output_formatstringいいえThe format of the output image.選択肢: jpg, pngデフォルト: "jpg"

cURLの例

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