POST/images/generations

Image Generation

Generate images from text descriptions using advanced AI models. Supports multiple sizes and quality settings.

OpenAI Compatible

This endpoint is fully compatible with OpenAI's image generation API. Simply change the base URL and use your Selam API key.

Request

Request Body

1{
2  "model": "selam-image",
3  "prompt": "A serene landscape with mountains and a lake at sunset",
4  "n": 1,
5  "size": "1024x1024",
6  "quality": "standard"
7}

Parameters

modelstringrequired

The model to use for image generation. Use "selam-image" for best results.

promptstringrequired

A text description of the desired image. Maximum length is 1000 characters.

nintegeroptional

The number of images to generate. Must be between 1 and 4. Default is 1.

sizestringoptional

The size of the generated images. Options: "256x256", "512x512", "1024x1024". Default is "1024x1024".

qualitystringoptional

The quality of the image. Options: "standard", "hd". Default is "standard".

Response

1{
2  "created": 1677610602,
3  "data": [
4    {
5      "url": "https://cdn.selamgpt.com/images/abc123.png",
6      "revised_prompt": "A serene landscape with mountains and a lake at sunset"
7    }
8  ]
9}

Examples

1from openai import OpenAI
2
3client = OpenAI(
4    api_key="YOUR_API_KEY",
5    base_url="https://api.selamgpt.com/v1"
6)
7
8response = client.images.generate(
9    model="selam-image",
10    prompt="A serene landscape with mountains and a lake at sunset",
11    n=1,
12    size="1024x1024"
13)
14
15print(response.data[0].url)

Was this page helpful?