FLUX.1 Kontext [pro]

Text-to-Image • Black Forest Labs

black-forest-labs/flux-1-kontext-pro

  • 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 <ul><li>Per image$0.04</li></ul>

Usage

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"
  }
}'

Text to Image

{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-1-kontext-pro/text-to-image.png"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

Examples

<details>

<summary>Wide Cinematic Image — Generate a cinematic landscape using a wide aspect ratio.</summary>

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"
  }
}'

Wide Cinematic Image

{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/black-forest-labs/flux-1-kontext-pro/wide-cinematic-image.jpeg"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

</details>

Parameters

prompt

stringrequiredText prompt for image generation or editing.

input_image

stringOptional base64 encoded image or URL to edit.

aspect_ratio

stringOutput 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

API Schemas (Raw)

Input Open Download

Output Open Download

Was this helpful?

YesNo

On this page

FLUX.1 Kontext \[pro] - 图3Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ai/models/black-forest-labs/flux-1-kontext-pro/#page","headline":"FLUX.1 Kontext [pro]","description":"FLUX.1 Kontext [pro] creates and edits images from text prompts with strong character and style consistency.","url":"https://developers.cloudflare.com/ai/models/black-forest-labs/flux-1-kontext-pro/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: FLUX.2 [flex] is Black Forest Labs' fine-grained control variant of FLUX.2 — exposes tunable inference steps, guidance, and prompt upsampling for typography-heavy and production workflows. title: FLUX.2 [flex] image: https://developers.cloudflare.com/og-docs.png


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/llms.txt
Use this file to discover all available pages before exploring further.

Black Forest Labs logo