POST
/
inference
/
v1
/
workflows
/
accounts
/
fireworks
/
models
/
{model}
import requests

url = "https://api.fireworks.ai/inference/v1/workflows/accounts/fireworks/models/{model}"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer $API_KEY",
}
data = {
    "prompt": "A beautiful sunset over the ocean",
    "input_image": "<string>",
    "seed": 42,
    "aspect_ratio": "<string>",
    "output_format": "jpeg",
    "webhook_url": "<string>",
    "webhook_secret": "<string>",
    "prompt_upsampling": False,
    "safety_tolerance": 2
}

response = requests.post(url, headers=headers, json=data)

💡 Note that this API is async and will return the request_id instead of the image. Call the get_result API to obtain the generated image.

FLUX Kontext Pro is a specialized model for generating contextually-aware images from text descriptions. Designed for professional use cases requiring high-quality, consistent image generation.

Use our Playground to quickly try it out in your browser.

Path

model
string
required

The model to use for image generation. Use flux-kontext-pro or flux-kontext-max as the model name in the API.

Headers

Content-Type
string

The media type of the request body.

Authorization
string
required

Your Fireworks API key.

Request Body

prompt
string
required

Prompt to use for the image generation process.

input_image
string | null

Base64 encoded image or URL to use with Kontext.

seed
integer | null

Optional seed for reproducibility.

aspect_ratio
string | null

Aspect ratio of the image between 21:9 and 9:21.

output_format
string

Output format for the generated image. Can be ‘jpeg’ or ‘png’.

Options: jpeg, png

webhook_url
string | null

URL to receive webhook notifications.

Length: 1-2083 characters

webhook_secret
string | null

Optional secret for webhook signature verification.

prompt_upsampling
boolean

Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation.

safety_tolerance
integer

Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict. Limit of 2 for Image to Image.

Range: 0-6

import requests

url = "https://api.fireworks.ai/inference/v1/workflows/accounts/fireworks/models/{model}"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer $API_KEY",
}
data = {
    "prompt": "A beautiful sunset over the ocean",
    "input_image": "<string>",
    "seed": 42,
    "aspect_ratio": "<string>",
    "output_format": "jpeg",
    "webhook_url": "<string>",
    "webhook_secret": "<string>",
    "prompt_upsampling": False,
    "safety_tolerance": 2
}

response = requests.post(url, headers=headers, json=data)

Response

Successful Response

request_id
string

request id