Skip to main content
POST
/
v1
/
images
/
generations
Generate an image
curl --request POST \
  --url https://tokens.flex.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "black-forest-labs/FLUX.1-schnell",
  "prompt": "<string>",
  "n": 1,
  "size": "1024x1024",
  "response_format": "b64_json"
}
'
{
  "created": 123,
  "data": [
    {
      "b64_json": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

Virtual API key. Create one from the FlexAI dashboard. Pass as Authorization: Bearer sk-xxxx.

Body

application/json
model
string
required
Example:

"black-forest-labs/FLUX.1-schnell"

prompt
string
required
n
integer
default:1
Required range: 1 <= x <= 4
size
enum<string>
default:1024x1024
Available options:
512x512,
768x768,
1024x1024,
1024x1792,
1792x1024
response_format
enum<string>
default:b64_json
Available options:
b64_json

Response

Successful response

created
integer
data
object[]