lowpoly retires Oct 30, 2026. meshy-7 for 3D generation retires Dec 31, 2026; as a texture model it stays available. Please switch models before these dates to avoid request errors. See all deprecations

Image to Image API

Generate a new image from one to five reference images and a prompt, for example the same character in a new style. By default, Meshy removes the background, so the image is ready to use as the input for Image to 3D.

This endpoint makes images. To make a 3D model of what's in an image, use Image to 3D. To make an object you can hold or print from a photo, for example a keychain or a figure, use the Creative Lab APIs.


POST/openapi/v2/image-to-image

Create an Image to Image task

Creates an Image to Image task and returns the task object. The task runs in the background. To read its result, see Get the result. For how long a task usually takes, see Processing times.

PreviewChange a value under “Try and preview” to update
Image generated from Santa
Size1024 × 1024
Cost4 credits
Request
curl https://api.meshy.ai/openapi/v2/image-to-image \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "reference_image_urls": [
      "https://cdn.meshy.ai/webapp-assets/doc/try-it/v2/inputs/santa.3dbe655f9980.jpg"
    ],
    "ai_model": "nano-banana-2-1",
    "prompt": "turn it into a knitted wool toy"
  }'
Response
Loading…

Parameters

  • Name
    reference_image_urls
    Type
    string[]
    Required
    Description

    Required unless you send input_task_id. One to five images to work from, each a public URL or a data URI (data:image/png;base64,...). An empty array, or more than five images, returns 400.

    Each image must be a JPG, JPEG, PNG, or WebP file of at most 20 MB, and at least 32 pixels on each side.

  • Name
    input_task_id
    Type
    string
    Required
    Description

    Required unless you send reference_image_urls. The ID of a Text to Image or Image to Image task whose images to use as the references. The task must be one you created with the API and have the status SUCCEEDED. If you send both reference_image_urls and input_task_id, Meshy uses input_task_id.

    Meshy uses every image the task produced. That's one image, or up to three for a multi-view task.

  • Name
    ai_model
    Type
    string
    Required
    Description

    The model that generates the image. Prices differ by model. See Pricing.

    Try and preview

    Available values:

    • nano-banana
    • nano-banana-2
    • nano-banana-2-lite
    • nano-banana-2-1: costs 4 credits per request
    • nano-banana-pro: needs a Pro plan or higher. On a lower plan, it returns 402.
    • gpt-image-2: OpenAI GPT Image 2
    • gpt-image-2-5-flare: OpenAI GPT Image 2.5 (Flare)
    • gpt-image-2-5-sunburst: OpenAI GPT Image 2.5 (Sunburst)
    • gpt-image-2-6-flare: OpenAI GPT Image 2.6 (Flare)
    • gpt-image-2-6-sunburst: OpenAI GPT Image 2.6 (Sunburst)
  • Name
    prompt
    Type
    string
    Required
    Description

    Text that describes what to make from the reference images, for example turn it into a clay figurine.

    Try and preview
  • Name
    aspect_ratio
    Type
    string
    default 1:1
    Description

    The shape of the image.

    Try and preview

    Available values:

    • 1:1
    • 16:9
    • 9:16
    • 4:3
    • 3:4
    • 3:2: GPT Image models only
    • 2:3: GPT Image models only

    With a nano-banana model, 3:2 and 2:3 return 400. You can't send aspect_ratio with generate_multi_view: true. Sending both returns 400.

    The result doesn't follow the shape of the reference images. To match them, set aspect_ratio to their shape.

  • Name
    background
    Type
    string
    default transparent
    Description

    The background of the image.

    Available values:

    • transparent: Meshy removes the background and returns a transparent PNG.
    • opaque: Meshy returns the image with the background it was generated with.

    With generate_multi_view: true, every view has a transparent background. Sending opaque with it returns 400.

  • Name
    generate_multi_view
    Type
    boolean
    default false
    Description

    Whether to generate the subject from the front, the side, and the back. true returns each view as a separate image with a transparent background in output.image_urls, and false returns one image.

    Try and preview

Returns

202 Accepted with the task object. The task starts as PENDING, with your request in input and output set to null.

Two response headers help you read the task:

  • Location: the task's URL on Tasks
  • Retry-After: how many seconds to wait before you first read it

Failure modes

  • Name
    400 - Bad Request
    Description

    The request can't run. For example:

    • ai_model or prompt is missing
    • Neither reference_image_urls nor input_task_id was sent
    • A reference image can't be downloaded or isn't a supported image. The code is input_download_failed or input_file_invalid, and the message names the image, for example reference_image_urls[1], and says why.
    • The input task hasn't succeeded, or isn't a Text to Image or Image to Image task
    • ai_model isn't a supported model
    • aspect_ratio was sent with generate_multi_view: true (aspect_ratio cannot be set when generate_multi_view is true)
    • background: "opaque" was sent with generate_multi_view: true (background cannot be opaque when generate_multi_view is true)
    • 3:2 or 2:3 was sent for a nano-banana model

    The error message says which problem it found. See Errors.

  • Name
    401 - Unauthorized
    Description

    The API key is missing or invalid. Check the Authorization header.

  • Name
    402 - Payment Required
    Description

    One of these applies:

    • The account doesn't have enough credits.
    • The account reached a credit limit.
    • The account is on the free plan.
    • The request uses nano-banana-pro on a plan below Pro.

    Check your credits and plan, then retry.

  • Name
    404 - Not Found
    Description

    input_task_id doesn't match any of your tasks. The message is input_task_id does not match any of your tasks. A task you deleted also returns 404.

    For a task past its retention period, the code is input_task_expired. Create the input task again, and send the new task's id.

  • Name
    429 - Too Many Requests
    Description

    One of these limits was reached:

    • You sent too many requests. Wait the number of seconds in Retry-After, then retry.
    • Too many of your tasks are queued or running. Wait for some to finish, then retry.
    • On an unlimited plan with no credits left, you reached the number of tasks that can run without credits. Wait for a task to finish, or add credits.

Get the result

Read Image to Image tasks the same way as every other v2 task, through the Tasks routes. To list only Image to Image tasks, filter by type=image-to-image. The filter includes multi-view tasks.


Image to Image output

When the task succeeds, output holds this field. The rest of the task object is the same for every task type. The URLs in output stop working at expires_at.

Request
curl https://api.meshy.ai/openapi/v2/tasks/01a157e1-35e3-7778-9a40-d3618286eb3e \
  -H "Authorization: Bearer ${MESHY_API_KEY}"
Response
Loading…
  • Name
    image_urls
    Type
    string[]
    Description

    Signed URLs to the generated PNG images:

    • A single image: one URL. With background: "transparent", Meshy removes the image's background. If it can't, the task still succeeds, and the image keeps its background.
    • With generate_multi_view: true: one URL per view, usually three, each with a transparent background. If Meshy can't separate every view, it returns fewer, and the task still succeeds.

If the model provider's safety check declines the prompt or a reference image, the task fails. Its task_error has the type invalid_input and the code provider_content_refused. Change the prompt or the reference images, then create another task. See Errors.