ToAPIs ToAPIs
Muse Image

Muse Image Generation

Generate and edit images with Muse Image using text prompts, up to 10 reference images, and 10 aspect ratios

POST
/v1/images/generations

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

image_urls only accepts publicly accessible HTTP(S) image URLs, not base64 or Data URI payloads. Use the Upload Image API to upload local images and obtain URLs first.

Authentication

Authorizationstringheaderrequired

All requests require a Bearer Token. Get your API Key from the API Key Management Page.

Authorization: Bearer YOUR_API_KEY

Request Parameters

modelstringbodyrequireddefault: muse-image

Image generation model name, fixed to muse-image.

promptstringbodyrequired

Text description for image generation or editing. Supports both English and Chinese prompts.

sizestringbodydefault: 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.

nintegerbodydefault: 1

Number of images to generate per request, fixed at 1 (values greater than 1 are rejected).

image_urlsstring[]body

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
["https://example.com/photo.jpg"]
client_business_idstringbody

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_urlstringbody

Optional webhook callback URL invoked when the task completes. Configure and enable Task Webhooks on your API Key first.

Response Fields

idstring

Task ID used to query task status and results.

objectstring

Object type, always generation.task.

modelstring

Model ID used in the request, always muse-image.

statusstring

Task status: queued, pending, in_progress, completed, failed.

progressinteger

Task progress as a percentage from 0 to 100.

created_atinteger

Task creation time as a Unix timestamp in seconds.

metadataobject

Task metadata.

Request Example

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
}'
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"
  ]
}'
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"])
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 Example

{
  "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 to retrieve task status and final images (once completed, the image URL is returned at result.data[0].url). See Task Webhooks for asynchronous notifications.