Skip to main content

🌌 Image generation API

"Images" is a state-of-the-art image generation model that can create high-quality images from text messages in just seconds. With just a few lines of code, our user-friendly API allows you to generate realistic photos, illustrations, paintings, and much more. See below examples of what you can create with our API.

API Usage​

To use our text-to-image conversion API, send a POST request to https://apigateway.avangenio.net/v1/images/generations. If you haven't done so already, you'll need to create an API key to authenticate your requests.

// npm install --save openai or yarn add openai
import OpenAI from "openai";

const openai = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://apigateway.avangenio.net",
});

const image = await openai.images.generate({
model: "image",
prompt: "A cute baby sea otter",
});

console.log(image.data);

API Response​

Image URLs remain accessible for 60 minutes, after which they will be removed from the servers.

{
"created": 1589478378,
"data": [
{
"url": "https://..."
},
{
"url": "https://..."
}
]
}

API Parameters​

The endpoint POST https://apigateway.avangenio.net/v1/images/generations accepts the following parameters:

ParameterRequiredTypeDefaultDescription
promptyesstring-Description of the desired image(s). The maximum length is 4000 characters.
nnointeger1The number of images to be generated. Only n=1 is supported.
response_formatnourl, b64_jsonurlThe format in which the generated images are returned.
- url will return the image URL.
- b64_json will return the image as a base64-encoded string (stored in the b64_json field).
sizeno1024x1024, 1792x1024, 1024x17921024x1024The size of the generated images.
qualitynostandard, hdstandardThe quality of the generated image.
- hd creates images with finer details and greater consistency throughout the image.
stylenovivid, naturalvividThe style of the generated images.
- vivid makes the model lean towards generating hyper-realistic and dramatic images.
- natural makes the model produce more natural, less hyper-realistic images.

Examples of SDXL Messages:​