Flux Canny Dev

Open-weight edge-guided image generation. Control structure and composition using Canny edge detection.

~20.71s
$0.031 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/flux-canny-dev"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "seed": 632558,
12    "prompt": "Mystical fairy in real, magic, 4k picture, high quality",
13    "guidance": 30,
14    "megapixels": "1",
15    "num_outputs": 1,
16    "control_image": "https://segmind-sd-models.s3.us-east-1.amazonaws.com/display_images/flux-tools/flux-canny-dev-ip.jpg",
17    "output_format": "jpg",
18    "output_quality": 80,
19    "num_inference_steps": 28,
20    "disable_safety_checker": false
21}
22
23response = requests.post(url, headers=headers, json=data)
24
25if response.status_code == 200:
26    result = response.json()
27    print(json.dumps(result, indent=2))
28else:
29    print(f"Error: {response.status_code}")
30    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/flux-canny-dev

Parameters

control_imagerequired
string (uri)

Image used to control the generation. The canny edge detection will be automatically generated.

Default: "https://segmind-sd-models.s3.us-east-1.amazonaws.com/display_images/flux-tools/flux-canny-dev-ip.jpg"
promptrequired
string

Prompt for generated image

Default: "Mystical fairy in real, magic, 4k picture, high quality"
disable_safety_checkeroptional
boolean

Disable safety checker for generated images.

Default: false
guidanceoptional
number

Guidance for generated image

Default: 30Range: 0 - 100
megapixelsoptional
string

Approximate number of megapixels for generated image. Use match_input to match the size of the input (with an upper limit of 1440x1440 pixels)

Default: "1"
Allowed values :
"1""0.25""match_input"
num_inference_stepsoptional
integer

Number of denoising steps. Recommended range is 28-50, and lower number of steps produce lower quality outputs, faster.

Default: 28Range: 1 - 50
num_outputsoptional
integer

Number of outputs to generate

Default: 1Range: 1 - 4
output_formatoptional
string

Format of the output images

Default: "jpg"
Allowed values :
"webp""jpg""png"
output_qualityoptional
integer

Quality when saving the output images, from 0 to 100. 100 is best quality, 0 is lowest quality. Not relevant for .png outputs

Default: 80Range: 0 - 100
seedoptional
integer

Random seed. Set for reproducible generation

Default: 632558

Response Type

Returns: Image

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out