Skip to content

Flux-2 - Text to Image ​

Endpoint ​

POST /images/generations

Full URL: https://modelfold.ai/v1/images/generations

Authentication: every request must include the Authorization: Bearer <API_KEY> header.

Send model parameters directly in the JSON body. Do not wrap them in input. This request waits for generation to finish and returns data[].url; supported media models also offer async jobs, polling and callbacks. Replace example media URLs with your own publicly accessible files. See API gateway for billing and errors.

Input parameters for the generation task

Request Parameters ​

Body (application/json) ​

ParameterTypeRequiredDescription
modelstringYesModel name for the generation task. Required field.
- This endpoint must use the flux-2/flex-text-to-image model Default:"flux-2/flex-text-to-image"。 Allowed values:flux-2/flex-text-to-image。 Example:flux-2/flex-text-to-image。
promptstringYesPrompt required by the ModelFold gateway; at most 2000 characters. Generation prompt, length must be between 3-5000 characters. (Maximum length: 5000 characters) maxLength: 2000. Example:A humanoid figure with a vintage television set for a head, featuring a green-tinted screen displaying a Hello FLUX.2 writing in ASCII font. The figure is wearing a yellow raincoat, and there are various wires and components attached to the television. The background is cloudy and indistinct, suggesting an outdoor setting。
aspect_ratiostringYesRequired. Aspect ratio of the generated image. Allowed values:1:1 / 4:3 / 3:4 / 16:9 / 9:16 / 3:2 / 2:3。 Example:1:1。
resolutionstringYesRequired. Output image resolution. Allowed values:1K / 2K。 Example:1K。
nsfw_checkerbooleanNoDefaults to false. When false, no additional content filtering is applied and results are returned directly by the model.

Request Example ​

bash
curl -X POST "https://modelfold.ai/v1/images/generations" \
  -H "Authorization: Bearer $MODELFOLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "flux-2/flex-text-to-image",
  "prompt": "A humanoid figure with a vintage television set for a head, featuring a green-tinted screen displaying a `Hello FLUX.2` writing in ASCII font. The figure is wearing a yellow raincoat, and there are various wires and components attached to the television. The background is cloudy and indistinct, suggesting an outdoor setting",
  "aspect_ratio": "1:1",
  "resolution": "1K"
}'
json
{
  "model": "flux-2/flex-text-to-image",
  "prompt": "A humanoid figure with a vintage television set for a head, featuring a green-tinted screen displaying a `Hello FLUX.2` writing in ASCII font. The figure is wearing a yellow raincoat, and there are various wires and components attached to the television. The background is cloudy and indistinct, suggesting an outdoor setting",
  "aspect_ratio": "1:1",
  "resolution": "1K"
}

Response ​

200 — Generation completed. usage contains actual billing details; result URLs are illustrative. ​

json
{
  "ok": true,
  "created": 1792134000,
  "data": [
    {
      "url": "https://modelfold.ai/uploads/outputs/result.png"
    }
  ],
  "usage": {}
}

ModelFold — one API for all the best AI models.