Generating an image
To query an image model, use the.images method and specify the image model you want to use.

Provide reference image
Use a reference image to guide the generation:
Supported Models
See our models page for supported image models.Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
prompt | string | Text description of the image to generate | Required |
model | string | Model identifier | Required |
width | integer | Image width in pixels | 1024 |
height | integer | Image height in pixels | 1024 |
n | integer | Number of images to generate (1-4) | 1 |
steps | integer | Diffusion steps (higher = better quality, slower) | 1-50 |
seed | integer | Random seed for reproducibility | any |
negative_prompt | string | What to avoid in generation | - |
frame_images | array | Required for Kling model. Array of images to guide video generation, like keyframes. | - |
promptis required for all models except Klingwidthandheightwill rely on defaults unless otherwise specified - options for dimensions differ by model- Flux Schnell and Kontext [Pro/Max/Dev] models use the
aspect_ratioparameter to set the output image size whereas Flux.1 Pro, Flux 1.1 Pro, and Flux.1 Dev usewidthandheightparameters.
Generating Multiple Variations
Generate multiple variations of the same prompt to choose from:
Custom Dimensions & Aspect Ratios
Different aspect ratios for different use cases:
Quality Control with Steps
Compare different step counts for quality vs. speed:
Base64 Images
If you prefer the image data to be embedded directly in the response, setresponse_format to “base64”.
b64_json field that contains the image encoded as a base64 string.
Safety Checker
We have a built in safety checker that detects NSFW words but you can disable it by passing indisable_safety_checker=True. This works for every model except Flux Schnell Free and Flux Pro. If the safety checker is triggered and not disabled, it will return a 422 Unprocessable Entity.
Troubleshooting
Image doesn’t match prompt well- Make prompt more descriptive and specific
- Add style references (e.g., “National Geographic style”)
- Use negative prompts to exclude unwanted elements
- Try increasing steps to 30-40
- Increase
stepsto 30-40 for production - Add quality modifiers: “highly detailed”, “8k”, “professional”
- Use negative prompt: “blurry, low quality, distorted, pixelated”
- Try a higher-tier model
- Use
seedparameter for reproducibility - Keep the same seed when testing variations
- Generate multiple variations with
nparameter
- Specify
widthandheightexplicitly - Common ratios:
- Square: 1024x1024
- Landscape: 1344x768
- Portrait: 768x1344
- Ensure dimensions are multiples of 8