π 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.
- JavaScript
- Python
- curl
// 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);
# pip install --upgrade openai
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://apigateway.avangenio.net",
)
image = client.images.generate(
model="image",
prompt="A cute baby sea otter",
n=1,
size="1024x1024"
)
print(image.data)
curl https://apigateway.avangenio.net/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "image",
"prompt": "A cute baby sea otter",
"n": 1,
"size": "1024x1024"
}'
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:
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
prompt | yes | string | - | Description of the desired image(s). The maximum length is 4000 characters. |
n | no | integer | 1 | The number of images to be generated. Only n=1 is supported. |
response_format | no | url , b64_json | url | The 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). |
size | no | 1024x1024 , 1792x1024 , 1024x1792 | 1024x1024 | The size of the generated images. |
quality | no | standard , hd | standard | The quality of the generated image. - hd creates images with finer details and greater consistency throughout the image. |
style | no | vivid , natural | vivid | The 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. |