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.
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) 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
https://api.segmind.com/v1/bria-text-to-imageParameters
promptrequiredstringThe prompt you would like to use to generate images. Bria currently supports prompts in English only, excluding special characters.
aspect_ratiooptionalstringSet shape like '16:9' for wide, '1:1' for square formats.
"1:1""1:1""2:3""3:2""3:4""4:3""4:5""5:4""9:16""16:9"content_moderationoptionalbooleanModerate images for compliance. 'True' if needed, 'false' otherwise.
falseenhance_imageoptionalbooleanImprove clarity with 'true' for better textures, 'false' for raw visuals.
trueip_signaloptionalbooleanAlert for IP content with 'true'; 'false' to ignore.
falsemediumoptionalstringDefine style; use 'photography' for realism, 'art' for creativity.
"photography""photography""art"modeoptionalstringChoose output quality with 'base' for normal, 'fast' for speed, 'hd' for high detail.
"base""base""fast""hd"negative_promptoptionalstringRemove unwanted elements e.g., 'no storms' for calm views.
"no storms"prompt_content_moderationoptionalbooleanScan prompts for safety with 'true' on, 'false' off.
trueprompt_enhancementoptionalbooleanEnhance creativity. 'True' for variation, 'false' for consistency.
trueseedoptionalintegerUse specific numbers like '654321' to ensure repeatable results.
654321Range: 1 - 999999steps_numoptionalintegerAdjust detail with '50' for intricate detail, '20' for faster processing.
40Range: 20 - 50text_guidance_scaleoptionalnumberControl prompt adherence with '10' for precise or '1' for flexible outputs.
7Range: 1 - 10Response Type
Returns: Text/JSON
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out