Skip to main content
tencent avatar

HunyuanImage 3.0 Instruct API

tencent/hunyuan-image/v3/instruct/edit

Edit and transform an existing image from a written instruction and up to 3 reference images, with an instruction-tuned checkpoint built for following long, complex edit directions.

edit
0.09 per megapixel of image

Model Input

Input

The instruction describing how to edit the reference image(s).

  • https://media.modelrunner.ai/hxBQGdmYh7PZ1dWGK0BOt.png

The URLs of the images to use as a reference for the edit. A maximum of 3 images are supported.

The size of the edited image. Use a preset, an explicit width/height object, or 'auto' to let the model choose from the input image.

Additional Settings

Customize your input with more control.

Min: 1 - Max: 4

The number of images to generate. Each generated image is billed.

Max: 20

The CFG scale. Higher values increase adherence to the prompt.

Whether to enable prompt expansion. This uses a large language model to expand the prompt with additional details while maintaining the original meaning. Enabled by default; disable it to have your exact wording honored.

Random seed for reproducible results. The same seed and inputs produce the same edit; leave unset for a random seed.

Safety checker can only be disabled on API call

The format of the generated image.

You need to be logged in to run this model and view results.
Log in

Model Output

Output

Generated image output
Generated in 55.062 seconds
Logs (1 lines)

Model Example Requests

Examples

Example output 1Example output 2Example output 3Example output 4

HunyuanImage 3.0 Instruct API

HunyuanImage 3.0 Instruct is a image-to-image AI model by tencent. On ModelRunner it runs through a REST API or via MCP from any AI assistant, at $0.09 per megapixel.

POST https://queue.modelrunner.run/tencent/hunyuan-image/v3/instruct/edit

cURL

# Submit a request to the queue
curl -X POST https://queue.modelrunner.run/tencent/hunyuan-image/v3/instruct/edit \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "prompt": "Replace her plain grey t-shirt with an elegant emerald-green satin evening gown, and place her in a warm candlelit ba…",
      "image_size": "auto",
      "image_urls": [
        "https://media.modelrunner.ai/hxBQGdmYh7PZ1dWGK0BOt.png"
      ],
      "num_images": 1,
      "output_format": "png",
      "guidance_scale": 3.5,
      "enable_safety_checker": true,
      "enable_prompt_expansion": true
    }
  }'
# → { "request_id": "...", "status_url": "...", "response_url": "..." }

# Poll status_url until "COMPLETED", then fetch the result
curl "https://queue.modelrunner.run/tencent/hunyuan-image/v3/instruct/edit/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/tencent/hunyuan-image/v3/instruct/edit/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("tencent/hunyuan-image/v3/instruct/edit", {
  input: {
    "prompt": "Replace her plain grey t-shirt with an elegant emerald-green satin evening gown, and place her in a warm candlelit ba…",
    "image_size": "auto",
    "image_urls": [
      "https://media.modelrunner.ai/hxBQGdmYh7PZ1dWGK0BOt.png"
    ],
    "num_images": 1,
    "output_format": "png",
    "guidance_scale": 3.5,
    "enable_safety_checker": true,
    "enable_prompt_expansion": true
  },
});
console.log(result);

Python

import os
import requests

headers = {"Authorization": f"Key {os.environ['MRUN_API_KEY']}"}

submitted = requests.post(
    "https://queue.modelrunner.run/tencent/hunyuan-image/v3/instruct/edit",
    headers=headers,
    json={"input": {
      "prompt": "Replace her plain grey t-shirt with an elegant emerald-green satin evening gown, and place her in a warm candlelit ba…",
      "image_size": "auto",
      "image_urls": [
        "https://media.modelrunner.ai/hxBQGdmYh7PZ1dWGK0BOt.png"
      ],
      "num_images": 1,
      "output_format": "png",
      "guidance_scale": 3.5,
      "enable_safety_checker": true,
      "enable_prompt_expansion": true
    }},
).json()

# Poll submitted["status_url"] until "COMPLETED", then:
result = requests.get(submitted["response_url"], headers=headers).json()

Input parameters

