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})();
Prompt to render
Prompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'
Type of scheduler.
Allowed values:
Number of samples to generate.
min : 1,
min : 8
Number of denoising steps.
min : 10,
min : 40
Scale for classifier-free guidance
Seed for image generation.
Image resolution.
Image resolution.
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.