How Image Generation Works
You provide a text prompt describing the image you want to create, and the NeosantaraAI API utilizes advanced generative AI models to produce the corresponding image(s). You can specify parameters like the number of images, their size, and the format of the output. The NeosantaraAI API provides an/v1/images/generations endpoint for this purpose.
Usage
To generate images, send a POST request to the/v1/images/generations endpoint with your text prompt and desired parameters.
Endpoint
POST /v1/images/generations
Request Body
Parameters
prompt(string, required): The text description of the image(s) to generate.model(string, optional, default:"neosantara-gen-2045"): The ID of the image generation model to use.n(integer, optional, default:1): The number of images to generate. Must be between 1 and 4.size(string, optional, default:"1024x1024"): The size of the generated images. Supported sizes depend on the model but commonly include"512x512","1024x1024".steps(integer, optional, default:1): The number of diffusion steps for image generation. Higher values generally lead to better quality but take longer.response_format(string, optional, default:"url"): The format in which the generated images are returned."url": Returns a temporary URL to the generated image. These URLs are typically valid for a short period (e.g., 5 minutes)."b64_json": Returns the image data directly as a base64-encoded JSON string.
For b64_json output, may encountered an error. We will fix that later
Supported Image Generation Models
The NeosantaraAI API supports the following image generation models:neosantara-gen-2045: Our primary image generation model. Recommended for quality and speed.
Example Response ("response_format": "url")
Example Response ("response_format": "b64_json")
Python and JavaScript Examples (with OpenAI SDK)
You can generate images using the OpenAI SDK by configuring itsbase_url to point to the NeosantaraAI API.