---
title: Prompt optimizer — MiniMax H3 Image | Runware Docs
url: https://runware.ai/docs/models/minimax-h3-image/guides/prompt-optimizer
description: "How to use the prompt optimizer on MiniMax H3 Image: what the rewrite adds to a short prompt, and when to turn it off and send the prompt as written."
---
### [Introduction](https://runware.ai/docs/models/minimax-h3-image/guides/prompt-optimizer#introduction)

MiniMax H3 Image **rewrites your prompt before it generates**. With `settings.promptOptimizer` on, which is the default, MiniMax expands the prompt into a detailed scene description and the model works from that description rather than from your words. **The rewritten prompt is not returned**, so the image is the only record of what the rewrite decided.

The hero came from six words, `a rooftop yoga class at sunrise`:

![A yoga class on a wooden city rooftop at sunrise, two women on mats in the foreground and students in a warrior pose behind them, with glass towers and the low sun over the skyline](https://runware.ai/docs/assets/output-hero.C5-7h5F4_Z2p1Pc8.jpg)

> **Prompt**: a rooftop yoga class at sunrise

**Everything the six words left open**, from the setting around the class to the angle of the light, was decided by the rewrite. That helps a prompt that is only a starting point, and it **works against a prompt that has already made those decisions**.

This guide runs **the same prompts with the optimizer on and off**, then covers the request and the rules for turning it off. Writing the prompt itself is covered in [prompting](https://runware.ai/docs/models/minimax-h3-image/guides/prompting), quoted copy and exact layouts in [text and layouts](https://runware.ai/docs/models/minimax-h3-image/guides/text-and-layouts), and reference images in [editing images](https://runware.ai/docs/models/minimax-h3-image/guides/editing-images).

### [What the rewrite adds](https://runware.ai/docs/models/minimax-h3-image/guides/prompt-optimizer#what-the-rewrite-adds)

A short prompt **leaves most of the image undecided**. Both images below came from `a food truck at a summer festival` at 2048 × 2048, one with the optimizer off and one with it on:

![A green food truck seen close up through a metal crowd barrier, its counter stacked with fruit and its signs covered in garbled lettering](https://runware.ai/docs/assets/output-short-off.DHMwuHqM_1vgLeV.jpg)

*Optimizer off*

> **Prompt**: a food truck at a summer festival

![A cream and green food truck with a SUMMER BITES sign and a chalkboard menu serving a couple at a festival in golden evening light, under string lights, with a crowd and a striped tent behind](https://runware.ai/docs/assets/output-short-on.DFtu3y3x_Z1QBKof.jpg)

*Optimizer on*

> **Prompt**: a food truck at a summer festival

With the optimizer off, **the model renders the prompt as written** and fills the rest from its own defaults. With it on, the rewrite first turns the fragment into a scene, choosing the time of day, the crowd, the light and the camera position before the model starts.

Text the prompt leaves unwritten **comes back garbled with the optimizer off**. A food truck carries signs, and in two runs without the rewrite their lettering was nonsense, while the rewrite named the truck "SUMMER BITES" and filled in a menu with prices. With the optimizer off, quote the words a sign should carry, or end the prompt with "no text".

The optimizer-on result is **what a consumer app wants from a short prompt**. An end user types a few words into a text box and gets a finished image back, and your integration sends nothing beyond the prompt.

The rewrite also shows up on the bill. H3 Image is billed per token, and **the tokens the rewrite adds count as text input**, so a short prompt with the optimizer on bills more text tokens than the words you sent.

### [Complete prompts](https://runware.ai/docs/models/minimax-h3-image/guides/prompt-optimizer#complete-prompts)

The rewrite **runs on every prompt**, including one that has already made every decision. The flat lay below is written the way a product pipeline or an LLM writes a prompt, with the background, the count, the order, the spacing, the light and the exclusions all stated. It ran once with the optimizer off and once with it on:

![Five travel accessories in one evenly spaced row on flat terracotta paper, seen from above: a navy passport wallet, an open white earbud case, a folded gray sleep mask, a silver travel adapter and a mustard yellow toiletry pouch](https://runware.ai/docs/assets/output-complete-off.DmN06kkt_1SnfnB.jpg)

*Optimizer off*

> **Prompt**: A top-down flat lay product photo for a travel accessories store, shot straight down. The background is a single sheet of flat terracotta paper that fills the whole frame, with no texture and no other surface. Exactly five products sit in one horizontal row across the vertical center of the frame, evenly spaced with the same gap between each, and nothing above or below the row. From left to right: a closed navy leather passport wallet; an open white wireless earbud case with both earbuds inside; a folded light gray linen sleep mask; a matte silver universal travel adapter; a small mustard yellow zip toiletry pouch. Every product is fully in frame and none of them touch or overlap. Soft, even overhead light with only a faint contact shadow under each product. Clean e-commerce catalog photography, true-to-life color, no text, no logos, no hands, no plants, no extra objects.

![The same five travel accessories in the same order on a lighter terracotta paper, seen from above, with the travel adapter drawn as a round gray plug](https://runware.ai/docs/assets/output-complete-on.CkS0teuG_GfiCX.jpg)

*Optimizer on*

> **Prompt**: A top-down flat lay product photo for a travel accessories store, shot straight down. The background is a single sheet of flat terracotta paper that fills the whole frame, with no texture and no other surface. Exactly five products sit in one horizontal row across the vertical center of the frame, evenly spaced with the same gap between each, and nothing above or below the row. From left to right: a closed navy leather passport wallet; an open white wireless earbud case with both earbuds inside; a folded light gray linen sleep mask; a matte silver universal travel adapter; a small mustard yellow zip toiletry pouch. Every product is fully in frame and none of them touch or overlap. Soft, even overhead light with only a faint contact shadow under each product. Clean e-commerce catalog photography, true-to-life color, no text, no logos, no hands, no plants, no extra objects.

Both keep the five products, their order and the plain paper. With the optimizer on, **the rewrite still reinterpreted details the prompt had settled**: the matte silver universal adapter came back as a round gray plug, and the paper turned a lighter shade. With it off, **each clause reaches the model as written**.

Turn it off when **the prompt is the spec**: prompts your pipeline or an LLM writes in full, layouts that must follow the prompt exactly, and product shots where nothing should be added to the frame. Exact positions and quoted copy are covered in [text and layouts](https://runware.ai/docs/models/minimax-h3-image/guides/text-and-layouts).

### [Turning it off](https://runware.ai/docs/models/minimax-h3-image/guides/prompt-optimizer#turning-it-off)

Set `promptOptimizer` to `false` in `settings` and **send an exact size** in `width` and `height`. This is the request behind the first flat lay:

**TypeScript**:

```typescript
import { createClient } from '@runware/sdk'

const client = await createClient({ apiKey: process.env.RUNWARE_API_KEY })
await client.connect()

const [result] = await client.run({
  model: 'minimax:h3@image',
  positivePrompt: 'A top-down flat lay product photo for a travel accessories store, shot straight down. The background is a single sheet of flat terracotta paper that fills the whole frame, with no texture and no other surface. Exactly five products sit in one horizontal row across the vertical center of the frame, evenly spaced with the same gap between each, and nothing above or below the row. From left to right: a closed navy leather passport wallet; an open white wireless earbud case with both earbuds inside; a folded light gray linen sleep mask; a matte silver universal travel adapter; a small mustard yellow zip toiletry pouch. Every product is fully in frame and none of them touch or overlap. Soft, even overhead light with only a faint contact shadow under each product. Clean e-commerce catalog photography, true-to-life color, no text, no logos, no hands, no plants, no extra objects.',
  width: 2400,
  height: 1600,
  settings: {
    promptOptimizer: false
  }
})
```

**Python**:

```python
import asyncio
import os

from runware import Runware

async def main():
    async with Runware(api_key=os.environ["RUNWARE_API_KEY"]) as client:
        results = await client.run({
            "model": "minimax:h3@image",
            "positivePrompt": "A top-down flat lay product photo for a travel accessories store, shot straight down. The background is a single sheet of flat terracotta paper that fills the whole frame, with no texture and no other surface. Exactly five products sit in one horizontal row across the vertical center of the frame, evenly spaced with the same gap between each, and nothing above or below the row. From left to right: a closed navy leather passport wallet; an open white wireless earbud case with both earbuds inside; a folded light gray linen sleep mask; a matte silver universal travel adapter; a small mustard yellow zip toiletry pouch. Every product is fully in frame and none of them touch or overlap. Soft, even overhead light with only a faint contact shadow under each product. Clean e-commerce catalog photography, true-to-life color, no text, no logos, no hands, no plants, no extra objects.",
            "width": 2400,
            "height": 1600,
            "settings": {
                "promptOptimizer": False
            }
        })

asyncio.run(main())
```

**cURL**:

```bash
curl https://api.runware.ai/v1 \
  -H "Authorization: Bearer $RUNWARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "taskType": "imageInference",
      "taskUUID": "7e2c4a91-5d3b-4f86-a0c7-2b9e1d4f6a38",
      "model": "minimax:h3@image",
      "positivePrompt": "A top-down flat lay product photo for a travel accessories store, shot straight down. The background is a single sheet of flat terracotta paper that fills the whole frame, with no texture and no other surface. Exactly five products sit in one horizontal row across the vertical center of the frame, evenly spaced with the same gap between each, and nothing above or below the row. From left to right: a closed navy leather passport wallet; an open white wireless earbud case with both earbuds inside; a folded light gray linen sleep mask; a matte silver universal travel adapter; a small mustard yellow zip toiletry pouch. Every product is fully in frame and none of them touch or overlap. Soft, even overhead light with only a faint contact shadow under each product. Clean e-commerce catalog photography, true-to-life color, no text, no logos, no hands, no plants, no extra objects.",
      "width": 2400,
      "height": 1600,
      "settings": {
        "promptOptimizer": false
      }
    }
  ]'
```

**CLI**:

```bash
runware run minimax:h3@image \
  positivePrompt="A top-down flat lay product photo for a travel accessories store, shot straight down. The background is a single sheet of flat terracotta paper that fills the whole frame, with no texture and no other surface. Exactly five products sit in one horizontal row across the vertical center of the frame, evenly spaced with the same gap between each, and nothing above or below the row. From left to right: a closed navy leather passport wallet; an open white wireless earbud case with both earbuds inside; a folded light gray linen sleep mask; a matte silver universal travel adapter; a small mustard yellow zip toiletry pouch. Every product is fully in frame and none of them touch or overlap. Soft, even overhead light with only a faint contact shadow under each product. Clean e-commerce catalog photography, true-to-life color, no text, no logos, no hands, no plants, no extra objects." \
  width=2400 \
  height=1600 \
  settings.promptOptimizer=false
```

**JSON**:

```json
{
  "taskType": "imageInference",
  "taskUUID": "7e2c4a91-5d3b-4f86-a0c7-2b9e1d4f6a38",
  "model": "minimax:h3@image",
  "positivePrompt": "A top-down flat lay product photo for a travel accessories store, shot straight down. The background is a single sheet of flat terracotta paper that fills the whole frame, with no texture and no other surface. Exactly five products sit in one horizontal row across the vertical center of the frame, evenly spaced with the same gap between each, and nothing above or below the row. From left to right: a closed navy leather passport wallet; an open white wireless earbud case with both earbuds inside; a folded light gray linen sleep mask; a matte silver universal travel adapter; a small mustard yellow zip toiletry pouch. Every product is fully in frame and none of them touch or overlap. Soft, even overhead light with only a faint contact shadow under each product. Clean e-commerce catalog photography, true-to-life color, no text, no logos, no hands, no plants, no extra objects.",
  "width": 2400,
  "height": 1600,
  "settings": {
    "promptOptimizer": false
  }
}
```

Three rules come with it:

- **An exact size is required.** With the optimizer off, the request needs both `width` and `height`. Turning it off with `resolution`, or with no size at all, is rejected.
- **Editing always uses the optimizer.** A request with `inputs.referenceImages` cannot turn it off, and `false` alongside reference images is rejected. Leave the setting out of edits, which [editing images](https://runware.ai/docs/models/minimax-h3-image/guides/editing-images) covers.
- **Only about the first 4,096 tokens are read.** That limit applies with the optimizer off, and `positivePrompt` accepts up to 32,000 characters, so a valid prompt can run past it. Keep a long prompt within that budget and put the decisions that matter at the start.

[MiniMax H3 Image Highspeed](https://runware.ai/docs/models/minimax-h3-image-highspeed) takes the same setting under the same rules.

### [Tips](https://runware.ai/docs/models/minimax-h3-image/guides/prompt-optimizer#tips)

1. **Leave it on for short prompts.** A few words typed by an end user come back as a full scene, and the request carries nothing but the prompt.
    
2. **Turn it off when the prompt is complete.** A prompt your pipeline or an LLM wrote in full already holds every decision, and the optimizer rewrites a brief that needs no rewriting.
    
3. **Send an exact size with it off.** `width` and `height` are required, so `resolution` or a request with no size is rejected.
    
4. **Leave the setting out of edits.** Editing with reference images always uses the optimizer.
    
5. **Stay within about 4,096 tokens with it off.** The model reads no further than that, so put the decisions that matter first.
    
6. **Judge each mode on several runs.** Two runs of the same prompt differ, so generate a few with each setting on your own prompts before choosing one.
    
7. **Spell out text with it off.** Signs and labels the prompt does not write out come back as garbled lettering, so quote the words or ask for no text.
    
8. **Budget for the rewrite.** With the optimizer on, the tokens the rewrite adds are billed as text input.