Image
Text-to-image capability is the ability of an AI model to generate images based on the input text description. The AI models are trained to create image by taking descriptions from text inputs. Compass offers GPT Image 1, DALL·E, and Stable Diffusion models that can create images for input text descriptions.
Some of the examples of text-to-image capabilities are:
- Entertainment: create visual content for advertisements, movies, TV shows, or animations.
- Education: turn complex topics or project ideas visually.
- Games development: use it for creating game environments or any other required assets.
- Work: create and design product logos, or User Interfaces.
How to use DALL·E?
In the request, write a descriptive text prompt that will guide the model to generate the image that matches your description or vision.
Sample Request Format
curl --location 'https://api.core42.ai/v1/images/generations'
--header 'Authorization: Bearer YOUR_API_KEY'
--header 'Content-Type: application/json'
--data '{
"model": "dall-e-3",
"prompt": "image of a cat sleeping on planet mars"
}'
Sample Response Format

How to use Stable Diffusion?
In the request, write a descriptive text prompt that will guide the model to generate the image that matches your description or vision.
Sample Request Format
{
"model": "sdxl-turbo",
"prompt": "image of a cat sleeping on planet mars"
}
Sample Response Format

If the image does not match your imagination, modify the text and send the request again to generate the image again.
How to Use GPT Image 1?
GPT Image 1 model generates images based on text inputs. The maximum number of characters allowed for text input is 32000.
Sample Request Format to Generate Image
curl --location 'https://api.core42.ai/v1/images/generations' --header 'api-key: YOUR_API_KEY' --header 'Content-Type: application/json' --data '{
"model":"gpt-image-1",
"prompt": "A photograph of a red fox in an autumn forest",
"size": "1024x1024",
"quality": "medium",
"n": 1
}'
Response
{
"model": "gpt-image-1",
"created": 1747135778,
"usage": {
"input_tokens": 16,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 16
},
"output_tokens": 1056,
"total_tokens": 1072
},
"data": {
"b64_json": "b64-encoded image data"
}
}
Edit Images
To edit images, you can provide images as input by providing a fully qualified URL to an image file or an image as a Base64-encoded data URL. Multiple images can be sent in a single request by including them as a content array.
Sample Request
curl --location 'https://api.core42.ai/v1/images/edits'
--header 'api-key: YOUR_API_KEY'
--form 'prompt="Make the characters color to black and change the
background color to white"'
--form 'image[]=@"/Users/admin/Desktop/Screenshot 2025-05-13 at 1.04.04 PM.png"'
--form 'model="gpt-image-1"'