Skip to main content
POST
/
generate
/
k
/
flux-kontext
Flux Kontext Image Generation/Editing
curl --request POST \
  --url https://api.sinancode.com/v1/generate/k/flux-kontext \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "aspect_ratio": "16:9",
  "call_back_url": "https://example.com/callback",
  "enable_translation": true,
  "input_image": "https://example.com/input.jpg",
  "model": "flux-kontext-pro",
  "output_format": "jpeg",
  "prompt": "a beautiful landscape with mountains",
  "prompt_upsampling": false,
  "safety_tolerance": 2,
  "upload_cn": false,
  "watermark": ""
}'
{
  "task_id": "01234567-89ab-cdef-0123-456789abcdef"
}
A high-quality image generation model that supports Chinese prompts, with built-in intelligent translation and prompt optimization features.

Authorizations

Authorization
string
header
required

Please use your API Token for authentication

Body

application/json

Task parameters

prompt
string
required

Prompt (required, supports English)

Example:

"a beautiful landscape with mountains"

aspect_ratio
enum<string>
default:auto

Aspect ratio (optional, default 16:9)

Available options:
auto,
21:9,
16:9,
4:3,
1:1,
3:4,
9:16
Example:

"16:9"

call_back_url
string

Callback URL (optional)

Example:

"https://example.com/callback"

enable_translation
boolean
default:true

Enable auto translation (optional, default true)

Example:

true

input_image
string

Input image URL (optional, for editing mode)

Example:

"https://example.com/input.jpg"

model
enum<string>
default:flux-kontext-pro

Model version (optional, default flux-kontext-pro)

Available options:
flux-kontext-pro,
flux-kontext-max
Example:

"flux-kontext-pro"

output_format
enum<string>
default:jpeg

Output format (optional, default jpeg)

Available options:
jpeg,
png
Example:

"jpeg"

prompt_upsampling
boolean
default:false

Enable prompt enhancement (optional, default false)

Example:

false

safety_tolerance
integer
default:2

Safety tolerance level (optional, 0-6, default 2)

Required range: 0 <= x <= 6
Example:

2

upload_cn
boolean

Use China mainland server for upload (optional)

Example:

false

watermark
string

Watermark identifier (optional)

Example:

""

Response

OK

task_id
string
required

Task ID

Example:

"01234567-89ab-cdef-0123-456789abcdef"