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

Text to Image API

Generate an image from a text prompt. 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/text-to-image

Create a Text to Image task

Creates a Text 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 the request
Size1024 × 1024
Cost4 credits
Request
curl https://api.meshy.ai/openapi/v2/text-to-image \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt": "a stylized cartoon explorer with short brown hair, wearing an orange jacket, beige cargo pants and brown boots, full body, standing",
    "ai_model": "nano-banana-2-1"
  }'
Response
Loading…

Parameters

  • 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 the image to generate.

    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.

  • 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
  • Name
    pose_mode
    Type
    string
    Description

    The pose for a standing character, a-pose or t-pose. Leave it out for no pose.

    With a nano-banana model, a posed image is always 3:4, whatever you send as aspect_ratio. The GPT Image models keep your aspect_ratio.

    With nano-banana or nano-banana-pro, a pose needs a Pro plan or higher. On a lower plan, the request returns 402.

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
    • 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, or pose_mode with nano-banana, on a plan below Pro.

    Check your credits and plan, then retry.

  • 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 Text to Image tasks the same way as every other v2 task, through the Tasks routes. To list only Text to Image tasks, filter by type=text-to-image. The filter includes multi-view tasks.


Text 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/01a15c67-e9da-7034-b4c1-e9608ec9b284 \
  -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, the task fails. Its task_error has the type invalid_input and the code provider_content_refused. Change the prompt, then create another task. See Errors.