Word2img Serverless API
Create beautifully designed words using Segmind’s word to image for your marketing purposes
1import requests
2import json
3
4url = "https://api.segmind.com/v1/w2imgsd1.5-img2img"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "https://segmind.com/word2img_input.png",
12 "prompt": "top-view, A mouth-watering pizza topped with gooey cheese and fresh ingredients,Food Photography",
13 "negative_prompt": "square, poorly drawn, low quality",
14 "scheduler": "ddim",
15 "num_inference_steps": 25,
16 "guidance_scale": 7.5,
17 "control_scale": 1.9,
18 "control_start": 0.19,
19 "control_end": 1,
20 "samples": 1,
21 "seed": 6130473235,
22 "size": 768,
23 "base64": false
24}
25
26response = requests.post(url, headers=headers, json=data)
27
28if response.status_code == 200:
29 result = response.json()
30 print(json.dumps(result, indent=2))
31else:
32 print(f"Error: {response.status_code}")
33 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/w2imgsd1.5-img2img"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "https://segmind.com/word2img_input.png",
12 "prompt": "top-view, A mouth-watering pizza topped with gooey cheese and fresh ingredients,Food Photography",
13 "negative_prompt": "square, poorly drawn, low quality",
14 "scheduler": "ddim",
15 "num_inference_steps": 25,
16 "guidance_scale": 7.5,
17 "control_scale": 1.9,
18 "control_start": 0.19,
19 "control_end": 1,
20 "samples": 1,
21 "seed": 6130473235,
22 "size": 768,
23 "base64": false
24}
25
26response = requests.post(url, headers=headers, json=data)
27
28if response.status_code == 200:
29 result = response.json()
30 print(json.dumps(result, indent=2))
31else:
32 print(f"Error: {response.status_code}")
33 print(response.text)API Endpoint
https://api.segmind.com/v1/w2imgsd1.5-img2imgParameters
imagerequiredstring (uri)Input Image
promptrequiredstringPrompt to render
base64optionalbooleanBase64 encoding of the output image.
falsecontrol_endoptionalnumberScale for controlnet guidance end
1Range: 0.01 - 1control_scaleoptionalnumberScale for controlnet conditioning scale
1.8Range: 0 - 5control_startoptionalnumberScale for controlnet guidance start
0.19Range: 0.01 - 1guidance_scaleoptionalnumberScale for classifier-free guidance
7.5Range: 0.1 - 25negative_promptoptionalstringPrompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'
num_inference_stepsoptionalintegerNumber of denoising steps.
25Range: 25 - 100samplesoptionalintegerNumber of samples to generate.
1Range: 1 - 4scheduleroptionalstringType of scheduler.
"ddim""ddim""dpmpp_2m"seedoptionalintegerSeed for image generation.
-1sizeoptionalintegerImage resolution.
5127681024Response Type
Returns: Image
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out