POST/v1/kandinsky2.1-txt2im
1const axios = require('axios');
2
3
4const api_key = "YOUR API-KEY";
5const url = "https://api.segmind.com/v1/kandinsky2.1-txt2im";
6
7const data = {
8  "prompt": "tiny isometric city on a tiny floating island, highly detailed, 3d render",
9  "negative_prompt": "NONE",
10  "scheduler": "DDIM",
11  "samples": 1,
12  "num_inference_steps": 25,
13  "guidance_scale": 7.5,
14  "seed": 1024,
15  "img_width": 512,
16  "img_height": 512,
17  "base64": false
18};
19
20(async function() {
21    try {
22        const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
23        console.log(response.data);
24    } catch (error) {
25        console.error('Error:', error.response.data);
26    }
27})();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing
Expand

Attributes


promptstr ( default: 1 )

Prompt to render


negative_promptstr ( default: None )

Prompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'


schedulerenum:str ( default: 1 )

Type of scheduler.

Allowed values:


samplesint ( default: 1 ) Affects Pricing

Number of samples to generate.

min : 1,

min : 8


num_inference_stepsint ( default: 1 ) Affects Pricing

Number of denoising steps.

min : 10,

min : 40


guidance_scalefloat ( default: 1 )

Scale for classifier-free guidance


seedint ( default: 1 )

Seed for image generation.


img_widthint ( default: 1 ) Affects Pricing

Image resolution.


img_heightint ( default: 1 ) Affects Pricing

Image resolution.


base64boolean ( default: 1 )

Base64 encoding of the output image.

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.