The generate method
The generate method creates a new image generation task.
Parameters
The first argument is the payload, which aligns with our API parameters.| Param | Type | Description |
|---|---|---|
prompt | string | The text description of the image. |
model | string | The model ID to use. |
width | number | Image width. |
height | number | Image height. |
negative_prompt | string | (Optional) What to avoid in the image. |
seed | number | (Optional) Random seed. |
Sync vs Async
By default,generate waits for the task to complete (mode: "sync").
Pass { mode: "async" } to get the task ID immediately and poll for results later.