Generate images with Nano Banana 2 via the Muapi REST API. Pay per generation — no subscription needed.
POST https://api.muapi.ai/api/v1/nano-banana-2Submit a job with your MuApi API key in the x-api-key header, then poll https://api.muapi.ai/api/v1/predictions/{request_id}/result until status is completed.
| Name | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Text prompt describing the desired image content. |
| aspect_ratio | string | No | The aspect ratio of the generated image.Options: 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, AutoDefault: "1:1" |
| google_search | boolean | No | Whether to use Google Search for prompt enhancement.Default: false |
| resolution | string | No | The resolution of the generated image.Options: 1k, 2k, 4kDefault: "1k" |
| output_format | string | No | The format of the output image.Options: jpg, pngDefault: "jpg" |
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"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)Full docs and agent/MCP integration: llms.txt. Get an API key at muapi.ai/access-keys.