# Muse Image Generation > Generate and edit images with Muse Image using text prompts, up to 10 reference images, and 10 aspect ratios **API:** POST https://toapis.com/v1/images/generations **Note:** **Note for users in mainland China:** Please use `https://toapis.cn` as the API endpoint (Base URL). Replace `https://toapis.com` with `https://toapis.cn` in the examples below. - Model ID: `muse-image` - Supports text-to-image generation and reference-image editing (passing `image_urls` automatically switches to image-to-image mode) - Supports `10` aspect ratios with flat per-image billing and no separate resolution or quality tier selection - Asynchronous task endpoint returning a unified `generation.task`; use the returned task `id` to query results **Warning:** `image_urls` only accepts publicly accessible HTTP(S) image URLs, not base64 or Data URI payloads. Use the [Upload Image API](/docs/en/api-reference/uploads/images) to upload local images and obtain URLs first. ## Authentication **Authorization (string, required)** All requests require a Bearer Token. Get your API Key from the [API Key Management Page](https://toapis.com/console/token). ```text Authorization: Bearer YOUR_API_KEY ``` ## Request Parameters **model (string, required)** Default: "muse-image" Image generation model name, fixed to `muse-image`. **prompt (string, required)** Text description for image generation or editing. Supports both English and Chinese prompts. **size (string)** Default: "1:1" Output image aspect ratio (also accepts `aspect_ratio`). Defaults to `1:1`. Supported values (10 ratios): - `1:1` - `2:3`, `3:2` - `3:4`, `4:3` - `4:5`, `5:4` - `9:16`, `16:9` - `21:9` Output dimensions are determined automatically for the selected aspect ratio. Separate resolution (`resolution` / `image_size`) and quality (`quality`) tiers are not used. **n (integer)** Default: 1 Number of images to generate per request, fixed at `1` (values greater than `1` are rejected). **image_urls (string[])** Array of reference image URL strings for image-to-image generation or editing (also accepts `reference_images`). Up to `10` images; each URL must be publicly accessible. The reference image count does not change the output image count. - Omit or pass an empty array for text-to-image - Pass 1-10 image URLs for image-to-image / image editing ```json ["https://example.com/photo.jpg"] ``` **client_business_id (string)** Optional business identifier for your task, such as an order or transaction ID. You can query the task by this value through the same status endpoint. **callback_url (string)** Optional webhook callback URL invoked when the task completes. Configure and enable [Task Webhooks](/docs/en/api-reference/webhooks/task-webhooks) on your API Key first. ## Response Fields **id (string)** Task ID used to query task status and results. **object (string)** Object type, always `generation.task`. **model (string)** Model ID used in the request, always `muse-image`. **status (string)** Task status: `queued`, `pending`, `in_progress`, `completed`, `failed`. **progress (integer)** Task progress as a percentage from `0` to `100`. **created_at (integer)** Task creation time as a Unix timestamp in seconds. **metadata (object)** Task metadata. ## Request Examples ```bash cURL curl --request POST \ --url https://toapis.com/v1/images/generations \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{ "model": "muse-image", "prompt": "Warm morning sunlight across a minimalist wooden cafe table with latte art and a flaky croissant, film photography", "size": "16:9", "n": 1 }' ``` ```bash cURL (Image-to-Image) curl --request POST \ --url https://toapis.com/v1/images/generations \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{ "model": "muse-image", "prompt": "Keep the product shape and label unchanged and replace the background with a sunlit coastal wooden table at dawn", "size": "3:4", "n": 1, "image_urls": [ "https://example.com/product.jpg" ] }' ``` ```python Python import requests response = requests.post( "https://toapis.com/v1/images/generations", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, json={ "model": "muse-image", "prompt": "Warm morning sunlight across a minimalist wooden cafe table with latte art and a flaky croissant, film photography", "size": "16:9", "n": 1 } ) response.raise_for_status() task = response.json() print(task["id"]) ``` ```javascript JavaScript const response = await fetch('https://toapis.com/v1/images/generations', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'muse-image', prompt: 'Warm morning sunlight across a minimalist wooden cafe table with latte art and a flaky croissant, film photography', size: '16:9', n: 1 }) }); if (!response.ok) { throw new Error(await response.text()); } const task = await response.json(); console.log(task.id); ``` ## Response Examples ```json 200 { "id": "tsk_img_abc123def456", "object": "generation.task", "model": "muse-image", "status": "queued", "progress": 0, "created_at": 1796280000, "metadata": {} } ``` ## Query Results The `id` in the submission response is the task ID. Use the [Image Task Status API](/docs/en/api-reference/tasks/image-status) to retrieve task status and final images (once completed, the image URL is returned at `result.data[0].url`). See [Task Webhooks](/docs/en/api-reference/webhooks/task-webhooks) for asynchronous notifications.