txt2img
Generate images from text prompts or transform existing images with Puter AI, including image-to-image generation.
Instructions
Generate an image from a text prompt or transform an existing image using Puter AI. Supports image-to-image generation. Default model: gpt-image-2 for text-to-image, gemini-2.5-flash-image-preview for image-to-image.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>"
},
"name": "txt2img"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of images to generate | |
| seed | No | Random seed for reproducible generation | |
| model | No | Image model to use (default: gpt-image-2 for text-to-image, gemini-2.5-flash-image-preview for image-to-image) | |
| ratio | No | Aspect ratio with w and h properties | |
| steps | No | Number of generation steps | |
| width | No | Image width in pixels (Together provider) | |
| height | No | Image height in pixels (Together provider) | |
| prompt | Yes | Text description for the image generation or transformation | |
| quality | No | ||
| provider | No | ||
| image_url | No | Input image URL (Together provider) | |
| test_mode | No | Use test mode without credits | |
| input_image | No | Input image URL or Base64 for image-to-image generation (Replicate/Gemini) | |
| aspect_ratio | No | Aspect ratio (Together provider) | |
| image_base64 | No | Input image as Base64 (Together provider) | |
| input_images | No | Array of input image URLs for image-to-image (Gemini/Replicate) | |
| output_format | No | Output format | base64 |
| mask_image_url | No | Mask image URL for inpainting (Together provider) | |
| negative_prompt | No | What to avoid in the image | |
| prompt_strength | No | How strongly the prompt influences output (Together provider) | |
| response_format | No | Response format (Together provider) | |
| mask_image_base64 | No | Mask image as Base64 for inpainting (Together provider) | |
| puter_output_path | No | Save to Puter filesystem path | |
| disable_safety_checker | No | Disable safety checker |