AI on demand: black-forest-labs/FLUX.1-schnell

From MediaWiki
Jump to navigation Jump to search

Calling the model

# Set your personal key:
STONEY_KEY=sk-...

# Set the desired model:
MODEL=black-forest-labs/FLUX.1-schnell

# Set your prompt:
PROMPT='Create a photorealistic picture of some cats.'

# Size of the generated image (WIDTHxHEIGHT):
SIZE=1024x1024

# Number of inference steps:
STEPS=4

curl https://llm.stoney-cloud.com/v1/images/generations \
        --silent --fail --show-error \
        --header "Authorization: Bearer $STONEY_KEY" \
        --header 'Content-Type: application/json' \
        --data '{
                "model": "'"$MODEL"'",
                "prompt": "'"$PROMPT"'",
                "size": "'"$SIZE"'",
                "num_inference_steps": '"$STEPS"'
        }' \
        | jq

Example output (cropped):

{
  "created": 1784646324,
  "data": [
    {
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4AQALhP[...]AQABAP8AAP8B/v79AfANpMANoyqSAAAAAElFTkSuQmCC",
      "url": null,
      "revised_prompt": null
    }
  ],
  "output_format": "png",
  "size": "1024x1024",
  "cot_output": null
}

The resulting image is returned as a Base64-encoded string inside data[0].b64_json.