Ideogram Character Serverless API
Achieve perfect character consistency across multiple generations from a single reference image.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/ideogram-character"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "a close up photo of a woman in a fashion magazine photoshoot",
12 "resolution": "512x1536",
13 "style_type": "Realistic",
14 "aspect_ratio": "16:9",
15 "rendering_speed": "Quality",
16 "magic_prompt_option": "Off",
17 "character_reference_image": "https://segmind-resources.s3.amazonaws.com/output/9ad9b775-7b35-4485-affe-6215a933d825-686185927069985948.png"
18}
19
20response = requests.post(url, headers=headers, json=data)
21
22if response.status_code == 200:
23 result = response.json()
24 print(json.dumps(result, indent=2))
25else:
26 print(f"Error: {response.status_code}")
27 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/ideogram-character"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "a close up photo of a woman in a fashion magazine photoshoot",
12 "resolution": "512x1536",
13 "style_type": "Realistic",
14 "aspect_ratio": "16:9",
15 "rendering_speed": "Quality",
16 "magic_prompt_option": "Off",
17 "character_reference_image": "https://segmind-resources.s3.amazonaws.com/output/9ad9b775-7b35-4485-affe-6215a933d825-686185927069985948.png"
18}
19
20response = requests.post(url, headers=headers, json=data)
21
22if response.status_code == 200:
23 result = response.json()
24 print(json.dumps(result, indent=2))
25else:
26 print(f"Error: {response.status_code}")
27 print(response.text)API Endpoint
https://api.segmind.com/v1/ideogram-characterParameters
character_reference_imagerequiredstring (uri)Provide an image as a character reference. Use a clear headshot for accurate modeling.
"https://segmind-resources.s3.amazonaws.com/output/9ad9b775-7b35-4485-affe-6215a933d825-686185927069985948.png"promptrequiredstringDescribe the image you want to create. Use creative prompts for unique images.
"a close up photo of a woman in a fashion magazine photoshoot"aspect_ratiooptionalstringDefine the aspect ratio for your image. Choose a ratio like '16:9' for wide-screen images.
"16:9""1:3""3:1""1:2""2:1""9:16""16:9""10:16""16:10""2:3""3:2"+5 moreimageoptionalstring (uri)Provide an image for inpainting using the given mask. Start with a clear, high-resolution image for best results.
nullmagic_prompt_optionoptionalstringToggle magic prompt modes to automate text prompts. Use 'On' for automatic prompt enhancements.
"Off""Auto""On""Off"maskoptionalstring (uri)Use a mask to preserve parts of the image while inpainting. Choose a detailed mask for precise edits.
nullrendering_speedoptionalstringChoose rendering speed for processing time. Use 'Turbo' for fast results or 'Quality' for best results.
"Quality""Default""Turbo""Quality"resolutionoptionalstringChoose resolution for the image output. For detailed images, pick a higher resolution.
"512x1536""None""512x1536""576x1408""576x1472""576x1536""640x1344""640x1408""640x1472""640x1536""704x1152"+60 moreseedoptionalintegerSet a seed for reproducible results. Use a fixed seed for consistency across generations.
nullRange: 100 - 999999style_typeoptionalstringSelect the style for the image. Use 'Fiction' for creative artwork or 'Realistic' for lifelike images.
"Realistic""Auto""Fiction""Realistic"Response Type
Returns: Image
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