REST API for Flux Models

The REST API for flux series models that allows easier integration into existing applications.

Currently we only support black-forest-labs/flux-schnell for inference.

Request Example

curl --request POST \
     --url https://api.neurohero.io/api/v1/image/generation \
     --header 'Authorization: Bearer yourAPIkey' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "model": "black-forest-labs/flux-schnell",
  "prompt": "draw a cat",
  "seed": 2024,
  "aspect_ratio": "1:1",
  "num_outputs": 1
}
' --output cat.png

Input Parameters

  • model: The model to use for image generation.
  • prompt: A description of the desired images. Maximum length varies by model.
  • seed: Seed used for generation. Can be used to reproduce image generations. Default to a random seed.
  • aspect_ratio: A string that shows the ratio of the width and height for the output image. Currently we only support the following ratios: "1:1", "16:9", "21:9", "2:3", "3:2", "4:5", "5:4", "9:16", "9:21". Default to "1:1".
  • num_outputs: The number of images you want to generate. Between 1 and 4. Default to 1.

Response Example

The response is a binary file containing a png image. The content of above request is like following,