- Third-party
FLUX.1 Kontext [pro] creates and edits images from text prompts with strong character and style consistency.
| 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-pro',
{ prompt: 'A small furry elephant pet looks out from a cat house' },
)
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-pro",
"input": {
"prompt": "A small furry elephant pet looks out from a cat house"
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-1-kontext-pro/text-to-image.png"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}Wide Cinematic Image — Generate a cinematic landscape using a wide aspect ratio.
const response = await env.AI.run(
'black-forest-labs/flux-1-kontext-pro',
{
prompt:
'A remote gas station swallowed by crimson fog, green glow from overhead lights staining the asphalt, cinematic wide shot',
input_image:
'https://cdn.sanity.io/images/gsvmb6gz/production/3ae6ee032b85373b84934574f3ac3bb2fb792d64-2048x1365.jpg',
aspect_ratio: '16:9',
output_format: 'jpeg',
},
)
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-pro",
"input": {
"prompt": "A remote gas station swallowed by crimson fog, green glow from overhead lights staining the asphalt, cinematic wide shot",
"input_image": "https://cdn.sanity.io/images/gsvmb6gz/production/3ae6ee032b85373b84934574f3ac3bb2fb792d64-2048x1365.jpg",
"aspect_ratio": "16:9",
"output_format": "jpeg"
}
}'
{
"state": "Completed",
"result": {
"image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-1-kontext-pro/wide-cinematic-image.jpeg"
},
"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