Ideogram 2a Text To Image

Create captivating designs, realistic images & innovative logos with Ideogram 2a text-to-image.

~12.37s
$0.05 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/ideogram-2a-txt-2-img"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "magic_prompt_option": "AUTO",
12    "prompt": "A dreamy, ultra-detailed miniature scene featuring tiny chocolatiers in brown aprons and chef hats, crafting luxurious chocolate treats. Some temper glossy chocolate on a marble slab, while others dip delicate strawberries into molten chocolate fountains. One chef meticulously carves intricate designs into a chocolate bar. The background is a charming chocolate boutique with golden packaging and shelves lined with handcrafted truffles. The rich, warm lighting enhances the decadent and magical atmosphere",
13    "resolution": "RESOLUTION_1024_1024",
14    "seed": 56698,
15    "style_type": "GENERAL"
16}
17
18response = requests.post(url, headers=headers, json=data)
19
20if response.status_code == 200:
21    result = response.json()
22    print(json.dumps(result, indent=2))
23else:
24    print(f"Error: {response.status_code}")
25    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/ideogram-2a-txt-2-img

Parameters

promptrequired
string

Prompt to render

magic_prompt_optionoptional
string

Option for magic prompt

Default: "AUTO"
Allowed values :
"AUTO""ON""OFF"
resolutionoptional
string

Resolution of the output image

Default: "RESOLUTION_1024_1024"
Allowed values (78 total):
"RESOLUTION_512_1536""RESOLUTION_576_1408""RESOLUTION_576_1472""RESOLUTION_576_1536""RESOLUTION_640_1024""RESOLUTION_640_1344""RESOLUTION_640_1408""RESOLUTION_640_1472""RESOLUTION_640_1536""RESOLUTION_704_1152"+68 more
seedoptional
integer

Seed for random generation

Range: 100 - 999999
style_typeoptional
string

Style type for the output

Default: "GENERAL"
Allowed values :
"GENERAL""REALISTIC""DESIGN""RENDER_3D""ANIME"

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