Python API for Flux Models

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

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

Requirements

Install the module requests for testing.

python -m pip install requests

Example code

import requests

url = "https://api.neurohero.io/api/v1/image/generation"

payload = {
    "model": "black-forest-labs/flux-schnell",
    "prompt": "draw a cat",
    "seed": 2024,
    "aspect_ratio": "1:1",
    "num_outputs": 1,
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "Authorization": "Bearer yourAPIkey"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)