NameTypeRequiredDescription
promptstringyesThe instruction describing how to edit the reference image(s).
image_urlsarrayyesThe URLs of the images to use as a reference for the edit. A maximum of 3 images are supported.
image_sizeenumnoThe size of the edited image. Use a preset, an explicit width/height object, or 'auto' to let the model choose from the input image. Default: "auto".
num_imagesintegernoThe number of images to generate. Each generated image is billed. Default: 1.
guidance_scalenumbernoThe CFG scale. Higher values increase adherence to the prompt. Default: 3.5.
enable_prompt_expansionbooleannoWhether to enable prompt expansion. This uses a large language model to expand the prompt with additional details while maintaining the original meaning. Enabled by default; disable it to have your exact wording honored. Default: true.
seedintegernoRandom seed for reproducible results. The same seed and inputs produce the same edit; leave unset for a random seed.
enable_safety_checkerbooleannoIf set to true, the safety checker will be enabled. Default: true.
output_formatenumnoThe format of the generated image. Default: "png".

Machine-readable: OpenAPI schema · llms.txt

Use HunyuanImage 3.0 Instruct from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and HunyuanImage 3.0 Instruct becomes a tool your assistant can call directly — it authorizes via OAuth (no API key in config) and runs this model with the run_model tool using the endpoint tencent/hunyuan-image/v3/instruct/edit.

MCP client config (Claude Desktop, Cursor)

{
  "mcpServers": {
    "modelrunner": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.modelrunner.run/mcp"]
    }
  }
}

Claude Code

claude mcp add --transport http modelrunner https://mcp.modelrunner.run/mcp

Then ask your assistant, for example: “Run tencent/hunyuan-image/v3/instruct/edit on ModelRunner to generate image”. MCP setup guide.

Model Details

Model Details

HunyuanImage 3.0 Instruct edits an existing image from a written instruction. Give it one to three reference images and describe the change you want — "turn this artwork into a realistic photograph", "replace the background with a snowy street", "make the jacket red and add a scarf" — and it returns a new image that applies your edit. It is the instruction-tuned checkpoint of the 80-billion-parameter HunyuanImage 3.0 foundation model, so it reads long, multi-part edit directions and lays out the change before rendering, tracking each instruction more faithfully than a single-pass edit. Supplying several reference images lets it combine or transfer content across them in one call.

Pass the source images as an array in `image_urls` (maximum 3). Prompt expansion is on by default: a language model fleshes out terse instructions before the edit runs — set `enable_prompt_expansion` to `false` to have your exact wording honored. Leave `image_size` at `auto` to let the model size the result from the input, or pass a preset (`square_hd`, `portrait_16_9`, `landscape_16_9`) or an explicit `{width, height}` object to force a canvas.

## Best for - Applying a described change to an existing image — restyle, recolor, add or remove objects, swap a background - Turning artwork, sketches, or renders into photorealistic images and vice versa - Long, multi-part edit instructions that a simple edit model tends to drop parts of - Combining or transferring content across two or three reference images in one edit - Editorial and product retouching where the edit must follow precise written directions

## Choose another model when - You have no source image and want to generate from a text prompt alone — use the HunyuanImage 3.0 Instruct text-to-image variant - You need pixel-precise masked inpainting where only a drawn region changes — this endpoint takes no mask, use a dedicated inpainting model - You want to upscale or restore an image without changing its content — use an upscaling or restoration model - You need video — use an image-to-video model

## Tips - State the edit as a clear instruction referencing what is in the image; the reasoning step rewards complete, structured directions over keyword lists - Provide the primary image first in `image_urls`; add up to two more references when you want the model to borrow content or style from them - Leave `enable_prompt_expansion` on for short instructions; set it to `false` when your instruction is already precise and you want it honored word-for-word - Leave `image_size` at `auto` to preserve the input's proportions, or pass a preset / `{width, height}` object to force a specific output size - Each output image is billed by megapixel, so larger sizes and higher `num_images` cost more

To run via the ModelRunner JavaScript client: ```js import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("tencent/hunyuan-image/v3/instruct/edit", { input: { prompt: "Turn this artwork into a realistic photograph", image_urls: ["https://media.modelrunner.ai/example-source.png"], num_images: 1, output_format: "png", }, }); ```