- Third-party
FLUX.1 Kontext [max] is Black Forest Labs' highest-quality Kontext model for text-to-image generation and context-aware image editing.
| Model Info | |
|---|---|
| Terms and License | link ↗ |
| More information | link ↗ |
| Pricing | View pricing in the Cloudflare dashboard ↗ |
const response = await env.AI.run(
'black-forest-labs/flux-1-kontext-max',
{
prompt:
'A lone warrior in bloodstained samurai armor stands before a pagoda engulfed in flames, cinematic dark fantasy realism',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "black-forest-labs/flux-1-kontext-max",
"input": {
"prompt": "A lone warrior in bloodstained samurai armor stands before a pagoda engulfed in flames, cinematic dark fantasy realism"
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-1-kontext-max/maximum-quality-generation.png"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}Reproducible Generation — Use a seed and PNG output for reproducible image generation.
const response = await env.AI.run(
'black-forest-labs/flux-1-kontext-max',
{
prompt:
'A detailed oil painting portrait of a Renaissance nobleman with an intricate lace collar',
seed: 42,
output_format: 'png',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "black-forest-labs/flux-1-kontext-max",
"input": {
"prompt": "A detailed oil painting portrait of a Renaissance nobleman with an intricate lace collar",
"seed": 42,
"output_format": "png"
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-1-kontext-max/reproducible-generation.png"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}prompt
stringrequiredText prompt for image generation or editing.input_image
string | nullOptional base64 encoded image or URL to edit.aspect_ratio
string | nullOutput aspect ratio, from 3:7 to 7:3. Defaults to 1:1.seed
integer | nullOptional seed for reproducible generation.prompt_upsampling
booleanWhether to upsample the prompt. Defaults to false.safety_tolerance
integerminimum: 0maximum: 6Moderation tolerance. 0 is strictest and 6 is most permissive.output_format
stringenum: jpeg, pngOutput image format. Defaults to jpeg.image
stringformat: uriURL to the generated image