Kandinsky 2.2
Kandinsky inherits best practicies from Dall-E 2 and Latent diffusion, while introducing some new ideas.
~1.98s
~$0.005
1import requests
2import json
3
4url = "https://api.segmind.com/v1/kandinsky2.2-txt2img"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "masterpiece, best quality, portrait of an old man, 50mm, solo, natural skin texture, realistic eye and face details, dark, deep shadow, darkness, moonlight, award winning photo, extremely detailed, fine detail, highly detailed, extremely detailed eyes and face, piercing red eyes, detailed clothes, skinny, gothic, native american clothing, analog film, stock photograph,",
12 "negative_prompt": "lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands",
13 "samples": 1,
14 "num_inference_steps": 25,
15 "img_width": 512,
16 "img_height": 768,
17 "prior_steps": 25,
18 "seed": 9863172,
19 "base64": false
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text)
1import requests
2import json
3
4url = "https://api.segmind.com/v1/kandinsky2.2-txt2img"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "masterpiece, best quality, portrait of an old man, 50mm, solo, natural skin texture, realistic eye and face details, dark, deep shadow, darkness, moonlight, award winning photo, extremely detailed, fine detail, highly detailed, extremely detailed eyes and face, piercing red eyes, detailed clothes, skinny, gothic, native american clothing, analog film, stock photograph,",
12 "negative_prompt": "lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands",
13 "samples": 1,
14 "num_inference_steps": 25,
15 "img_width": 512,
16 "img_height": 768,
17 "prior_steps": 25,
18 "seed": 9863172,
19 "base64": false
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text)
API Endpoint
POST
https://api.segmind.com/v1/kandinsky2.2-txt2img
Parameters
prompt
requiredstring
Prompt to render
base64
optionalboolean
Base64 encoding of the output image.
Default:
false
img_height
optionalinteger
Image resolution.
Default:
768
Allowed values :
768
1024
img_width
optionalinteger
Image resolution.
Default:
768
Allowed values :
768
1024
negative_prompt
optionalstring
Prompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'
num_inference_steps
optionalinteger
Number of denoising steps.
Default:
20
Range: 20 - 100prior_steps
optionalinteger
Number of denoising steps.
Default:
25
Range: 1 - 100samples
optionalinteger
Number of samples to generate.
Default:
1
Range: 1 - 4seed
optionalinteger
Seed for image generation.
Default:
-1
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