Bria 3.2 Text to Image Serverless API

Bria 3.2 AI transforms natural language into stunning visuals for diverse creative applications — with Base, Fast, and HD modes to match your creative needs.

~21.91s
$0.04 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/bria-text-to-image"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": "A professional headshot of a CEO",
12    "mode": "base",
13    "aspect_ratio": "1:1",
14    "seed": 654321,
15    "negative_prompt": "no storms",
16    "steps_num": 40,
17    "text_guidance_scale": 7,
18    "medium": "photography",
19    "prompt_enhancement": true,
20    "enhance_image": true,
21    "prompt_content_moderation": true,
22    "content_moderation": false,
23    "ip_signal": false
24}
25
26response = requests.post(url, headers=headers, json=data)
27
28if response.status_code == 200:
29    result = response.json()
30    print(json.dumps(result, indent=2))
31else:
32    print(f"Error: {response.status_code}")
33    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/bria-text-to-image

Parameters

promptrequired
string

The prompt you would like to use to generate images. Bria currently supports prompts in English only, excluding special characters.

aspect_ratiooptional
string

Set shape like '16:9' for wide, '1:1' for square formats.

Default: "1:1"
Allowed values :
"1:1""2:3""3:2""3:4""4:3""4:5""5:4""9:16""16:9"
content_moderationoptional
boolean

Moderate images for compliance. 'True' if needed, 'false' otherwise.

Default: false
enhance_imageoptional
boolean

Improve clarity with 'true' for better textures, 'false' for raw visuals.

Default: true
ip_signaloptional
boolean

Alert for IP content with 'true'; 'false' to ignore.

Default: false
mediumoptional
string

Define style; use 'photography' for realism, 'art' for creativity.

Default: "photography"
Allowed values :
"photography""art"
modeoptional
string

Choose output quality with 'base' for normal, 'fast' for speed, 'hd' for high detail.

Default: "base"
Allowed values :
base (3.2)"base"
fast (2.3)"fast"
hd (2.2)"hd"
negative_promptoptional
string

Remove unwanted elements e.g., 'no storms' for calm views.

Default: "no storms"
prompt_content_moderationoptional
boolean

Scan prompts for safety with 'true' on, 'false' off.

Default: true
prompt_enhancementoptional
boolean

Enhance creativity. 'True' for variation, 'false' for consistency.

Default: true
seedoptional
integer

Use specific numbers like '654321' to ensure repeatable results.

Default: 654321Range: 1 - 999999
steps_numoptional
integer

Adjust detail with '50' for intricate detail, '20' for faster processing.

Default: 40Range: 20 - 50
text_guidance_scaleoptional
number

Control prompt adherence with '10' for precise or '1' for flexible outputs.

Default: 7Range: 1 - 10

Response Type

Returns: Text/JSON

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