Ideogram Character Serverless API

Achieve perfect character consistency across multiple generations from a single reference image.

~20.00s
$0.125 - $0.250 per generation
 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

POSThttps://api.segmind.com/v1/ideogram-character

Parameters

character_reference_imagerequired
string (uri)

Provide an image as a character reference. Use a clear headshot for accurate modeling.

Default: "https://segmind-resources.s3.amazonaws.com/output/9ad9b775-7b35-4485-affe-6215a933d825-686185927069985948.png"
promptrequired
string

Describe the image you want to create. Use creative prompts for unique images.

Default: "a close up photo of a woman in a fashion magazine photoshoot"
aspect_ratiooptional
string

Define the aspect ratio for your image. Choose a ratio like '16:9' for wide-screen images.

Default: "16:9"
Allowed values (15 total):
"1:3""3:1""1:2""2:1""9:16""16:9""10:16""16:10""2:3""3:2"+5 more
imageoptional
string (uri)

Provide an image for inpainting using the given mask. Start with a clear, high-resolution image for best results.

Default: null
magic_prompt_optionoptional
string

Toggle magic prompt modes to automate text prompts. Use 'On' for automatic prompt enhancements.

Default: "Off"
Allowed values :
"Auto""On""Off"
maskoptional
string (uri)

Use a mask to preserve parts of the image while inpainting. Choose a detailed mask for precise edits.

Default: null
rendering_speedoptional
string

Choose rendering speed for processing time. Use 'Turbo' for fast results or 'Quality' for best results.

Default: "Quality"
Allowed values :
"Default""Turbo""Quality"
resolutionoptional
string

Choose resolution for the image output. For detailed images, pick a higher resolution.

Default: "512x1536"
Allowed values (70 total):
"None""512x1536""576x1408""576x1472""576x1536""640x1344""640x1408""640x1472""640x1536""704x1152"+60 more
seedoptional
integer

Set a seed for reproducible results. Use a fixed seed for consistency across generations.

Default: nullRange: 100 - 999999
style_typeoptional
string

Select the style for the image. Use 'Fiction' for creative artwork or 'Realistic' for lifelike images.

Default: "Realistic"
Allowed values :
"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.

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