SDXL, developed by Stability AI, is an advanced text-to-image model released in July 2023, offering enhanced image generation capabilities.
The Image Generation or Text-To-Image API endpoint allows you to generate an image from a textual description (prompt).
Image Generation refers to the process of automatically generating visual content (such as images) based on textual descriptions provided as input.
AI Endpoints makes it easy, with ready-to-use inference APIs. Discover how to use them:
This Image Generation API is based on an Open-Source model (Stable Diffusion XL): stabilityai/stable-diffusion-xl-base-1.0. It takes text as input (the prompt) and returns the corresponding image in color.
Model configuration:
The Stable Diffusion XL (SDXL) endpoint offers you an optimized way to generate an image from:
Learn how to use them with the following examples:
Consider changing the your-access-token by your token value before running the following command:
curl -X POST "https://stable-diffusion-xl.endpoints.kepler.ai.cloud.ovh.net/api/text2image" \
-H 'accept: application/octet-stream' \
-H 'content-type: application/json' \
-H 'Authorization: Bearer <your-access-token>' \
-d '{"negative_prompt":"Ugly, unrealistic","prompt":"Photo of a hippopotamus dressed suit and tie sitting in a coffee shop with a matcha latte, award winning photography, Elke vogelsang, 4k"}' \
--output -
Warning:
First install the requests library and pillow dependencies:
pip install requests pillow
Next, export your access token to the OVH_AI_ENDPOINTS_ACCESS_TOKEN environment variable:
export OVH_AI_ENDPOINTS_ACCESS_TOKEN=<your-access-token>
If you do not have an access token key yet, follow the instructions in the AI Endpoints – Getting Started.
Finally, run the following python code:
import os
import io
import requests
import json
from PIL import Image
url = "https://stable-diffusion-xl.endpoints.kepler.ai.cloud.ovh.net/api/text2image"
data = {
"prompt": "Photo of a hippopotamus dressed suit and tie sitting in a coffee shop with a matcha latte, award winning photography, Elke vogelsang, 4k",
"negative_prompt": "Ugly, unrealistic",
}
headers = {
"accept": "application/octet-stream",
"content-type": "application/json",
"Authorization": f"Bearer {os.getenv('OVH_AI_ENDPOINTS_ACCESS_TOKEN')}",
}
response = requests.post(url, headers=headers, data=json.dumps(data))
if response.status_code == 200:
# Handle response
response_data = response.content
img = Image.open(io.BytesIO(response_data))
img.show()
else:
print("Error:", response.status_code)
You will obtain the following (1024x1024) image:

When using AI Endpoints, the following rate limits apply:
If you exceed this limit, a 429 error code will be returned.
If you require higher usage, please get in touch with us to discuss increasing your rate limits.
New to AI Endpoints? This guide walks you through everything you need to get an access token, call AI models, and integrate AI APIs into your apps with ease.
Start TutorialExplore what AI Endpoints can do. This guide breaks down current features, future roadmap items, and the platform's core capabilities so you know exactly what to expect.
Start TutorialRunning into issues? This guide helps you solve common problems on AI Endpoints, from error codes to unexpected responses. Get quick answers, clear fixes, and helpful tips to keep your projects running smoothly.
Start Tutorial