Skip to main content
Glama

Hunyuan Image Replicate MCP Server

by PierrunoYT
api.txt4.86 kB
# Hunyuan Image > Use the amazing capabilities of hunyuan image 2.1 to generate images that express the feelings of your text. ## Overview - **Model**: `tencent/hunyuan-image-2.1` - **Platform**: Replicate - **Category**: text-to-image - **Kind**: inference **Tags**: text-to-image, hunyuan, tencent, image-generation ## API Information This model can be used via Replicate's HTTP API or more conveniently via their client libraries. See the input and output schema below, as well as the usage examples. ### Input Schema The API accepts the following input parameters: - **`prompt`** (`string`, _required_): The text prompt to generate an image from. - Examples: "A cute, cartoon-style anthropomorphic penguin plush toy, standing in a painting studio, wearing a red knitted scarf and beret." - **`image_size`** (`string`, _optional_): The desired size of the generated image. Default value: `1024x1024` - Default: `"1024x1024"` - Options: "1024x1024", "1152x896", "896x1152", "1216x832", "832x1216", "1344x768", "768x1344", "1536x640", "640x1536" - **`num_outputs`** (`integer`, _optional_): The number of images to generate. Default value: `1` - Default: `1` - Range: `1` to `4` - **`num_inference_steps`** (`integer`, _optional_): Number of denoising steps. Default value: `25` - Default: `25` - Range: `1` to `100` - **`guidance_scale`** (`float`, _optional_): Controls how much the model adheres to the prompt. Higher values mean stricter adherence. Default value: `7.5` - Default: `7.5` - Range: `1` to `20` - **`seed`** (`integer`, _optional_): Random seed for reproducible results. If None, a random seed is used. **Required Parameters Example**: ```json { "prompt": "A cute, cartoon-style anthropomorphic penguin plush toy, standing in a painting studio, wearing a red knitted scarf and beret." } ``` **Full Example**: ```json { "prompt": "A cute, cartoon-style anthropomorphic penguin plush toy, standing in a painting studio, wearing a red knitted scarf and beret.", "image_size": "1024x1024", "num_outputs": 1, "num_inference_steps": 25, "guidance_scale": 7.5 } ``` ### Output Schema The API returns an array of generated images: - **`output`** (`array<File>`, _required_): An array of the generated images. - Array of File objects - Each file is a WebP image **Example Response**: The output will be an array of File objects that you can access via: ```javascript output[0].url() // Get the URL of the first image ``` ## Usage Examples ### cURL ```bash curl -s -X POST \ -d '{"version": "latest", "input": {"prompt": "A cute, cartoon-style anthropomorphic penguin plush toy, standing in a painting studio, wearing a red knitted scarf and beret."}}' \ -H "Authorization: Token $REPLICATE_API_TOKEN" \ -H 'Content-Type: application/json' \ "https://api.replicate.com/v1/models/tencent/hunyuan-image-2.1/predictions" ``` ### Python Ensure you have the Python client installed: ```bash pip install replicate ``` Then use the API client to make requests: ```python import replicate input = { "prompt": "A cute, cartoon-style anthropomorphic penguin plush toy, standing in a painting studio, wearing a red knitted scarf and beret." } output = replicate.run( "tencent/hunyuan-image-2.1", input=input ) print(output) # => ["https://replicate.delivery/.../output_0.webp"] # To write the files to disk: from urllib.request import urlretrieve for index, image_url in enumerate(output): urlretrieve(image_url, f"output_{index}.webp") ``` ### JavaScript/Node.js Ensure you have the JavaScript client installed: ```bash npm install replicate ``` Then use the API client to make requests: ```javascript import Replicate from "replicate"; const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN, }); const input = { prompt: "A cute, cartoon-style anthropomorphic penguin plush toy, standing in a painting studio, wearing a red knitted scarf and beret." }; const output = await replicate.run("tencent/hunyuan-image-2.1", { input }); console.log(output); // => ["https://replicate.delivery/.../output_0.webp"] // To write the files to disk: import { writeFile } from "fs/promises"; for (const [index, item] of Object.entries(output)) { await writeFile(`output_${index}.webp`, item); } ``` ## Additional Resources ### Documentation - [Model Page on Replicate](https://replicate.com/tencent/hunyuan-image-2.1) - [Replicate API Documentation](https://replicate.com/docs) - [Replicate OpenAPI Schema](https://api.replicate.com/openapi.json) ### Replicate Platform - [Platform Documentation](https://replicate.com/docs) - [Python Client](https://github.com/replicate/replicate-python) - [JavaScript Client](https://github.com/replicate/replicate-javascript) - [API Tokens](https://replicate.com/account/api-tokens)

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/PierrunoYT/hunyuan-image-replicate-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server