Endpoint
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | yes | — | Image model name (e.g. black-forest-labs-flux-2-klein-4b, flux-2-dev) |
prompt | string | yes | — | Text description of the image to generate. |
response_format | string | no | "url" | "url" returns a hosted URL. "b64_json" returns base64-encoded image bytes inline. |
target_namespace | string | no | current user | Namespace to save results and bill to. Can be an organization name. |
aspect_ratio | string | no | — | Aspect ratio (e.g. "1:1", "16:9", "9:16", "4:3", "3:4"). |
num_inference_steps | integer | no | — | Number of denoising steps. |
seed | integer | no | — | Reproducibility seed. |
GET /api/ai/models/:id) to see the request_schema for model-specific parameters.
Examples
Basic generation
Response (response_format: "url")
Response (response_format: "b64_json")
Errors
| Condition | Error |
|---|---|
| No prompt | "Prompt cannot be empty" |
| Model not found | "Model not found: <name>" |