# Nano Banana 2 > ادغام مدل هوش مصنوعی nano-banana-2 از طریق API با کارایی بالا و تعرفه مصرف منعطف. ## نمای کلی - **نقطه پایانی**: `POST https://api.muapi.ai/api/v1/nano-banana-2` - **مدل‌ها ID**: `nano-banana-2` - **دسته‌بندی**: متن به تصویر - **نسخه مدل**: v2 Text to Image - **خانواده مدل**: nano - **هزینه**: 0.06 credits(مدل‌ها) ## API MuApi ****:, `request_id`,, `status` `completed`。 `?webhook=YOUR_URL`, POST ()。 ****: `x-api-key` MuApi 。 https://muapi.ai/access-keys 。 ### 1. ```http POST https://api.muapi.ai/api/v1/nano-banana-2 Content-Type: application/json x-api-key: YOUR_API_KEY ``` **():** ```json { "prompt": "" } ``` **(همه):** ```json { "prompt": "", "aspect_ratio": "1:1", "google_search": false, "resolution": "1k", "output_format": "jpg" } ``` **:** ```json { "request_id": "abc123", "status": "processing" } ``` ### 2. نتیجه ```http GET https://api.muapi.ai/api/v1/predictions/{request_id}/result x-api-key: YOUR_API_KEY ``` `status` :`queued`、`pending`、`processing`、`completed`、`failed`、`cancelled`。 2–5 ,。 `completed` ,نتیجه URL `outputs` 。 **`completed` :** ```json { "id": "abc123", "status": "completed", "outputs": [ "https://cdn.muapi.ai/.../output.png" ], "urls": { "get": "https://api.muapi.ai/api/v1/predictions/abc123/result" }, "created_at": "2026-05-08T12:34:56Z", "has_nsfw_contents": [] } ``` ### CURL ```bash 1. 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":""}' | jq -r .request_id) 2. while :; do RESP=$(curl -s https://api.muapi.ai/api/v1/predictions/$REQUEST_ID/result -H "x-api-key: $MUAPI_API_KEY") STATUS=$(echo "$RESP" | jq -r .status) [ "$STATUS" = "completed" ] && echo "$RESP" | jq .outputs && break [ "$STATUS" = "failed" ] && echo "$RESP" && exit 1 sleep 3 done ``` ### پایتون ```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":""}) 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) ``` ## طرح ورودی (Input Schema) API : - **`prompt`** (`string`, __): پرامپت متنی برای توصیف و تولید تصویر. - **`aspect_ratio`** (`string`, __): The aspect ratio of the تصویر تولید شده. - پیش‌فرض: `"1:1"` - گزینه‌ها: `"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"` - **`google_search`** (`boolean`, __): تنظیم پارامتر Whether to use Google Search for prompt enhancement. جهت هدایت دقیق فرآیند تولید مدل. - پیش‌فرض: `false` - **`resolution`** (`string`, __): The resolution of the تصویر تولید شده. - پیش‌فرض: `"1k"` - گزینه‌ها: `"1k"`, `"2k"`, `"4k"` - **`output_format`** (`string`, __): The format of the تصویر خروجی. - پیش‌فرض: `"jpg"` - گزینه‌ها: `"jpg"`, `"png"` ## طرح خروجی (Output Schema) : - **`id`** (`string`): ID。 - **`status`** (`string`): :`queued`、`pending`、`processing`、`completed`、`failed`、`cancelled`。 - **`outputs`** (`array`): تصویر、ویدیوصدا URL。`status` `completed` 。 - **`urls.get`** (`string`): نتیجه。 - **`error`** (`string` | `null`): `status` `failed` 。 - **`created_at`** (`string`): ISO-8601 。 - **`has_nsfw_contents`** (`array of boolean`): NSFW 。 ## Webhook() URL `?webhook=https://your-server/path`。,MuApi POST URL,。 ## Agent MuApi MCP CLI, Agent(Claude Code、Cursor Agent) HTTP : ```bash # CLI npm install -g muapi-cli # muapi auth login # MuApi مدل‌ها MCP Agent muapi mcp serve ``` MCP مدل‌ها, `nano-banana-2`。 `muapi --help` (`muapi image generate`、`muapi video from-image` )。 ## مدل‌ها - [v2.1 Image Edit](https://muapi.ai/fa/playground/nano-banana-2-1-edit) - [Photo Packs](https://muapi.ai/fa/playground/photo-pack) - [Edit Image](https://muapi.ai/fa/playground/nano-banana-edit) - [متن به تصویر](https://muapi.ai/fa/playground/nano-banana) - [Image Effects](https://muapi.ai/fa/playground/nano-banana-effects) - [Pro Edit Image](https://muapi.ai/fa/playground/nano-banana-pro-edit) - [v2 Text to Image](https://muapi.ai/fa/playground/nano-banana-2) - [Lite Edit](https://muapi.ai/fa/playground/nano-banana-2-lite-edit) - [Lite](https://muapi.ai/fa/playground/nano-banana-2-lite) - [Text to Image Pro](https://muapi.ai/fa/playground/nano-banana-pro) - [v2 Image Edit](https://muapi.ai/fa/playground/nano-banana-2-edit) - [v2.1 Text to Image](https://muapi.ai/fa/playground/nano-banana-2-1) ## منابع و مستندات - [زمین بازی](https://muapi.ai/fa/playground/nano-banana-2) - [API ](https://muapi.ai/fa/playground/nano-banana-2/api) - [ llms.txt](https://muapi.ai/fa/llms.txt)