Imagen 3

Imagen 3 is Google DeepMind's highest quality text-to-image model. Generates detailed images with enhanced lighting, diverse styles, and improved text rendering.

~8.16s
$0.06 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/imagen"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": " White fluffy bear toy is sleeping in a children's room, on the floor of a baby bedroom with toy boxes and toys around, in the style of photorealistic 3D rendering",
12    "aspect_ratio": "1:1",
13    "safety_filter_level": "BLOCK_LOW_AND_ABOVE",
14    "person_generation": "ALLOW_ADULT"
15}
16
17response = requests.post(url, headers=headers, json=data)
18
19if response.status_code == 200:
20    result = response.json()
21    print(json.dumps(result, indent=2))
22else:
23    print(f"Error: {response.status_code}")
24    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/imagen

Parameters

promptrequired
string

Prompt to render

aspect_ratiooptional
string

Changes the aspect ratio of the generated image..

Default: "16:9"
Allowed values :
"1:1""4:3""3:4""9:16""16:9"
person_generationoptional
string

Allow the model to generate images of people.

Default: "ALLOW_ADULT"
Allowed values :
"ALLOW_ADULT""DONT_ALLOW"
safety_filter_leveloptional
string

Adds a filter level to safety filtering.

Default: "BLOCK_LOW_AND_ABOVE"
Allowed values :
"BLOCK_LOW_AND_ABOVE""BLOCK_MEDIUM_AND_ABOVE""BLOCK_ONLY_HIGH"

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